summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-11-09 20:42:00 +0100
committerMichael Goddard <michael.goddard@nokia.com>2011-11-10 04:15:38 +0100
commit1d76e399c5d9277895786c6edc2cec76f99d0531 (patch)
treef56640988d767202cc8f449ff78ad26ff739d314
parent1e542df82fbcc4e3a8f75537af204f83827a4587 (diff)
repo is dead. everything merged to qtmultimedia.HEADmaster
Change-Id: Id6de29b7c1e96aed16be8251195c744f68a2d46b Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
-rw-r--r--README4
-rw-r--r--config.tests/alsa/alsa.pro13
-rw-r--r--config.tests/alsa/alsatest.cpp50
-rw-r--r--config.tests/directshow/directshow.pro11
-rw-r--r--config.tests/directshow/main.cpp56
-rw-r--r--config.tests/evr/evr.pro8
-rw-r--r--config.tests/evr/main.cpp47
-rw-r--r--config.tests/gstreamer/gstreamer.pro20
-rw-r--r--config.tests/gstreamer/main.cpp49
-rw-r--r--config.tests/gstreamer_appsrc/gstreamer_appsrc.pro20
-rw-r--r--config.tests/gstreamer_appsrc/main.cpp49
-rw-r--r--config.tests/gstreamer_photography/gstreamer_photography.pro21
-rw-r--r--config.tests/gstreamer_photography/main.cpp52
-rw-r--r--config.tests/pulseaudio/pulseaudio.cpp55
-rw-r--r--config.tests/pulseaudio/pulseaudio.pro11
-rw-r--r--config.tests/resourcepolicy/main.cpp50
-rw-r--r--config.tests/resourcepolicy/resourcepolicy.pro14
-rwxr-xr-xconfig.tests/tools/which.test40
-rw-r--r--config.tests/wmf/main.cpp56
-rw-r--r--config.tests/wmf/wmf.pro10
-rw-r--r--config.tests/wmp/main.cpp47
-rw-r--r--config.tests/wmp/wmp.pro11
-rw-r--r--config.tests/wmsdk/main.cpp47
-rw-r--r--config.tests/wmsdk/wmsdk.pro8
-rw-r--r--doc/config/compat.qdocconf31
-rw-r--r--doc/config/images/arrow_down.pngbin177 -> 0 bytes
-rwxr-xr-xdoc/config/images/bg_l.pngbin100 -> 0 bytes
-rwxr-xr-xdoc/config/images/bg_l_blank.pngbin84 -> 0 bytes
-rw-r--r--doc/config/images/bg_ll_blank.pngbin320 -> 0 bytes
-rwxr-xr-xdoc/config/images/bg_r.pngbin96 -> 0 bytes
-rw-r--r--doc/config/images/bg_ul_blank.pngbin304 -> 0 bytes
-rwxr-xr-xdoc/config/images/box_bg.pngbin89 -> 0 bytes
-rwxr-xr-xdoc/config/images/breadcrumb.pngbin134 -> 0 bytes
-rw-r--r--doc/config/images/bullet_dn.pngbin230 -> 0 bytes
-rwxr-xr-xdoc/config/images/bullet_gt.pngbin124 -> 0 bytes
-rwxr-xr-xdoc/config/images/bullet_sq.pngbin74 -> 0 bytes
-rw-r--r--doc/config/images/bullet_up.pngbin210 -> 0 bytes
-rwxr-xr-xdoc/config/images/feedbackground.pngbin263 -> 0 bytes
-rw-r--r--doc/config/images/header_bg.pngbin114 -> 0 bytes
-rwxr-xr-xdoc/config/images/horBar.pngbin2807 -> 0 bytes
-rw-r--r--doc/config/images/page.pngbin3102 -> 0 bytes
-rwxr-xr-xdoc/config/images/page_bg.pngbin84 -> 0 bytes
-rw-r--r--doc/config/images/qt-logo.pngbin5149 -> 0 bytes
-rw-r--r--doc/config/images/spinner.gifbin2037 -> 0 bytes
-rwxr-xr-xdoc/config/images/sprites-combined.pngbin65056 -> 0 bytes
-rw-r--r--doc/config/macros.qdocconf37
-rw-r--r--doc/config/qt-cpp-ignore.qdocconf99
-rw-r--r--doc/config/qt-defines.qdocconf17
-rw-r--r--doc/config/qt-html-default-styles.qdocconf32
-rw-r--r--doc/config/qt-html-online-styles.qdocconf72
-rw-r--r--doc/config/qt-html-templates-online.qdocconf142
-rw-r--r--doc/config/qt-html-templates.qdocconf54
-rw-r--r--doc/config/qtmobility-cpp-ignore.qdocconf18
-rw-r--r--doc/config/qtmobility-ditaxml.qdocconf13
-rw-r--r--doc/config/qtmobility-online.qdocconf2
-rw-r--r--doc/config/qtmobility-project.qdocconf142
-rw-r--r--doc/config/qtmobility.qdocconf2
-rw-r--r--doc/config/qtmultimedia-dita.qdocconf32
-rw-r--r--doc/config/qtmultimedia.qdocconf81
-rw-r--r--doc/config/qtmultimedia_doc.pri35
-rw-r--r--doc/config/scripts/functions.js258
-rw-r--r--doc/config/scripts/jquery.js152
-rw-r--r--doc/config/scripts/narrow.js133
-rw-r--r--doc/config/scripts/superfish.js121
-rw-r--r--doc/config/style/narrow.css270
-rw-r--r--doc/config/style/offline.css675
-rw-r--r--doc/config/style/qtmultimedia.css160
-rw-r--r--doc/config/style/style.css1627
-rw-r--r--doc/config/style/style_ie6.css54
-rw-r--r--doc/config/style/style_ie7.css19
-rw-r--r--doc/config/style/style_ie8.css0
-rw-r--r--doc/config/style/superfish.css51
-rw-r--r--doc/doc.pri31
-rw-r--r--doc/doc.pro8
-rw-r--r--doc/src/camera.qdoc181
-rw-r--r--doc/src/classic.css284
-rw-r--r--doc/src/examples/audiodevices.qdoc42
-rw-r--r--doc/src/examples/audiorecorder.qdoc68
-rw-r--r--doc/src/examples/camera.qdoc79
-rw-r--r--doc/src/examples/declarative-camera.qdoc69
-rw-r--r--doc/src/examples/hapticsplayer.qdoc73
-rw-r--r--doc/src/examples/player.qdoc95
-rw-r--r--doc/src/examples/slideshow.qdoc75
-rw-r--r--doc/src/images/annotatedurl.pngbin40129 -> 0 bytes
-rw-r--r--doc/src/images/audiodevices.pngbin37896 -> 0 bytes
-rw-r--r--doc/src/images/camera-example.pngbin13647 -> 0 bytes
-rw-r--r--doc/src/images/codeless.pngbin4636 -> 0 bytes
-rw-r--r--doc/src/images/qml-camera.pngbin28409 -> 0 bytes
-rw-r--r--doc/src/images/slideshow-img1.pngbin596624 -> 0 bytes
-rw-r--r--doc/src/legal/3rdparty.qdoc300
-rw-r--r--doc/src/legal/editions.qdoc64
-rw-r--r--doc/src/legal/gpl.qdoc67
-rw-r--r--doc/src/legal/opensourceedition.qdoc91
-rw-r--r--doc/src/legal/trademarks.qdoc77
-rw-r--r--doc/src/multimedia.qdoc362
-rw-r--r--doc/src/multimediabackend.qdoc126
-rw-r--r--doc/src/plugins/qml-multimedia.qdoc291
-rw-r--r--doc/src/snippets/multimedia-snippets/audio.cpp210
-rw-r--r--doc/src/snippets/multimedia-snippets/audiorecorder.cpp215
-rw-r--r--doc/src/snippets/multimedia-snippets/camera.cpp82
-rw-r--r--doc/src/snippets/multimedia-snippets/media.cpp236
-rw-r--r--doc/src/snippets/multimedia-snippets/multimedia-snippets.pro20
-rw-r--r--doc/src/snippets/multimedia-snippets/player.cpp317
-rw-r--r--doc/src/snippets/multimedia-snippets/soundeffect.qml63
-rw-r--r--doc/src/snippets/multimedia-snippets/video.cpp129
-rw-r--r--doc/src/snippets/snippets.pro3
-rw-r--r--examples/audiodevices/audiodevices.cpp312
-rw-r--r--examples/audiodevices/audiodevices.h83
-rw-r--r--examples/audiodevices/audiodevices.pro19
-rw-r--r--examples/audiodevices/audiodevicesbase.ui399
-rw-r--r--examples/audiodevices/main.cpp54
-rw-r--r--examples/audioinput/audioinput.cpp366
-rw-r--r--examples/audioinput/audioinput.h139
-rw-r--r--examples/audioinput/audioinput.pro17
-rw-r--r--examples/audioinput/main.cpp54
-rw-r--r--examples/audiooutput/audiooutput.cpp334
-rw-r--r--examples/audiooutput/audiooutput.h128
-rw-r--r--examples/audiooutput/audiooutput.pro17
-rw-r--r--examples/audiooutput/main.cpp55
-rw-r--r--examples/audiorecorder/audiorecorder.cpp225
-rw-r--r--examples/audiorecorder/audiorecorder.h88
-rw-r--r--examples/audiorecorder/audiorecorder.pro25
-rw-r--r--examples/audiorecorder/audiorecorder.ui250
-rw-r--r--examples/audiorecorder/audiorecorder_small.ui266
-rw-r--r--examples/audiorecorder/main.cpp53
-rw-r--r--examples/camera/camera.cpp440
-rw-r--r--examples/camera/camera.h126
-rw-r--r--examples/camera/camera.pro28
-rw-r--r--examples/camera/camera.ui492
-rw-r--r--examples/camera/imagesettings.cpp126
-rw-r--r--examples/camera/imagesettings.h84
-rw-r--r--examples/camera/imagesettings.ui123
-rw-r--r--examples/camera/main.cpp53
-rw-r--r--examples/camera/videosettings.cpp191
-rw-r--r--examples/camera/videosettings.h84
-rw-r--r--examples/camera/videosettings.ui211
-rw-r--r--examples/declarative-camera/CameraButton.qml71
-rw-r--r--examples/declarative-camera/CameraPropertyButton.qml107
-rw-r--r--examples/declarative-camera/CameraPropertyPopup.qml122
-rw-r--r--examples/declarative-camera/CaptureControls.qml237
-rw-r--r--examples/declarative-camera/ExposureCompensationButton.qml85
-rw-r--r--examples/declarative-camera/FlickableList.qml128
-rw-r--r--examples/declarative-camera/FocusButton.qml62
-rw-r--r--examples/declarative-camera/PhotoPreview.qml62
-rw-r--r--examples/declarative-camera/ZoomControl.qml118
-rw-r--r--examples/declarative-camera/declarative-camera.pro22
-rw-r--r--examples/declarative-camera/declarative-camera.qml116
-rw-r--r--examples/declarative-camera/declarative-camera.qmlproject18
-rw-r--r--examples/declarative-camera/declarative-camera.qrc28
-rw-r--r--examples/declarative-camera/images/camera_auto_mode.pngbin778 -> 0 bytes
-rw-r--r--examples/declarative-camera/images/camera_camera_setting.pngbin717 -> 0 bytes
-rw-r--r--examples/declarative-camera/images/camera_flash_auto.pngbin1119 -> 0 bytes
-rw-r--r--examples/declarative-camera/images/camera_flash_fill.pngbin610 -> 0 bytes
-rw-r--r--examples/declarative-camera/images/camera_flash_off.pngbin717 -> 0 bytes
-rw-r--r--examples/declarative-camera/images/camera_flash_redeye.pngbin945 -> 0 bytes
-rw-r--r--examples/declarative-camera/images/camera_white_balance_cloudy.pngbin625 -> 0 bytes
-rw-r--r--examples/declarative-camera/images/camera_white_balance_flourescent.pngbin554 -> 0 bytes
-rw-r--r--examples/declarative-camera/images/camera_white_balance_incandescent.pngbin600 -> 0 bytes
-rw-r--r--examples/declarative-camera/images/camera_white_balance_sunny.pngbin587 -> 0 bytes
-rw-r--r--examples/declarative-camera/images/toolbutton.pngbin2550 -> 0 bytes
-rw-r--r--examples/declarative-camera/images/toolbutton.sci5
-rw-r--r--examples/declarative-camera/qmlcamera.cpp88
-rw-r--r--examples/declarative-radio/declarative-radio.pro10
-rw-r--r--examples/declarative-radio/declarative-radio.qrc6
-rw-r--r--examples/declarative-radio/main.cpp58
-rw-r--r--examples/declarative-radio/view.qml191
-rw-r--r--examples/examples.pro21
-rw-r--r--examples/player/main.cpp70
-rw-r--r--examples/player/player.cpp418
-rw-r--r--examples/player/player.h123
-rw-r--r--examples/player/player.pro32
-rw-r--r--examples/player/playercontrols.cpp209
-rw-r--r--examples/player/playercontrols.h101
-rw-r--r--examples/player/playlistmodel.cpp159
-rw-r--r--examples/player/playlistmodel.h90
-rw-r--r--examples/player/videowidget.cpp83
-rw-r--r--examples/player/videowidget.h59
-rw-r--r--examples/radio/main.cpp53
-rw-r--r--examples/radio/radio.cpp160
-rw-r--r--examples/radio/radio.h84
-rw-r--r--examples/radio/radio.pro19
-rw-r--r--examples/slideshow/main.cpp53
-rw-r--r--examples/slideshow/slideshow.cpp215
-rw-r--r--examples/slideshow/slideshow.h87
-rw-r--r--examples/slideshow/slideshow.pro19
-rw-r--r--examples/spectrum/3rdparty/fftreal/Array.h97
-rw-r--r--examples/spectrum/3rdparty/fftreal/Array.hpp98
-rw-r--r--examples/spectrum/3rdparty/fftreal/DynArray.h100
-rw-r--r--examples/spectrum/3rdparty/fftreal/DynArray.hpp143
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTReal.dsp273
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTReal.dsw29
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTReal.h142
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTReal.hpp916
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTRealFixLen.h130
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTRealFixLen.hpp322
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTRealFixLenParam.h93
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTRealPassDirect.h96
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTRealPassDirect.hpp204
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTRealPassInverse.h101
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTRealPassInverse.hpp229
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTRealSelect.h77
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTRealSelect.hpp62
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTRealUseTrigo.h101
-rw-r--r--examples/spectrum/3rdparty/fftreal/FFTRealUseTrigo.hpp91
-rw-r--r--examples/spectrum/3rdparty/fftreal/OscSinCos.h106
-rw-r--r--examples/spectrum/3rdparty/fftreal/OscSinCos.hpp122
-rw-r--r--examples/spectrum/3rdparty/fftreal/TestAccuracy.h105
-rw-r--r--examples/spectrum/3rdparty/fftreal/TestAccuracy.hpp472
-rw-r--r--examples/spectrum/3rdparty/fftreal/TestHelperFixLen.h93
-rw-r--r--examples/spectrum/3rdparty/fftreal/TestHelperFixLen.hpp93
-rw-r--r--examples/spectrum/3rdparty/fftreal/TestHelperNormal.h94
-rw-r--r--examples/spectrum/3rdparty/fftreal/TestHelperNormal.hpp99
-rw-r--r--examples/spectrum/3rdparty/fftreal/TestSpeed.h95
-rw-r--r--examples/spectrum/3rdparty/fftreal/TestSpeed.hpp223
-rw-r--r--examples/spectrum/3rdparty/fftreal/TestWhiteNoiseGen.h95
-rw-r--r--examples/spectrum/3rdparty/fftreal/TestWhiteNoiseGen.hpp91
-rw-r--r--examples/spectrum/3rdparty/fftreal/bwins/fftrealu.def5
-rw-r--r--examples/spectrum/3rdparty/fftreal/def.h60
-rw-r--r--examples/spectrum/3rdparty/fftreal/eabi/fftrealu.def7
-rw-r--r--examples/spectrum/3rdparty/fftreal/fftreal.pas661
-rw-r--r--examples/spectrum/3rdparty/fftreal/fftreal.pro46
-rw-r--r--examples/spectrum/3rdparty/fftreal/fftreal_wrapper.cpp54
-rw-r--r--examples/spectrum/3rdparty/fftreal/fftreal_wrapper.h63
-rw-r--r--examples/spectrum/3rdparty/fftreal/license.txt459
-rw-r--r--examples/spectrum/3rdparty/fftreal/readme.txt242
-rw-r--r--examples/spectrum/3rdparty/fftreal/stopwatch/ClockCycleCounter.cpp285
-rw-r--r--examples/spectrum/3rdparty/fftreal/stopwatch/ClockCycleCounter.h124
-rw-r--r--examples/spectrum/3rdparty/fftreal/stopwatch/ClockCycleCounter.hpp150
-rw-r--r--examples/spectrum/3rdparty/fftreal/stopwatch/Int64.h71
-rw-r--r--examples/spectrum/3rdparty/fftreal/stopwatch/StopWatch.cpp101
-rw-r--r--examples/spectrum/3rdparty/fftreal/stopwatch/StopWatch.h110
-rw-r--r--examples/spectrum/3rdparty/fftreal/stopwatch/StopWatch.hpp83
-rw-r--r--examples/spectrum/3rdparty/fftreal/stopwatch/def.h65
-rw-r--r--examples/spectrum/3rdparty/fftreal/stopwatch/fnc.h67
-rw-r--r--examples/spectrum/3rdparty/fftreal/stopwatch/fnc.hpp85
-rw-r--r--examples/spectrum/3rdparty/fftreal/test.cpp267
-rw-r--r--examples/spectrum/3rdparty/fftreal/test_fnc.h53
-rw-r--r--examples/spectrum/3rdparty/fftreal/test_fnc.hpp56
-rw-r--r--examples/spectrum/3rdparty/fftreal/test_settings.h45
-rw-r--r--examples/spectrum/3rdparty/fftreal/testapp.dpr150
-rw-r--r--examples/spectrum/README.txt103
-rw-r--r--examples/spectrum/TODO.txt34
-rw-r--r--examples/spectrum/app/.gitignore2
-rw-r--r--examples/spectrum/app/app.pro93
-rw-r--r--examples/spectrum/app/engine.cpp766
-rw-r--r--examples/spectrum/app/engine.h315
-rw-r--r--examples/spectrum/app/frequencyspectrum.cpp89
-rw-r--r--examples/spectrum/app/frequencyspectrum.h98
-rw-r--r--examples/spectrum/app/images/record.pngbin670 -> 0 bytes
-rw-r--r--examples/spectrum/app/images/settings.pngbin3649 -> 0 bytes
-rw-r--r--examples/spectrum/app/levelmeter.cpp142
-rw-r--r--examples/spectrum/app/levelmeter.h116
-rw-r--r--examples/spectrum/app/main.cpp53
-rw-r--r--examples/spectrum/app/mainwidget.cpp448
-rw-r--r--examples/spectrum/app/mainwidget.h144
-rw-r--r--examples/spectrum/app/progressbar.cpp140
-rw-r--r--examples/spectrum/app/progressbar.h74
-rw-r--r--examples/spectrum/app/settingsdialog.cpp148
-rw-r--r--examples/spectrum/app/settingsdialog.h87
-rw-r--r--examples/spectrum/app/spectrograph.cpp241
-rw-r--r--examples/spectrum/app/spectrograph.h99
-rw-r--r--examples/spectrum/app/spectrum.h144
-rw-r--r--examples/spectrum/app/spectrum.qrc7
-rw-r--r--examples/spectrum/app/spectrumanalyser.cpp281
-rw-r--r--examples/spectrum/app/spectrumanalyser.h194
-rw-r--r--examples/spectrum/app/tonegenerator.cpp91
-rw-r--r--examples/spectrum/app/tonegenerator.h56
-rw-r--r--examples/spectrum/app/tonegeneratordialog.cpp147
-rw-r--r--examples/spectrum/app/tonegeneratordialog.h81
-rw-r--r--examples/spectrum/app/utils.cpp139
-rw-r--r--examples/spectrum/app/utils.h112
-rw-r--r--examples/spectrum/app/waveform.cpp436
-rw-r--r--examples/spectrum/app/waveform.h203
-rw-r--r--examples/spectrum/app/wavfile.cpp151
-rw-r--r--examples/spectrum/app/wavfile.h68
-rw-r--r--examples/spectrum/spectrum.pri49
-rw-r--r--examples/spectrum/spectrum.pro20
-rw-r--r--examples/videographicsitem/main.cpp54
-rw-r--r--examples/videographicsitem/videographicsitem.pro21
-rw-r--r--examples/videographicsitem/videoitem.cpp144
-rw-r--r--examples/videographicsitem/videoitem.h78
-rw-r--r--examples/videographicsitem/videoplayer.cpp174
-rw-r--r--examples/videographicsitem/videoplayer.h85
-rw-r--r--examples/videowidget/main.cpp53
-rw-r--r--examples/videowidget/videoplayer.cpp143
-rw-r--r--examples/videowidget/videoplayer.h77
-rw-r--r--examples/videowidget/videowidget.cpp114
-rw-r--r--examples/videowidget/videowidget.h75
-rw-r--r--examples/videowidget/videowidget.pro23
-rw-r--r--examples/videowidget/videowidgetsurface.cpp176
-rw-r--r--examples/videowidget/videowidgetsurface.h80
-rw-r--r--modules/qt_multimedia.pri17
-rw-r--r--modules/qt_multimediawidgets.pri17
-rw-r--r--qtmultimedia.pro23
-rw-r--r--qtmultimediakit.pro4
-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
-rw-r--r--sync.profile53
-rw-r--r--tests/auto/auto.pro12
-rw-r--r--tests/auto/multimedia.pro57
-rw-r--r--tests/auto/multimediawidgets.pro25
-rw-r--r--tests/auto/qabstractvideobuffer/qabstractvideobuffer.pro8
-rw-r--r--tests/auto/qabstractvideobuffer/tst_qabstractvideobuffer.cpp155
-rw-r--r--tests/auto/qabstractvideosurface/qabstractvideosurface.pro8
-rw-r--r--tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp399
-rw-r--r--tests/auto/qaudiocapturesource/qaudiocapturesource.pro11
-rw-r--r--tests/auto/qaudiocapturesource/tst_qaudiocapturesource.cpp204
-rw-r--r--tests/auto/qaudiodeviceinfo/qaudiodeviceinfo.pro10
-rw-r--r--tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp277
-rw-r--r--tests/auto/qaudioformat/qaudioformat.pro8
-rw-r--r--tests/auto/qaudioformat/tst_qaudioformat.cpp215
-rw-r--r--tests/auto/qaudioinput/qaudioinput.pro12
-rwxr-xr-xtests/auto/qaudioinput/tst_qaudioinput.cpp852
-rwxr-xr-xtests/auto/qaudioinput/wavheader.cpp205
-rwxr-xr-xtests/auto/qaudioinput/wavheader.h80
-rw-r--r--tests/auto/qaudiooutput/qaudiooutput.pro12
-rwxr-xr-xtests/auto/qaudiooutput/tst_qaudiooutput.cpp959
-rwxr-xr-xtests/auto/qaudiooutput/wavheader.cpp205
-rwxr-xr-xtests/auto/qaudiooutput/wavheader.h80
-rw-r--r--tests/auto/qcamera/qcamera.pro12
-rw-r--r--tests/auto/qcamera/tst_qcamera.cpp1956
-rw-r--r--tests/auto/qcamerabackend/qcamerabackend.pro10
-rw-r--r--tests/auto/qcamerabackend/tst_qcamerabackend.cpp624
-rw-r--r--tests/auto/qcameraimagecapture/qcameraimagecapture.pro11
-rw-r--r--tests/auto/qcameraimagecapture/tst_qcameraimagecapture.cpp432
-rw-r--r--tests/auto/qcameraviewfinder/qcameraviewfinder.pro11
-rw-r--r--tests/auto/qcameraviewfinder/tst_qcameraviewfinder.cpp113
-rw-r--r--tests/auto/qcamerawidgets/qcamerawidgets.pro13
-rw-r--r--tests/auto/qcamerawidgets/tst_qcamerawidgets.cpp318
-rw-r--r--tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro17
-rw-r--r--tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp1301
-rw-r--r--tests/auto/qdeclarativevideo/qdeclarativevideo.pro18
-rw-r--r--tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp991
-rw-r--r--tests/auto/qgraphicsvideoitem/qgraphicsvideoitem.pro11
-rw-r--r--tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp675
-rw-r--r--tests/auto/qmediabindableinterface/qmediabindableinterface.pro11
-rw-r--r--tests/auto/qmediabindableinterface/tst_qmediabindableinterface.cpp137
-rw-r--r--tests/auto/qmediacontainercontrol/qmediacontainercontrol.pro10
-rw-r--r--tests/auto/qmediacontainercontrol/tst_qmediacontainercontrol.cpp79
-rw-r--r--tests/auto/qmediacontent/qmediacontent.pro7
-rw-r--r--tests/auto/qmediacontent/tst_qmediacontent.cpp177
-rw-r--r--tests/auto/qmediaimageviewer/images.qrc9
-rw-r--r--tests/auto/qmediaimageviewer/images/coverart.pngbin230 -> 0 bytes
-rw-r--r--tests/auto/qmediaimageviewer/images/image.jpgbin2045 -> 0 bytes
-rw-r--r--tests/auto/qmediaimageviewer/images/image.pngbin230 -> 0 bytes
-rw-r--r--tests/auto/qmediaimageviewer/images/invalid.png2
-rw-r--r--tests/auto/qmediaimageviewer/images/poster.pngbin230 -> 0 bytes
-rw-r--r--tests/auto/qmediaimageviewer/qmediaimageviewer.pro16
-rw-r--r--tests/auto/qmediaimageviewer/tst_qmediaimageviewer.cpp1044
-rw-r--r--tests/auto/qmediaimageviewerwidgets/images.qrc5
-rw-r--r--tests/auto/qmediaimageviewerwidgets/images/image.pngbin230 -> 0 bytes
-rw-r--r--tests/auto/qmediaimageviewerwidgets/qmediaimageviewerwidgets.pro17
-rw-r--r--tests/auto/qmediaimageviewerwidgets/tst_qmediaimageviewerwidgets.cpp142
-rw-r--r--tests/auto/qmediaobject/main.cpp53
-rw-r--r--tests/auto/qmediaobject/qmediaobject.pro11
-rw-r--r--tests/auto/qmediaobject/tst_qmediaobject.cpp403
-rw-r--r--tests/auto/qmediaobject/tst_qmediaobject.h147
-rwxr-xr-xtests/auto/qmediaplayer/main.cpp53
-rw-r--r--tests/auto/qmediaplayer/qmediaplayer.pro11
-rw-r--r--tests/auto/qmediaplayer/tst_qmediaplayer.cpp1050
-rwxr-xr-xtests/auto/qmediaplayer/tst_qmediaplayer.h133
-rw-r--r--tests/auto/qmediaplayerbackend/qmediaplayerbackend.pro12
-rw-r--r--tests/auto/qmediaplayerbackend/testdata/test.wavbin88232 -> 0 bytes
-rw-r--r--tests/auto/qmediaplayerbackend/tst_qmediaplayerbackend.cpp462
-rwxr-xr-xtests/auto/qmediaplayerwidgets/main.cpp53
-rw-r--r--tests/auto/qmediaplayerwidgets/qmediaplayerwidgets.pro11
-rw-r--r--tests/auto/qmediaplayerwidgets/tst_qmediaplayerwidgets.cpp162
-rwxr-xr-xtests/auto/qmediaplayerwidgets/tst_qmediaplayerwidgets.h79
-rw-r--r--tests/auto/qmediaplaylist/qmediaplaylist.pro21
-rw-r--r--tests/auto/qmediaplaylist/testdata/test.m3u11
-rw-r--r--tests/auto/qmediaplaylist/testdata/testfile0
-rw-r--r--tests/auto/qmediaplaylist/testdata/testfile2#suffix0
-rw-r--r--tests/auto/qmediaplaylist/tst_qmediaplaylist.cpp783
-rw-r--r--tests/auto/qmediaplaylistnavigator/qmediaplaylistnavigator.pro8
-rw-r--r--tests/auto/qmediaplaylistnavigator/tst_qmediaplaylistnavigator.cpp525
-rw-r--r--tests/auto/qmediapluginloader/qmediapluginloader.pro14
-rw-r--r--tests/auto/qmediapluginloader/tst_qmediapluginloader.cpp123
-rwxr-xr-xtests/auto/qmediarecorder/main.cpp53
-rw-r--r--tests/auto/qmediarecorder/qmediarecorder.pro12
-rw-r--r--tests/auto/qmediarecorder/tst_qmediarecorder.cpp1286
-rwxr-xr-xtests/auto/qmediarecorder/tst_qmediarecorder.h127
-rw-r--r--tests/auto/qmediaresource/qmediaresource.pro8
-rw-r--r--tests/auto/qmediaresource/tst_qmediaresource.cpp700
-rw-r--r--tests/auto/qmediaservice/qmediaservice.pro7
-rw-r--r--tests/auto/qmediaservice/tst_qmediaservice.cpp280
-rw-r--r--tests/auto/qmediaserviceprovider/qmediaserviceprovider.pro8
-rw-r--r--tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp499
-rw-r--r--tests/auto/qmediastreamscontrol/qmediastreamscontrol.pro10
-rw-r--r--tests/auto/qmediastreamscontrol/tst_qmediastreamscontrol.cpp408
-rw-r--r--tests/auto/qmediatimerange/qmediatimerange.pro8
-rw-r--r--tests/auto/qmediatimerange/tst_qmediatimerange.cpp806
-rw-r--r--tests/auto/qmetadatareadercontrol/qmetadatareadercontrol.pro10
-rw-r--r--tests/auto/qmetadatareadercontrol/tst_qmetadatareadercontrol.cpp143
-rw-r--r--tests/auto/qmetadatawritercontrol/qmetadatawritercontrol.pro9
-rw-r--r--tests/auto/qmetadatawritercontrol/tst_qmetadatawritercontrol.cpp89
-rw-r--r--tests/auto/qmultimedia_common/mock.pri7
-rw-r--r--tests/auto/qmultimedia_common/mockaudioencodercontrol.h127
-rw-r--r--tests/auto/qmultimedia_common/mockaudioendpointselector.h117
-rw-r--r--tests/auto/qmultimedia_common/mockcamera.pri22
-rw-r--r--tests/auto/qmultimedia_common/mockcameracapturebuffercontrol.h83
-rw-r--r--tests/auto/qmultimedia_common/mockcameracapturedestinationcontrol.h80
-rw-r--r--tests/auto/qmultimedia_common/mockcameracontrol.h145
-rw-r--r--tests/auto/qmultimedia_common/mockcameraexposurecontrol.h282
-rw-r--r--tests/auto/qmultimedia_common/mockcameraflashcontrol.h89
-rw-r--r--tests/auto/qmultimedia_common/mockcamerafocuscontrol.h199
-rw-r--r--tests/auto/qmultimedia_common/mockcameraimagecapturecontrol.h130
-rw-r--r--tests/auto/qmultimedia_common/mockcameraimageprocessingcontrol.h156
-rw-r--r--tests/auto/qmultimedia_common/mockcameralockscontrol.h144
-rw-r--r--tests/auto/qmultimedia_common/mockcameraservice.h196
-rw-r--r--tests/auto/qmultimedia_common/mockcontainer.pri7
-rw-r--r--tests/auto/qmultimedia_common/mockimageencodercontrol.h103
-rw-r--r--tests/auto/qmultimedia_common/mockmediacontainercontrol.h97
-rw-r--r--tests/auto/qmultimedia_common/mockmedianetworkaccesscontrol.h83
-rw-r--r--tests/auto/qmultimedia_common/mockmediaobject.h57
-rw-r--r--tests/auto/qmultimedia_common/mockmediaplayercontrol.h118
-rw-r--r--tests/auto/qmultimedia_common/mockmediaplayerservice.h176
-rw-r--r--tests/auto/qmultimedia_common/mockmediaplaylistcontrol.h112
-rw-r--r--tests/auto/qmultimedia_common/mockmediaplaylistsourcecontrol.h74
-rw-r--r--tests/auto/qmultimedia_common/mockmediarecordercontrol.h125
-rw-r--r--tests/auto/qmultimedia_common/mockmediarecorderservice.h101
-rw-r--r--tests/auto/qmultimedia_common/mockmediaservice.h66
-rw-r--r--tests/auto/qmultimedia_common/mockmediaserviceprovider.h74
-rw-r--r--tests/auto/qmultimedia_common/mockmediastreamscontrol.h78
-rw-r--r--tests/auto/qmultimedia_common/mockmetadatareadercontrol.h98
-rw-r--r--tests/auto/qmultimedia_common/mockmetadatawritercontrol.h107
-rw-r--r--tests/auto/qmultimedia_common/mockplayer.pri12
-rw-r--r--tests/auto/qmultimedia_common/mockplaylist.pri8
-rw-r--r--tests/auto/qmultimedia_common/mockplaylistservice.h77
-rw-r--r--tests/auto/qmultimedia_common/mockradio.pri8
-rw-r--r--tests/auto/qmultimedia_common/mockradiodatacontrol.h157
-rw-r--r--tests/auto/qmultimedia_common/mockradiotunercontrol.h275
-rw-r--r--tests/auto/qmultimedia_common/mockreadonlyplaylistprovider.h69
-rw-r--r--tests/auto/qmultimedia_common/mockrecorder.pri14
-rw-r--r--tests/auto/qmultimedia_common/mockvideo.pri14
-rw-r--r--tests/auto/qmultimedia_common/mockvideoencodercontrol.h112
-rw-r--r--tests/auto/qmultimedia_common/mockvideorenderercontrol.h58
-rw-r--r--tests/auto/qmultimedia_common/mockvideosurface.h59
-rw-r--r--tests/auto/qmultimedia_common/mockvideowindowcontrol.h74
-rw-r--r--tests/auto/qpaintervideosurface/qpaintervideosurface.pro18
-rw-r--r--tests/auto/qpaintervideosurface/tst_qpaintervideosurface.cpp1249
-rwxr-xr-xtests/auto/qradiodata/main.cpp53
-rw-r--r--tests/auto/qradiodata/qradiodata.pro11
-rw-r--r--tests/auto/qradiodata/tst_qradiodata.cpp148
-rw-r--r--tests/auto/qradiodata/tst_qradiodata.h80
-rwxr-xr-xtests/auto/qradiotuner/main.cpp53
-rw-r--r--tests/auto/qradiotuner/qradiotuner.pro11
-rw-r--r--tests/auto/qradiotuner/tst_qradiotuner.cpp336
-rw-r--r--tests/auto/qradiotuner/tst_qradiotuner.h87
-rw-r--r--tests/auto/qsoundeffect/qsoundeffect.pro17
-rw-r--r--tests/auto/qsoundeffect/test.wavbin38316 -> 0 bytes
-rw-r--r--tests/auto/qsoundeffect/tst_qsoundeffect.cpp195
-rw-r--r--tests/auto/qvideodevicecontrol/qvideodevicecontrol.pro7
-rw-r--r--tests/auto/qvideodevicecontrol/tst_qvideodevicecontrol.cpp110
-rw-r--r--tests/auto/qvideoencodercontrol/qvideoencodercontrol.pro9
-rw-r--r--tests/auto/qvideoencodercontrol/tst_qvideoencodercontrol.cpp139
-rw-r--r--tests/auto/qvideoframe/qvideoframe.pro8
-rw-r--r--tests/auto/qvideoframe/tst_qvideoframe.cpp969
-rw-r--r--tests/auto/qvideosurfaceformat/qvideosurfaceformat.pro8
-rw-r--r--tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp1067
-rw-r--r--tests/auto/qvideowidget/qvideowidget.pro11
-rw-r--r--tests/auto/qvideowidget/tst_qvideowidget.cpp1567
-rw-r--r--tests/auto/qwavedecoder/data/corrupt_datadesc_1_16_8000.le.wavbin4044 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/corrupt_fmtdesc_1_16_8000.le.wavbin4044 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/corrupt_fmtstring_1_16_8000.le.wavbin4044 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/empty.wav0
-rwxr-xr-xtests/auto/qwavedecoder/data/gendata.sh68
-rw-r--r--tests/auto/qwavedecoder/data/isawav_1_16_44100_le.wavbin22094 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/isawav_1_16_8000_le.wavbin4044 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/isawav_1_32_44100_le.wavbin44180 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/isawav_1_32_8000_le.wavbin8080 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/isawav_1_8_44100.wavbin11069 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/isawav_1_8_8000.wavbin2044 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/isawav_2_16_44100_be.wavbin44144 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/isawav_2_16_8000_be.wavbin8044 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/isawav_2_32_44100_be.wavbin88280 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/isawav_2_32_8000_be.wavbin16080 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/isawav_2_8_44100.wavbin22094 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/isawav_2_8_8000.wavbin4044 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/nosampledata.wavbin44 -> 0 bytes
-rw-r--r--tests/auto/qwavedecoder/data/notawav.wav1
-rw-r--r--tests/auto/qwavedecoder/data/onebyte.wav1
-rw-r--r--tests/auto/qwavedecoder/qwavedecoder.pro12
-rw-r--r--tests/auto/qwavedecoder/tst_qwavedecoder.cpp327
-rw-r--r--tests/systemtests/audio/sys_audio.qtt295
-rw-r--r--tests/systemtests/camera/sys_camera.qtt181
-rw-r--r--tests/systemtests/radio/sys_radio.qtt161
-rw-r--r--tests/systemtests/video/sys_video.qtt269
-rw-r--r--tests/tests.pro5
1020 files changed, 4 insertions, 177508 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..f45dd20
--- /dev/null
+++ b/README
@@ -0,0 +1,4 @@
+This repository is obsolete; all contents were merged to QtMultimedia.
+Use
+ $ git checkout HEAD~1
+to get the last revision.
diff --git a/config.tests/alsa/alsa.pro b/config.tests/alsa/alsa.pro
deleted file mode 100644
index 00f2386..0000000
--- a/config.tests/alsa/alsa.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
-
-requires(unix)
-
-SOURCES = alsatest.cpp
-
-CONFIG -= qt dylib
-mac:CONFIG -= app_bundle
-
-LIBS+=-lasound
-
diff --git a/config.tests/alsa/alsatest.cpp b/config.tests/alsa/alsatest.cpp
deleted file mode 100644
index 829977f..0000000
--- a/config.tests/alsa/alsatest.cpp
+++ /dev/null
@@ -1,50 +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 documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <alsa/asoundlib.h>
-#if (!(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 10))
-#error "Alsa version found too old, require >= 1.0.10"
-#endif
-
-int main(int argc,char **argv)
-{
-}
-
diff --git a/config.tests/directshow/directshow.pro b/config.tests/directshow/directshow.pro
deleted file mode 100644
index 0ad9cb7..0000000
--- a/config.tests/directshow/directshow.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG -= qt
-CONFIG += console
-TEMPLATE = app
-
-requires(win32*)
-
-# Input
-SOURCES += main.cpp
-
-LIBS += -lstrmiids -ldmoguids -luuid -lmsdmo -lole32 -loleaut32
-
diff --git a/config.tests/directshow/main.cpp b/config.tests/directshow/main.cpp
deleted file mode 100644
index 3ebd7ac..0000000
--- a/config.tests/directshow/main.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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 <dshow.h>
-#include <d3d9.h>
-#include <vmr9.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>
-
-int main(int, char**)
-{
- return 0;
-}
diff --git a/config.tests/evr/evr.pro b/config.tests/evr/evr.pro
deleted file mode 100644
index c15b6c8..0000000
--- a/config.tests/evr/evr.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG -= qt
-CONFIG += console
-TEMPLATE = app
-
-requires(win32*)
-
-# Input
-SOURCES += main.cpp
diff --git a/config.tests/evr/main.cpp b/config.tests/evr/main.cpp
deleted file mode 100644
index bbff754..0000000
--- a/config.tests/evr/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 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 <evr.h>
-
-int main(int, char**)
-{
- return 0;
-}
diff --git a/config.tests/gstreamer/gstreamer.pro b/config.tests/gstreamer/gstreamer.pro
deleted file mode 100644
index 5fcd1ab..0000000
--- a/config.tests/gstreamer/gstreamer.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
-
-requires(unix)
-
-# Input
-SOURCES += main.cpp
-
-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
-
-
diff --git a/config.tests/gstreamer/main.cpp b/config.tests/gstreamer/main.cpp
deleted file mode 100644
index 94228d1..0000000
--- a/config.tests/gstreamer/main.cpp
+++ /dev/null
@@ -1,49 +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$
-**
-****************************************************************************/
-
-#define GST_USE_UNSTABLE_API
-
-#include <gst/gst.h>
-
-int main(int argc, char** argv)
-{
- return 0;
-}
diff --git a/config.tests/gstreamer_appsrc/gstreamer_appsrc.pro b/config.tests/gstreamer_appsrc/gstreamer_appsrc.pro
deleted file mode 100644
index b0a6efc..0000000
--- a/config.tests/gstreamer_appsrc/gstreamer_appsrc.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
-
-requires(unix)
-
-# Input
-SOURCES += main.cpp
-
-CONFIG += link_pkgconfig
-
-PKGCONFIG += \
- gstreamer-0.10 \
- gstreamer-base-0.10 \
- gstreamer-interfaces-0.10 \
- gstreamer-audio-0.10 \
- gstreamer-video-0.10 \
- gstreamer-app-0.10
-
-
diff --git a/config.tests/gstreamer_appsrc/main.cpp b/config.tests/gstreamer_appsrc/main.cpp
deleted file mode 100644
index 7182fd3..0000000
--- a/config.tests/gstreamer_appsrc/main.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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$
-**
-****************************************************************************/
-
-#define GST_USE_UNSTABLE_API
-
-#include <gst/app/gstappsrc.h>
-
-int main(int argc, char** argv)
-{
- return 0;
-}
diff --git a/config.tests/gstreamer_photography/gstreamer_photography.pro b/config.tests/gstreamer_photography/gstreamer_photography.pro
deleted file mode 100644
index 3b384b0..0000000
--- a/config.tests/gstreamer_photography/gstreamer_photography.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
-
-requires(unix)
-
-# Input
-SOURCES += main.cpp
-
-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
-
-LIBS += -lgstphotography-0.10
-
diff --git a/config.tests/gstreamer_photography/main.cpp b/config.tests/gstreamer_photography/main.cpp
deleted file mode 100644
index 1899222..0000000
--- a/config.tests/gstreamer_photography/main.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#define GST_USE_UNSTABLE_API
-
-#include <gst/interfaces/photography.h>
-#include <gst/interfaces/photography-enumtypes.h>
-#include <gst/pbutils/pbutils.h>
-#include <gst/pbutils/encoding-profile.h>
-
-int main(int argc, char** argv)
-{
- return 0;
-}
diff --git a/config.tests/pulseaudio/pulseaudio.cpp b/config.tests/pulseaudio/pulseaudio.cpp
deleted file mode 100644
index 53f237f..0000000
--- a/config.tests/pulseaudio/pulseaudio.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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 <pulse/pulseaudio.h>
-#include <pulse/glib-mainloop.h>
-
-#if !defined(PA_API_VERSION) || PA_API_VERSION-0 != 12
-# error "Incompatible PulseAudio API version"
-#endif
-
-int main(int, char **)
-{
- const char *headers = pa_get_headers_version();
- const char *library = pa_get_library_version();
- pa_glib_mainloop_new(0);
- return (headers - library) * 0;
-}
diff --git a/config.tests/pulseaudio/pulseaudio.pro b/config.tests/pulseaudio/pulseaudio.pro
deleted file mode 100644
index 3dd769f..0000000
--- a/config.tests/pulseaudio/pulseaudio.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG -= qt
-LIBS +=
-CONFIG += link_pkgconfig
-
-requires(unix)
-
-PKGCONFIG += \
- libpulse \
- libpulse-mainloop-glib
-
-SOURCES = pulseaudio.cpp
diff --git a/config.tests/resourcepolicy/main.cpp b/config.tests/resourcepolicy/main.cpp
deleted file mode 100644
index 693bb9c..0000000
--- a/config.tests/resourcepolicy/main.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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 <policy/resource.h>
-#include <policy/resources.h>
-#include <policy/resource-set.h>
-
-int main(int argc, char** argv)
-{
- ResourcePolicy::ResourceSet *set = new ResourcePolicy::ResourceSet("player", 0);
- return 0;
-}
diff --git a/config.tests/resourcepolicy/resourcepolicy.pro b/config.tests/resourcepolicy/resourcepolicy.pro
deleted file mode 100644
index 79fa6a1..0000000
--- a/config.tests/resourcepolicy/resourcepolicy.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
-
-requires(unix)
-
-# Input
-SOURCES += main.cpp
-
-CONFIG += link_pkgconfig
-
-PKGCONFIG += \
- libresourceqt1
-
diff --git a/config.tests/tools/which.test b/config.tests/tools/which.test
deleted file mode 100755
index 749a73b..0000000
--- a/config.tests/tools/which.test
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-#borrowed from Qt
-
-HOME=/dev/null
-export HOME
-
-unset which
-
-WHICH=`which which 2>/dev/null`
-if echo $WHICH | grep 'shell built-in command' >/dev/null 2>&1; then
- WHICH=which
-elif [ -z "$WHICH" ]; then
- if which which >/dev/null 2>&1; then
- WHICH=which
- else
- for a in /usr/ucb /usr/bin /bin /usr/local/bin; do
- if [ -x $a/which ]; then
- WHICH=$a/which
- break;
- fi
- done
- fi
-fi
-
-if [ -z "$WHICH" ]; then
- IFS=:
- for a in $PATH; do
- if [ -x $a/$1 ]; then
- echo "$a/$1"
- exit 0
- fi
- done
-else
- a=`"$WHICH" "$1" 2>/dev/null`
- if [ ! -z "$a" -a -x "$a" ]; then
- echo "$a"
- exit 0
- fi
-fi
-exit 1
diff --git a/config.tests/wmf/main.cpp b/config.tests/wmf/main.cpp
deleted file mode 100644
index 04bd97c..0000000
--- a/config.tests/wmf/main.cpp
+++ /dev/null
@@ -1,56 +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 <mfapi.h>
-#include <mfidl.h>
-#include <mferror.h>
-#include <d3d9.h>
-#include <evr9.h>
-#include <mmdeviceapi.h>
-
-int main(int, char**)
-{
- HRESULT hr = MENonFatalError;
- if (SUCCEEDED(hr)) {
- return 1;
- }
- return 0;
-}
diff --git a/config.tests/wmf/wmf.pro b/config.tests/wmf/wmf.pro
deleted file mode 100644
index 31b5328..0000000
--- a/config.tests/wmf/wmf.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-CONFIG -= qt
-CONFIG += console
-TEMPLATE = app
-
-# Input
-SOURCES += main.cpp
-
-LIBS += -lstrmiids -ldmoguids -luuid -lmsdmo -lole32 -loleaut32 -lMf -lMfuuid -lMfplat -lPropsys
-
-
diff --git a/config.tests/wmp/main.cpp b/config.tests/wmp/main.cpp
deleted file mode 100644
index 456e38b..0000000
--- a/config.tests/wmp/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 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 <wmp.h>
-
-int main(int, char**)
-{
- return 0;
-}
diff --git a/config.tests/wmp/wmp.pro b/config.tests/wmp/wmp.pro
deleted file mode 100644
index 4c2f157..0000000
--- a/config.tests/wmp/wmp.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG -= qt
-CONFIG += console
-TEMPLATE = app
-
-requires(win32*)
-
-# Input
-SOURCES += main.cpp
-
-LIBS += -lstrmiids -lole32 -lOleaut32 -luser32 -lgdi32
-
diff --git a/config.tests/wmsdk/main.cpp b/config.tests/wmsdk/main.cpp
deleted file mode 100644
index 96214f6..0000000
--- a/config.tests/wmsdk/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 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 <wmsdk.h>
-
-int main(int, char**)
-{
- return 0;
-}
diff --git a/config.tests/wmsdk/wmsdk.pro b/config.tests/wmsdk/wmsdk.pro
deleted file mode 100644
index c15b6c8..0000000
--- a/config.tests/wmsdk/wmsdk.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG -= qt
-CONFIG += console
-TEMPLATE = app
-
-requires(win32*)
-
-# Input
-SOURCES += main.cpp
diff --git a/doc/config/compat.qdocconf b/doc/config/compat.qdocconf
deleted file mode 100644
index d19072f..0000000
--- a/doc/config/compat.qdocconf
+++ /dev/null
@@ -1,31 +0,0 @@
-#alias.i = e
-alias.include = input
-
-macro.0 = "\\\\0"
-macro.b = "\\\\b"
-macro.n = "\\\\n"
-macro.r = "\\\\r"
-#macro.i = "\\o"
-macro.i11 = "\\o{1,1}"
-macro.i12 = "\\o{1,2}"
-macro.i13 = "\\o{1,3}"
-macro.i14 = "\\o{1,4}"
-macro.i15 = "\\o{1,5}"
-macro.i16 = "\\o{1,6}"
-macro.i17 = "\\o{1,7}"
-macro.i18 = "\\o{1,8}"
-macro.i19 = "\\o{1,9}"
-macro.i21 = "\\o{2,1}"
-macro.i31 = "\\o{3,1}"
-macro.i41 = "\\o{4,1}"
-macro.i51 = "\\o{5,1}"
-macro.i61 = "\\o{6,1}"
-macro.i71 = "\\o{7,1}"
-macro.i81 = "\\o{8,1}"
-macro.i91 = "\\o{9,1}"
-macro.img = "\\image"
-macro.endquote = "\\endquotation"
-macro.relatesto = "\\relates"
-
-spurious = "Missing comma in .*" \
- "Missing pattern .*"
diff --git a/doc/config/images/arrow_down.png b/doc/config/images/arrow_down.png
deleted file mode 100644
index 9d01e97..0000000
--- a/doc/config/images/arrow_down.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/bg_l.png b/doc/config/images/bg_l.png
deleted file mode 100755
index 90b1da1..0000000
--- a/doc/config/images/bg_l.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/bg_l_blank.png b/doc/config/images/bg_l_blank.png
deleted file mode 100755
index 5a9673d..0000000
--- a/doc/config/images/bg_l_blank.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/bg_ll_blank.png b/doc/config/images/bg_ll_blank.png
deleted file mode 100644
index 95a1c45..0000000
--- a/doc/config/images/bg_ll_blank.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/bg_r.png b/doc/config/images/bg_r.png
deleted file mode 100755
index f0fb121..0000000
--- a/doc/config/images/bg_r.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/bg_ul_blank.png b/doc/config/images/bg_ul_blank.png
deleted file mode 100644
index 7051261..0000000
--- a/doc/config/images/bg_ul_blank.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/box_bg.png b/doc/config/images/box_bg.png
deleted file mode 100755
index 3322f92..0000000
--- a/doc/config/images/box_bg.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/breadcrumb.png b/doc/config/images/breadcrumb.png
deleted file mode 100755
index 0ded551..0000000
--- a/doc/config/images/breadcrumb.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/bullet_dn.png b/doc/config/images/bullet_dn.png
deleted file mode 100644
index f776247..0000000
--- a/doc/config/images/bullet_dn.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/bullet_gt.png b/doc/config/images/bullet_gt.png
deleted file mode 100755
index 7561b4e..0000000
--- a/doc/config/images/bullet_gt.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/bullet_sq.png b/doc/config/images/bullet_sq.png
deleted file mode 100755
index a84845e..0000000
--- a/doc/config/images/bullet_sq.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/bullet_up.png b/doc/config/images/bullet_up.png
deleted file mode 100644
index 7de2f06..0000000
--- a/doc/config/images/bullet_up.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/feedbackground.png b/doc/config/images/feedbackground.png
deleted file mode 100755
index 3a38d99..0000000
--- a/doc/config/images/feedbackground.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/header_bg.png b/doc/config/images/header_bg.png
deleted file mode 100644
index a436aa6..0000000
--- a/doc/config/images/header_bg.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/horBar.png b/doc/config/images/horBar.png
deleted file mode 100755
index 100fe91..0000000
--- a/doc/config/images/horBar.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/page.png b/doc/config/images/page.png
deleted file mode 100644
index 1db151b..0000000
--- a/doc/config/images/page.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/page_bg.png b/doc/config/images/page_bg.png
deleted file mode 100755
index 9b3bd99..0000000
--- a/doc/config/images/page_bg.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/qt-logo.png b/doc/config/images/qt-logo.png
deleted file mode 100644
index 14ddf2a..0000000
--- a/doc/config/images/qt-logo.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/spinner.gif b/doc/config/images/spinner.gif
deleted file mode 100644
index 1ed786f..0000000
--- a/doc/config/images/spinner.gif
+++ /dev/null
Binary files differ
diff --git a/doc/config/images/sprites-combined.png b/doc/config/images/sprites-combined.png
deleted file mode 100755
index 7f96866..0000000
--- a/doc/config/images/sprites-combined.png
+++ /dev/null
Binary files differ
diff --git a/doc/config/macros.qdocconf b/doc/config/macros.qdocconf
deleted file mode 100644
index 2262daa..0000000
--- a/doc/config/macros.qdocconf
+++ /dev/null
@@ -1,37 +0,0 @@
-macro.aacute.HTML = "&aacute;"
-macro.Aring.HTML = "&Aring;"
-macro.aring.HTML = "&aring;"
-macro.Auml.HTML = "&Auml;"
-macro.author = "\\bold{Author:}"
-macro.br.HTML = "<br />"
-macro.BR.HTML = "<br />"
-macro.copyright.HTML = "&copy;"
-macro.eacute.HTML = "&eacute;"
-macro.gui = "\\bold"
-macro.hr.HTML = "<hr />"
-macro.iacute.HTML = "&iacute;"
-macro.key = "\\bold"
-macro.menu = "\\bold"
-macro.note = "\\bold{Note:}"
-macro.oslash.HTML = "&oslash;"
-macro.ouml.HTML = "&ouml;"
-macro.QA = "\\e{Qt Assistant}"
-macro.QD = "\\e{Qt Designer}"
-macro.QL = "\\e{Qt Linguist}"
-macro.QQV = "\\e{Qt QML Viewer}"
-macro.param = "\\e"
-macro.raisedaster.HTML = "<sup>*</sup>"
-macro.rarrow.HTML = "&rarr;"
-macro.reg.HTML = "<sup>&reg;</sup>"
-macro.return = "Returns"
-macro.starslash = "\\c{*/}"
-macro.begincomment = "\\c{/*}"
-macro.endcomment = "\\c{*/}"
-macro.uuml.HTML = "&uuml;"
-macro.mdash.HTML = "&mdash;"
-
-macro.beginfloatleft.HTML = "<div style=\"float: left; margin-right: 2em\">"
-macro.beginfloatright.HTML = "<div style=\"float: right; margin-left: 2em\">"
-macro.endfloat.HTML = "</div>"
-macro.clearfloat.HTML = "<br style=\"clear: both\" />"
-macro.emptyspan.HTML = "<span></span>"
diff --git a/doc/config/qt-cpp-ignore.qdocconf b/doc/config/qt-cpp-ignore.qdocconf
deleted file mode 100644
index 9b09a60..0000000
--- a/doc/config/qt-cpp-ignore.qdocconf
+++ /dev/null
@@ -1,99 +0,0 @@
-Cpp.ignoretokens = QAXFACTORY_EXPORT \
- QDESIGNER_COMPONENTS_LIBRARY \
- QDESIGNER_EXTENSION_LIBRARY \
- QDESIGNER_SDK_LIBRARY \
- QDESIGNER_SHARED_LIBRARY \
- QDESIGNER_UILIB_LIBRARY \
- QM_EXPORT_CANVAS \
- QM_EXPORT_DNS \
- QM_EXPORT_DOM \
- QM_EXPORT_FTP \
- QM_EXPORT_HTTP \
- QM_EXPORT_ICONVIEW \
- QM_EXPORT_NETWORK \
- QM_EXPORT_OPENGL \
- QM_EXPORT_OPENVG \
- QM_EXPORT_SQL \
- QM_EXPORT_TABLE \
- QM_EXPORT_WORKSPACE \
- QM_EXPORT_XML \
- QT_ASCII_CAST_WARN \
- QT_ASCII_CAST_WARN_CONSTRUCTOR \
- QT_BEGIN_HEADER \
- QT_DESIGNER_STATIC \
- QT_END_HEADER \
- QT_FASTCALL \
- QT_WIDGET_PLUGIN_EXPORT \
- Q_COMPAT_EXPORT \
- Q_CORE_EXPORT \
- Q_CORE_EXPORT_INLINE \
- Q_EXPLICIT \
- Q_EXPORT \
- Q_EXPORT_CODECS_CN \
- Q_EXPORT_CODECS_JP \
- Q_EXPORT_CODECS_KR \
- Q_EXPORT_PLUGIN \
- Q_GFX_INLINE \
- Q_AUTOTEST_EXPORT \
- QM_AUTOTEST_EXPORT \
- Q_GUI_EXPORT \
- Q_GUI_EXPORT_INLINE \
- Q_GUI_EXPORT_STYLE_CDE \
- Q_GUI_EXPORT_STYLE_COMPACT \
- Q_GUI_EXPORT_STYLE_MAC \
- Q_GUI_EXPORT_STYLE_MOTIF \
- Q_GUI_EXPORT_STYLE_MOTIFPLUS \
- Q_GUI_EXPORT_STYLE_PLATINUM \
- Q_GUI_EXPORT_STYLE_POCKETPC \
- Q_GUI_EXPORT_STYLE_SGI \
- Q_GUI_EXPORT_STYLE_WINDOWS \
- Q_GUI_EXPORT_STYLE_WINDOWSXP \
- QHELP_EXPORT \
- Q_INLINE_TEMPLATE \
- Q_INTERNAL_WIN_NO_THROW \
- Q_NETWORK_EXPORT \
- Q_OPENGL_EXPORT \
- Q_OPENVG_EXPORT \
- Q_OUTOFLINE_TEMPLATE \
- Q_SQL_EXPORT \
- Q_SVG_EXPORT \
- Q_SCRIPT_EXPORT \
- Q_SCRIPTTOOLS_EXPORT \
- Q_TESTLIB_EXPORT \
- Q_TYPENAME \
- Q_XML_EXPORT \
- Q_XMLSTREAM_EXPORT \
- Q_XMLPATTERNS_EXPORT \
- QDBUS_EXPORT \
- Q_DBUS_EXPORT \
- QT_BEGIN_NAMESPACE \
- QT_BEGIN_INCLUDE_NAMESPACE \
- QT_END_NAMESPACE \
- QT_END_INCLUDE_NAMESPACE \
- PHONON_EXPORT \
- Q_DECLARATIVE_EXPORT \
- Q_GADGET \
- QWEBKIT_EXPORT \
- Q_INVOKABLE
-Cpp.ignoredirectives = Q_DECLARE_HANDLE \
- Q_DECLARE_INTERFACE \
- Q_DECLARE_METATYPE \
- Q_DECLARE_OPERATORS_FOR_FLAGS \
- Q_DECLARE_PRIVATE \
- Q_DECLARE_PUBLIC \
- Q_DECLARE_SHARED \
- Q_DECLARE_TR_FUNCTIONS \
- Q_DECLARE_TYPEINFO \
- Q_DISABLE_COPY \
- QT_FORWARD_DECLARE_CLASS \
- Q_DUMMY_COMPARISON_OPERATOR \
- Q_ENUMS \
- Q_FLAGS \
- Q_INTERFACES \
- __attribute__ \
- K_DECLARE_PRIVATE \
- PHONON_OBJECT \
- PHONON_HEIR \
- Q_PRIVATE_PROPERTY \
- Q_DECLARE_PRIVATE_D \
- Q_CLASSINFO
diff --git a/doc/config/qt-defines.qdocconf b/doc/config/qt-defines.qdocconf
deleted file mode 100644
index 50a355f..0000000
--- a/doc/config/qt-defines.qdocconf
+++ /dev/null
@@ -1,17 +0,0 @@
-defines = Q_QDOC \
- QT_.*_SUPPORT \
- QT_.*_LIB \
- QT_COMPAT \
- QT_KEYPAD_NAVIGATION \
- QT_NO_EGL \
- QT3_SUPPORT \
- Q_WS_.* \
- Q_OS_.* \
- Q_BYTE_ORDER \
- QT_DEPRECATED \
- Q_NO_USING_KEYWORD \
- __cplusplus
-
-versionsym = QT_VERSION_STR
-
-codeindent = 1
diff --git a/doc/config/qt-html-default-styles.qdocconf b/doc/config/qt-html-default-styles.qdocconf
deleted file mode 100644
index 47e550b..0000000
--- a/doc/config/qt-html-default-styles.qdocconf
+++ /dev/null
@@ -1,32 +0,0 @@
-# Define the location of the templates to use. Style sheets and scripts are
-# specified relative to the template directory and will be copied into
-# subdirectories of the output directory.
-
-HTML.templatedir = .
-
-HTML.stylesheets = style/offline.css
-
-HTML.scripts =
-
-# Files not referenced in any qdoc file (last four needed by qtdemo)
-# See also qhp.Qt.extraFiles
-extraimages.HTML = qt-logo.png \
- arrow_down.png \
- breadcrumb.png \
- bullet_gt.png \
- bullet_dn.png \
- bullet_sq.png \
- bullet_up.png \
- horBar.png \
- sprites-combined.png
-
-# Include the style sheets and scripts used.
-
-HTML.headerstyles = \
- " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n"
-
-HTML.headerscripts =
-
-HTML.endheader = \
- "</head>\n" \
- "<body>\n"
diff --git a/doc/config/qt-html-online-styles.qdocconf b/doc/config/qt-html-online-styles.qdocconf
deleted file mode 100644
index f915cb4..0000000
--- a/doc/config/qt-html-online-styles.qdocconf
+++ /dev/null
@@ -1,72 +0,0 @@
-# Define the location of the templates to use. Style sheets and scripts are
-# specified relative to the template directory and will be copied into
-# subdirectories of the output directory.
-
-HTML.templatedir = .
-
-HTML.stylesheets = style/narrow.css \
- style/style.css \
- style/style_ie6.css \
- style/style_ie7.css \
- style/style_ie8.css \
- style/superfish.css
-
-# Adding jquery and functions - providing online tools and search features
-HTML.scripts = scripts/functions.js \
- scripts/narrow.js \
- scripts/superfish.js \
- scripts/jquery.js
-
-
-# Files not referenced in any qdoc file.
-# See also qhp.Qt.extraFiles
-extraimages.HTML = qt-logo.png \
- bg_l.png \
- bg_l_blank.png \
- bg_ll_blank.png \
- bg_ul_blank.png \
- header_bg.png \
- bg_r.png \
- box_bg.png \
- breadcrumb.png \
- bullet_gt.png \
- bullet_dn.png \
- bullet_sq.png \
- bullet_up.png \
- arrow_down.png \
- feedbackground.png \
- horBar.png \
- page.png \
- page_bg.png \
- sprites-combined.png \
- spinner.gif
-
-# Include the style sheets and scripts used.
-
-HTML.headerstyles = \
- " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />\n" \
- " <script src=\"scripts/jquery.js\" type=\"text/javascript\"></script>\n" \
- " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n" \
- " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/superfish.css\" />\n" \
- " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/narrow.css\" />\n" \
- " <!--[if IE]>\n" \
- "<meta name=\"MSSmartTagsPreventParsing\" content=\"true\">\n" \
- "<meta http-equiv=\"imagetoolbar\" content=\"no\">\n" \
- "<![endif]-->\n" \
- "<!--[if lt IE 7]>\n" \
- "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie6.css\">\n" \
- "<![endif]-->\n" \
- "<!--[if IE 7]>\n" \
- "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie7.css\">\n" \
- "<![endif]-->\n" \
- "<!--[if IE 8]>\n" \
- "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie8.css\">\n" \
- "<![endif]-->\n\n"
-
-HTML.headerscripts = \
- "<script src=\"scripts/superfish.js\" type=\"text/javascript\"></script>\n" \
- "<script src=\"scripts/narrow.js\" type=\"text/javascript\"></script>\n\n"
-
-HTML.endheader = \
- "</head>\n" \
- "<body class=\"\" onload=\"CheckEmptyAndLoadList();\">\n"
diff --git a/doc/config/qt-html-templates-online.qdocconf b/doc/config/qt-html-templates-online.qdocconf
deleted file mode 100644
index bbcce44..0000000
--- a/doc/config/qt-html-templates-online.qdocconf
+++ /dev/null
@@ -1,142 +0,0 @@
-include(qt-html-online-styles.qdocconf)
-
-HTML.postheader = \
- " <div class=\"header\" id=\"qtdocheader\">\n" \
- " <div class=\"content\"> \n" \
- " <div id=\"nav-logo\">\n" \
- " <a href=\"index.html\">Home</a></div>\n" \
- " <a href=\"index.html\" class=\"qtref\"><span>QtMobility Reference Documentation</span></a>\n" \
- " <div id=\"narrowsearch\"></div>\n" \
- " <div id=\"nav-topright\">\n" \
- " <ul>\n" \
- " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \
- " <li class=\"nav-topright-dev\"><a href=\"http://developer.qt.nokia.com/\">DEV</a></li>\n" \
- " <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \
- " <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \
- " DOC</a></li>\n" \
- " <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \
- " </ul>\n" \
- " </div>\n" \
- " <div id=\"shortCut\">\n" \
- " <ul>\n" \
- " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">QtMobility 1.2</a></span></li>\n" \
- " <li class=\"shortCut-topleft-active\"><a href=\"http://doc.qt.nokia.com\">ALL VERSIONS" \
- " </a></li>\n" \
- " </ul>\n" \
- " </div>\n" \
- " </div>\n" \
- " </div>\n" \
- " <div class=\"wrapper\">\n" \
- " <div class=\"hd\">\n" \
- " <span></span>\n" \
- " </div>\n" \
- " <div class=\"bd group\">\n" \
- " <div class=\"sidebar\">\n" \
- " <div class=\"box first bottombar\" id=\"lookup\">\n" \
- " <h2 title=\"API Lookup\">\n" \
- " API Lookup</h2>\n" \
- " <div id=\"list001\" class=\"list\">\n" \
- " <ul id=\"ul001\" >\n" \
- " <li class=\"defaultLink\"><a href=\"classes.html\">Class index</a></li>\n" \
- " <li class=\"defaultLink\"><a href=\"functions.html\">Function index</a></li>\n" \
- " <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \
- " <li class=\"defaultLink\"><a href=\"qml-plugins.html\">QML Plugins</a></li>\n" \
- " </ul> \n" \
- " </div>\n" \
- " </div>\n" \
- " <div class=\"box bottombar\" id=\"topics\">\n" \
- " <h2 title=\"QtMobility Topics\"><span></span>\n" \
- " Qt Topics</h2>\n" \
- " <div id=\"list002\" class=\"list\">\n" \
- " <ul id=\"ul002\" >\n" \
- " <li class=\"defaultLink\"><a href=\"quickstart.html\">Quickstart Guide</a></li> \n" \
- " <li class=\"defaultLink\"><a href=\"index.html#platform-compatibility\">Platform-specific info</a></li> \n" \
- " </ul> \n" \
- " </div>\n" \
- " </div>\n" \
- " <div class=\"box\" id=\"examples\">\n" \
- " <h2 title=\"Examples\"><span></span>\n" \
- " Examples</h2>\n" \
- " <div id=\"list003\" class=\"list\">\n" \
- " <ul id=\"ul003\">\n" \
- " <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \
- " <li class=\"defaultLink\"><a href=\"tutorials.html\">Tutorials</a></li>\n" \
- " </ul> \n" \
- " </div>\n" \
- " </div>\n" \
- " </div>\n" \
- " <div class=\"wrap\">\n" \
- " <div class=\"toolbar\">\n" \
- " <div class=\"breadcrumb toolblock\">\n" \
- " <ul>\n" \
- " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \
- " <!-- Breadcrumbs go here -->\n"
-
-HTML.postpostheader = \
- " </ul>\n" \
- " </div>\n" \
- " <div class=\"toolbuttons toolblock\">\n" \
- " <ul>\n" \
- " <li id=\"smallA\" class=\"t_button\">A</li>\n" \
- " <li id=\"medA\" class=\"t_button active\">A</li>\n" \
- " <li id=\"bigA\" class=\"t_button\">A</li>\n" \
- " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \
- " <span>Print</span></a></li>\n" \
- " </ul>\n" \
- " </div>\n" \
- " </div>\n" \
- " <div class=\"content mainContent\">\n"
-
-HTML.footer = \
- " <div class=\"feedback t_button\">\n" \
- " [+] Documentation Feedback</div>\n" \
- " </div>\n" \
- " </div>\n" \
- " </div> \n" \
- " <div class=\"ft\">\n" \
- " <span></span>\n" \
- " </div>\n" \
- " </div> \n" \
- " <div class=\"footer\">\n" \
- " <p>\n" \
- " <acronym title=\"Copyright\">&copy;</acronym> 2008-2011 Nokia Corporation and/or its\n" \
- " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \
- " in Finland and/or other countries worldwide.</p>\n" \
- " <p>\n" \
- " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \
- " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \
- " <br />\n" \
- " <p>\n" \
- " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \
- " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \
- " with the terms contained in a written agreement between you and Nokia.</p>\n" \
- " <p>\n" \
- " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \
- " Free Documentation License version 1.3</a>\n" \
- " as published by the Free Software Foundation.</p>\n" \
- " </div>\n" \
- " <div id=\"feedbackBox\">\n" \
- " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \
- " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \
- " <p id=\"noteHead\">Thank you for giving your feedback.</p> <p class=\"note\">Make sure it is related to this specific page. For more general bugs and \n" \
- " requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a>.</p>\n" \
- " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\"></textarea></p>\n" \
- " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \
- " </form>\n" \
- " </div>\n" \
- " <div id=\"blurpage\">\n" \
- " </div>\n" \
- "\n" \
- " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n" \
- " <script type=\"text/javascript\">\n" \
- " var _gaq = _gaq || [];\n" \
- " _gaq.push(['_setAccount', 'UA-4457116-5']);\n" \
- " _gaq.push(['_trackPageview']);\n" \
- " (function() {\n" \
- " var ga = document.createElement('script'); " \
- "ga.type = 'text/javascript'; ga.async = true;\n" \
- " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + " \
- "'.google-analytics.com/ga.js';\n" \
- " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n" \
- " })();\n" \
- " </script>\n"
diff --git a/doc/config/qt-html-templates.qdocconf b/doc/config/qt-html-templates.qdocconf
deleted file mode 100644
index c1a6569..0000000
--- a/doc/config/qt-html-templates.qdocconf
+++ /dev/null
@@ -1,54 +0,0 @@
-include(qt-html-default-styles.qdocconf)
-
-HTML.postheader = \
- "<div class=\"header\" id=\"qtdocheader\">\n" \
- " <div class=\"content\"> \n" \
- " <a href=\"index.html\" class=\"qtref\"><span>QtMobility Reference Documentation</span></a>\n" \
- " </div>\n" \
- " <div class=\"breadcrumb toolblock\">\n" \
- " <ul>\n" \
- " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \
- " <!-- Breadcrumbs go here -->\n"
-
-HTML.postpostheader = \
- " </ul>\n" \
- " </div>\n" \
- "</div>\n" \
- "<div class=\"content mainContent\">\n"
-
-HTML.footer = \
- " <div class=\"ft\">\n" \
- " <span></span>\n" \
- " </div>\n" \
- "</div> \n" \
- "<div class=\"footer\">\n" \
- " <p>\n" \
- " <acronym title=\"Copyright\">&copy;</acronym> 2008-2011 Nokia Corporation and/or its\n" \
- " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \
- " in Finland and/or other countries worldwide.</p>\n" \
- " <p>\n" \
- " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \
- " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \
- " <br />\n" \
- " <p>\n" \
- " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \
- " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \
- " with the terms contained in a written agreement between you and Nokia.</p>\n" \
- " <p>\n" \
- " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \
- " Free Documentation License version 1.3</a>\n" \
- " as published by the Free Software Foundation.</p>\n" \
- "</div>\n" \
-
-# Files not referenced in any qdoc file.
-# See also extraimages.HTML
-qhp.QtMobility.extraFiles = index.html \
- images/arrow_down.png \
- images/breadcrumb.png \
- images/bullet_gt.png \
- images/bullet_dn.png \
- images/bullet_sq.png \
- images/bullet_up.png \
- images/horBar.png \
- images/sprites-combined.png \
- style/offline.css
diff --git a/doc/config/qtmobility-cpp-ignore.qdocconf b/doc/config/qtmobility-cpp-ignore.qdocconf
deleted file mode 100644
index faa9fe1..0000000
--- a/doc/config/qtmobility-cpp-ignore.qdocconf
+++ /dev/null
@@ -1,18 +0,0 @@
-Cpp.ignoretokens += \
- QTM_BEGIN_NAMESPACE \
- QTM_END_NAMESPACE \
- Q_BEARER_EXPORT \
- Q_PUBLISHSUBSCRIBE_EXPORT \
- Q_CONTACTS_EXPORT \
- Q_VERSIT_EXPORT \
- Q_LOCATION_EXPORT \
- Q_MULTIMEDIA_EXPORT \
- Q_MESSAGING_EXPORT \
- Q_SERVICEFW_EXPORT \
- Q_SYSINFO_EXPORT \
- Q_SENSORS_EXPORT \
- Q_FEEDBACK_EXPORT \
- Q_GALLERY_EXPORT \
- Q_ORGANIZER_EXPORT
-Cpp.ignoredirectives += \
- Q_DECLARE_NDEF_RECORD
diff --git a/doc/config/qtmobility-ditaxml.qdocconf b/doc/config/qtmobility-ditaxml.qdocconf
deleted file mode 100644
index 338e408..0000000
--- a/doc/config/qtmobility-ditaxml.qdocconf
+++ /dev/null
@@ -1,13 +0,0 @@
-include(qtmobility-project.qdocconf)
-
-outputdir = ../ditaxml
-outputformats = DITAXML
-
-generateindex = true
-url = .
-
-macro.beginfloatleft.HTML = " "
-macro.beginfloatright.HTML = " "
-macro.endfloat.HTML = " "
-macro.clearfloat.HTML = " "
-macro.emptyspan.DITAXML = " "
diff --git a/doc/config/qtmobility-online.qdocconf b/doc/config/qtmobility-online.qdocconf
deleted file mode 100644
index 515003a..0000000
--- a/doc/config/qtmobility-online.qdocconf
+++ /dev/null
@@ -1,2 +0,0 @@
-include(qtmobility-project.qdocconf)
-include(qt-html-templates-online.qdocconf)
diff --git a/doc/config/qtmobility-project.qdocconf b/doc/config/qtmobility-project.qdocconf
deleted file mode 100644
index 8a29b0a..0000000
--- a/doc/config/qtmobility-project.qdocconf
+++ /dev/null
@@ -1,142 +0,0 @@
-include(compat.qdocconf)
-include(macros.qdocconf)
-include(qt-cpp-ignore.qdocconf)
-include(qt-defines.qdocconf)
-include(qtmobility-cpp-ignore.qdocconf)
-
-indexes = ../src/qt.index
-
-language = Cpp
-
-sourceencoding = UTF-8
-outputencoding = UTF-8
-naturallanguage = en_US
-
-project = Qt Mobility
-description = Qt Mobility Project Library Reference Documentation
-versionsym =
-version = 1.2
-url = http://qt.nokia.com/doc/qtmobility-1.2
-
-sources.fileextensions = "*.cpp *.qdoc *.mm *.qml"
-headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx"
-examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml"
-examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng"
-
-headerdirs = ../../src/global \
- ../../src/bearer \
- ../../src/feedback \
- ../../src/serviceframework \
- ../../src/location \
- ../../src/publishsubscribe \
- ../../src/systeminfo \
- ../../src/contacts \
- ../../src/contacts/details \
- ../../src/multimedia \
- ../../plugins/declarative/multimedia \
- ../../plugins/declarative/location \
- ../../plugins/declarative/organizer \
- ../../plugins/declarative/connectivity \
- ../../plugins/declarative/contacts \
- ../../plugins/declarative/contacts/details \
- ../../plugins/declarative/contacts/filters \
- ../../plugins/declarative/gallery \
- ../../plugins/declarative/serviceframework \
- ../../plugins/declarative/organizer \
- ../../plugins/declarative/contacts \
- ../../plugins/declarative/feedback \
- ../../plugins/declarative/messaging \
- ../../plugins/declarative/sensors \
- ../../plugins/declarative/publishsubscribe \
- ../../plugins/declarative/systeminfo \
- ../../src/messaging \
- ../../src/versit \
- ../../src/sensors \
- ../../src/gallery \
- ../../src/camera \
- ../../src/organizer \
- ../../src/versitorganizer \
- ../../src/connectivity \
- ../src
-
-sourcedirs = ../../src/global \
- ../../src/bearer \
- ../../src/feedback \
- ../../src/serviceframework \
- ../../src/location \
- ../../src/publishsubscribe \
- ../../src/systeminfo \
- ../../src/contacts \
- ../../src/contacts/details \
- ../../src/multimedia \
- ../../plugins/declarative/multimedia \
- ../../plugins/declarative/location \
- ../../plugins/declarative/organizer \
- ../../plugins/declarative/connectivity \
- ../../plugins/declarative/contacts \
- ../../plugins/declarative/contacts/details \
- ../../plugins/declarative/contacts/filters \
- ../../plugins/declarative/messaging \
- ../../plugins/declarative/serviceframework \
- ../../plugins/declarative/organizer \
- ../../plugins/declarative/contacts \
- ../../plugins/declarative/feedback \
- ../../plugins/declarative/gallery \
- ../../plugins/declarative/sensors \
- ../../plugins/declarative/publishsubscribe \
- ../../plugins/declarative/systeminfo \
- ../../plugins/declarative/sensors \
- ../../src/messaging \
- ../../src/versit \
- ../../src/sensors \
- ../../src/gallery \
- ../../src/camera \
- ../../src/organizer \
- ../../src/connectivity \
- ../../src/versitorganizer \
- ../src
-
-excludedirs = ../../src/messaging/win32wce \
- ../../src/publishsubscribe/symbian \
- ../../src/serviceframework/ipc/metaobjectbuilder47
-
-exampledirs = ../../examples \
- ../../demos \
- ../.. \
- ../src
-
-imagedirs = images \
- ../src/images
-
-outputdir = ../html
-tagfile = ../html/qtmobility.tags
-base = file:../html
-
-qhp.projects = QtMobility
-
-qhp.QtMobility.file = qtmobility.qhp
-qhp.QtMobility.namespace = com.nokia.qtmobility.114
-qhp.QtMobility.virtualFolder = mobility
-qhp.QtMobility.indexTitle = Qt Mobility Project Reference Documentation
-qhp.QtMobility.indexRoot =
-
-qhp.QtMobility.filterAttributes = qtmobility 1.2.0
-qhp.QtMobility.customFilters.QtMobility.name = Qt Mobility 1.2.0
-qhp.QtMobility.customFilters.QtMobility.filterAttributes = qtmobility 1.2.0
-qhp.QtMobility.subprojects = classes overviews examples
-qhp.QtMobility.subprojects.classes.title = Classes
-qhp.QtMobility.subprojects.classes.indexTitle = All Qt Mobility Project Classes
-qhp.QtMobility.subprojects.classes.selectors = class
-qhp.QtMobility.subprojects.classes.sortPages = true
-qhp.QtMobility.subprojects.overviews.title = Overviews
-qhp.QtMobility.subprojects.overviews.indexTitle = Qt Mobility Project Overview
-qhp.QtMobility.subprojects.overviews.selectors = fake:page,group
-qhp.QtMobility.subprojects.overviews.sortPages = true
-qhp.QtMobility.subprojects.examples.title = Examples
-qhp.QtMobility.subprojects.examples.indexTitle = Qt Mobility Project Examples
-qhp.QtMobility.subprojects.examples.selectors = fake:example
-qhp.QtMobility.subprojects.examples.sortPages = true
-qhp.QtMobility.subprojects.tutorials.title = Tutorials
-qhp.QtMobility.subprojects.tutorials.indexTitle = Qt Mobility Project Tutorials
-qhp.QtMobility.subprojects.tutorials.selectors = fake:tutorial
-qhp.QtMobility.subprojects.tutorials.sortPages = true
diff --git a/doc/config/qtmobility.qdocconf b/doc/config/qtmobility.qdocconf
deleted file mode 100644
index 75fba31..0000000
--- a/doc/config/qtmobility.qdocconf
+++ /dev/null
@@ -1,2 +0,0 @@
-include(qtmobility-project.qdocconf)
-include(qt-html-templates.qdocconf)
diff --git a/doc/config/qtmultimedia-dita.qdocconf b/doc/config/qtmultimedia-dita.qdocconf
deleted file mode 100644
index cb8a73c..0000000
--- a/doc/config/qtmultimedia-dita.qdocconf
+++ /dev/null
@@ -1,32 +0,0 @@
-# Name of the project.
-project = Qt Multimedia
-
-# Directories in which to search for files to document and images.
-# By default set to the root directory of the project for sources
-# and headers and qdoc will therefore generate output for each file.
-# Images should be placed in <rootdir>/dic/images and examples in
-# <rootdir>/examples.
-# Paths are relative to the location of this file.
-exampledirs += ../src/examples \
- ../.. \
- ../../examples
-
-headerdirs += ../src \
- ../../src
-
-imagedirs += ../src/images \
-
-sourcedirs += ../src \
- ../../src
-
-excludedirs +=
-
-#Do not change the variables after this line unless you know what you are doing.
-
-outputdir = ../ditaxml
-outputformats = DITAXML
-
-examples.fileextensions = "*.cpp *.h *.js *.svg *.xml *.ui *.qml"
-examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng"
-headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx"
-sources.fileextensions = "*.cpp *.qdoc *.mm *.qml"
diff --git a/doc/config/qtmultimedia.qdocconf b/doc/config/qtmultimedia.qdocconf
deleted file mode 100644
index b232e8c..0000000
--- a/doc/config/qtmultimedia.qdocconf
+++ /dev/null
@@ -1,81 +0,0 @@
-# Name of the project.
-project = Qt Multimedia
-description = Qt Multimedia Documentation
-
-# Directories in which to search for files to document and images.
-# By default set to the root directory of the project for sources
-# and headers and qdoc will therefore generate output for each file.
-# Images should be placed in <rootdir>/dic/images and examples in
-# <rootdir>/examples.
-# Paths are relative to the location of this file.
-
-exampledirs += ../src/examples \
- ../.. \
- ../../examples
-
-headerdirs += ../src \
- ../../src
-
-imagedirs += ../src/images \
-
-sourcedirs += ../src \
- ../../src
-
-excludedirs +=
-
-# The index file contains links to the Qt 5 documentation.
-# Point to the any .index file to cross link to other projects
-#indexes = $QT5DOC/doc/html/qt.index
-
-# The following parameters are for creating a qhp file, the qhelpgenerator
-# program can convert the qhp file into a qch file which can be opened in
-# Qt Assistant and/or Qt Creator.
-
-# Defines the name of the project. You cannot use operators (+, =, -) in
-# the name. Properties for this project are set using a qhp.<projectname>.property
-# format.
-qhp.projects = qtmultimedia
-
-# Sets the name of the output qhp file.
-qhp.qtmultimedia.file = qtmultimedia.qhp
-
-# Namespace for the output file. This namespace is used to distinguish between
-# different documentation files in Creator/Assistant.
-qhp.qtmultimedia.namespace = qtmultimedia.500
-
-# Title for the package, will be the main title for the package in
-# Assistant/Creator.
-qhp.qtmultimedia.indexTitle = Qt Multimedia Documentation
-
-# Extra files to add to the output which are not linked to from anywhere
-# using a qdoc \l command.
-qhp.qtmultimedia.extraFiles = style/qtmultimedia.css
-
-# Only update the name of the project for the next variables.
-qhp.qtmultimedia.virtualFolder = qdoc
-qhp.qtmultimedia.subprojects = classes
-qhp.qtmultimedia.subprojects.classes.title = Classes
-qhp.qtmultimedia.subprojects.classes.selectors = class fake:headerfile
-qhp.qtmultimedia.subprojects.classes.sortPages = true
-
-
-
-# Do NOT change the variables after this line unless you know what you are doing.
-
-outputdir = ../html
-outputformats = HTML
-
-examples.fileextensions = "*.cpp *.h *.js *.svg *.xml *.ui *.qml"
-examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng"
-headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx"
-sources.fileextensions = "*.cpp *.qdoc *.mm *.qml"
-
-HTML.nobreadcrumbs = "true"
-
-HTML.templatedir = .
-HTML.stylesheets = style/qtmultimedia.css
-
-HTML.headerstyles = " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/qtmultimedia.css\" />\n"
-HTML.endheader = "</head>\n<body>\n"
-
-HTML.footer = "<div class=\"footer\">Copyright (c) 2011 Nokia Corporation and/or its subsidiaries. All rights reserved.</div>\n"
diff --git a/doc/config/qtmultimedia_doc.pri b/doc/config/qtmultimedia_doc.pri
deleted file mode 100644
index 6229241..0000000
--- a/doc/config/qtmultimedia_doc.pri
+++ /dev/null
@@ -1,35 +0,0 @@
-
-win32:!win32-g++ {
- unixstyle = false
-} else:win32-g++:isEmpty(QMAKE_SH) {
- unixstyle = false
-} else {
- unixstyle = true
-}
-
-QDOC = $$QT.core.bins/qdoc3
-
-ONLINE_CONF = $$PWD/qtmultimedia.qdocconf
-DITA_CONF = $$PWD/qtmultimedia-dita.qdocconf
-QCH_CONF = #nothing yet
-
-$$unixstyle {
-} else {
- QDOC = $$replace(QDOC, "qdoc", "qdoc3.exe")
- ONLINE_CONF = $$replace(ONLINE_CONF, "/", "\\")
- DITA_DOCS = $$replace(ONLINE_CONF, "/", "\\")
-}
-
-# Build rules
-docs.depends = dita_docs online_docs qch_docs
-
-online_docs.commands = $$QDOC $$ONLINE_CONF
-
-dita_docs.commands = $$QDOC $$DITA_CONF
-
-qch_docs.commands = #no commands yet
-
-QMAKE_EXTRA_TARGETS += docs dita_docs online_docs qch_docs
-QMAKE_CLEAN += \
- "-r $$PWD/../html" \
- "-r $$PWD/../ditaxml"
diff --git a/doc/config/scripts/functions.js b/doc/config/scripts/functions.js
deleted file mode 100644
index 62bc535..0000000
--- a/doc/config/scripts/functions.js
+++ /dev/null
@@ -1,258 +0,0 @@
-// Removing search results
-function hideSearchResults() {
-/* hiding search results as the user clicks on the different categories */
- $('#resultdialog').removeClass('active');
- $("#resultlist").removeClass().addClass('all');
- $("#resultlinks").removeClass().addClass('all');
- $("#searchcount").removeClass().addClass('all');
-}
-/* closing the searhc result dialog */
-$('#resultclose').click(function(e) {
- e.preventDefault();
- hideSearchResults();
-});
-
-$(document.body).click(function() {
-});
-
-/* START non link areas where cursor should change to pointing hand */
-$('.t_button').mouseover(function() {
- $('.t_button').css('cursor','pointer');
-});
-/* END non link areas */
-/* Changing font size to smaller */
-$('#smallA').click(function() {
- $('.mainContent .heading,.mainContent h1, .mainContent h2, .mainContent h3, .mainContent p, .mainContent li, .mainContent table').css('font-size','smaller');
- $('.t_button').removeClass('active')
- $(this).addClass('active')
-});
-
-/* Reset font size */
-$('#medA').click(function() {
- $('.mainContent .heading').css('font','600 16px/1 Arial');
- $('.mainContent h1').css('font','600 18px/1.2 Arial');
- $('.mainContent h2').css('font','600 16px/1.2 Arial');
- $('.mainContent h3').css('font','600 14px/1.2 Arial');
- $('.mainContent p').css('font','13px/20px Verdana');
- $('.mainContent li').css('font','400 13px/1 Verdana');
- $('.mainContent li').css('line-height','14px');
- $('.mainContent .toc li').css('font', 'normal 10px/1.2 Verdana');
- $('.mainContent table').css('font','13px/1.2 Verdana');
- $('.mainContent .heading').css('font','600 16px/1 Arial');
- $('.mainContent .indexboxcont li').css('font','600 13px/1 Verdana');
- $('.t_button').removeClass('active')
- $(this).addClass('active')
-});
-/* Changing font size to bigger */
-$('#bigA').click(function() {
- $('.mainContent .heading,.mainContent h1, .mainContent h2, .mainContent h3, .mainContent p, .mainContent li, .mainContent table').css('font-size','large');
- $('.mainContent .heading,.mainContent h1, .mainContent h2, .mainContent h3, .mainContent p, .mainContent li, .mainContent table').css('line-height','25px');
- $('.t_button').removeClass('active')
- $(this).addClass('active')
-});
-
-/* Show page content after closing feedback box */
-$('.feedclose').click(function() {
- $('.bd').show();
- $('.hd').show();
- $('.footer').show();
- $('#feedbackBox').hide();
- $('#blurpage').hide();
-});
-
-/* Hide page content and show feedback box */
-$('.feedback').click(function() {
- $('.bd').hide();
- $('.hd').hide();
- $('.footer').hide();
- $('#feedbackBox').show();
- $('#blurpage').show();
-});
-/* Default search URL */
-var qturl = "";
-
-/* The next function handles the response data (in xml) returned by the search engine */
-
-// Process data sent back from the server. The data is structured as a XML.
-/*
-XML structure handled by function processNokiaData()
-<page> - container for each page returned
-<pageWords/> - contains keywords
-<pageTitle/> - contains page title/header content
-<pageUrl/> - contains page URL - URL relative to root
-<pageType> - contains page type - APIPage/Article/Example
-</page>
-*/
-
-
-function processNokiaData(response){
-/* fetch the responce from the server using page as the root element */
- var propertyTags = response.getElementsByTagName('page');
- /* reset counters */
- var apiCount = 0;
- var articleCount = 0;
- var exampleCount = 0;
- var full_li_element;
-
-/* remove any old results */
- $('#resultlist li').remove();
-
-
- /* running through the elements in the xml structure */
- for (var i=0; i<propertyTags.length; i++) {
- /* for every element named pageWords*/
- for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++) {
- /* start a new list element */
- full_li_element = '<li';
- /* if the pageType element reads APIPage, add class name api */
- if (propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'APIPage') {
- full_li_element += ' class="api"';
- apiCount++;
- }
- /* if the pageType element reads Article, add class name article */
- else if (propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'Article') {
- full_li_element += ' class="article"';
- articleCount++;
- }
- /* if the pageType element reads Example, add class name example */
- else if (propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'Example') {
- full_li_element += ' class="example"';
- exampleCount++;
- }
- /* adding the link element*/
- full_li_element += '><a href="'+qturl;
- /* adding the URL attribute*/
- full_li_element += propertyTags[i].getElementsByTagName('pageUrl')[j].firstChild.nodeValue;
- /* adding the link title and closing the link and list elements */
- full_li_element += '">' + propertyTags[i].getElementsByTagName('pageWords')[0].firstChild.nodeValue + '</a></li>';
- /* appending the list element to the #resultlist div*/
- $('#resultlist').append(full_li_element);
- }
- }
-
- /* if the result is not empty */
- if (propertyTags.length > 0) {
- /* add class name active to show the dialog */
- $('#resultdialog').addClass('active');
- /* setting number of hits*/
- $('#resultcount').html(propertyTags.length);
- $('#apicount').html(apiCount);
- $('#articlecount').html(articleCount);
- $('#examplecount').html(exampleCount);
-
- }
- else {
- $('#pageType').addClass('red');
- }
-
-
-
- // Filtering results in display
- $('p#resultlinks a').click(function(e) {
- e.preventDefault();
- // Displays API ref pages
- if (this.id == "showapiresults") {
- $("#resultlist").removeClass().addClass('api');
- $("#resultlinks").removeClass().addClass('api');
- $("#searchcount").removeClass().addClass('api');
- }
- // Displays Articles
- else if (this.id == "showarticleresults") {
- $("#resultlist").removeClass().addClass('article');
- $("#resultlinks").removeClass().addClass('article');
- $("#searchcount").removeClass().addClass('article');
- }
- // Displays Examples
- if (this.id == "showexampleresults") {
- $("#resultlist").removeClass().addClass('example');
- $("#resultlinks").removeClass().addClass('example');
- $("#searchcount").removeClass().addClass('example');
- }
- // Displays All
- if (this.id == "showallresults") {
- $("#resultlist").removeClass().addClass('all');
- $("#resultlinks").removeClass().addClass('all');
- $("#searchcount").removeClass().addClass('all');
- }
- });
-}
-
-//build regular expression object to find empty string or any number of blank
-var blankRE=/^\s*$/;
-
-
-function CheckEmptyAndLoadList()
-{
- /* Start Extracting information for feedback and adding this to the feedback form */
- var pageUrl = window.location.href;
- var pageVal = $('title').html();
- $('#pageType').removeClass('red');
- $('#feedUrl').remove();
- $('#pageVal').remove();
- $('.menuAlert').remove();
- $('#feedform').append('<input id="feedUrl" name="feedUrl" value="'+pageUrl+'" style="display:none;">');
- $('#feedform').append('<input id="pageVal" name="pageVal" value="'+pageVal+'" style="display:none;">');
- /* End Extracting information for feedback and adding this to the feedback form */
-
- /* extracts search query */
- var value = document.getElementById('pageType').value;
- /* if the search is less than three chars long remove class names and remove elements from old search*/
- if((blankRE.test(value)) || (value.length < 3))
- {
- $('#resultdialog').removeClass('active');
- $('#resultlist li').remove();
- }
-}
-
-// Loads on doc ready - prepares search
- $(document).ready(function () {
- /* fetch page title*/
- var pageTitle = $('title').html();
- /* getting content from search box */
- var currentString = $('#pageType').val() ;
- /* if the search box is not empty run CheckEmptyAndLoadList*/
- if(currentString.length < 1){
- CheckEmptyAndLoadList();
- }
-
- /* on key-up in the search box execute the following */
- $('#pageType').keyup(function () {
- /* extract the search box content */
- var searchString = $('#pageType').val() ;
- /* if the string is less than three characters */
- if ((searchString == null) || (searchString.length < 3)) {
- /* remove classes and elements*/
- $('#pageType').removeClass('loading');
- $('.searching').remove();
- /* run CheckEmptyAndLoadList */
- CheckEmptyAndLoadList();
-
- $('.report').remove();
- return;
- }
- /* if timer checks out */
- if (this.timer) clearTimeout(this.timer);
- this.timer = setTimeout(function () {
- /* add loading image by adding loading class */
- $('#pageType').addClass('loading');
- $('.searching').remove();
-
- /* run the actual search */
- $.ajax({
- contentType: "application/x-www-form-urlencoded",
- url: 'http://' + location.host + '/nokiasearch/GetDataServlet',
- data: 'searchString='+searchString,
- dataType:'xml',
- type: 'post',
- success: function (response, textStatus) {
- /* on success remove loading img */
- $('.searching').remove();
- $('#pageType').removeClass('loading');
-
- processNokiaData(response);
-
- }
- });
- }, 500); /* timer set to 500 ms */
- });
- }); \ No newline at end of file
diff --git a/doc/config/scripts/jquery.js b/doc/config/scripts/jquery.js
deleted file mode 100644
index 0c7294c..0000000
--- a/doc/config/scripts/jquery.js
+++ /dev/null
@@ -1,152 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.4.1
- * http://jquery.com/
- *
- * Copyright 2010, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2010, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Mon Jan 25 19:43:33 2010 -0500
- */
-(function(z,v){function la(){if(!c.isReady){try{r.documentElement.doScroll("left")}catch(a){setTimeout(la,1);return}c.ready()}}function Ma(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,i){var j=a.length;if(typeof b==="object"){for(var n in b)X(a,n,b[n],f,e,d);return a}if(d!==v){f=!i&&f&&c.isFunction(d);for(n=0;n<j;n++)e(a[n],b,f?d.call(a[n],n,e(a[n],b)):d,i);return a}return j?
-e(a[0],b):null}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function ma(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function na(a){var b,d=[],f=[],e=arguments,i,j,n,o,m,s,x=c.extend({},c.data(this,"events").live);if(!(a.button&&a.type==="click")){for(o in x){j=x[o];if(j.live===a.type||j.altLive&&c.inArray(a.type,j.altLive)>-1){i=j.data;i.beforeFilter&&i.beforeFilter[a.type]&&!i.beforeFilter[a.type](a)||f.push(j.selector)}else delete x[o]}i=c(a.target).closest(f,
-a.currentTarget);m=0;for(s=i.length;m<s;m++)for(o in x){j=x[o];n=i[m].elem;f=null;if(i[m].selector===j.selector){if(j.live==="mouseenter"||j.live==="mouseleave")f=c(a.relatedTarget).closest(j.selector)[0];if(!f||f!==n)d.push({elem:n,fn:j})}}m=0;for(s=d.length;m<s;m++){i=d[m];a.currentTarget=i.elem;a.data=i.fn.data;if(i.fn.apply(i.elem,e)===false){b=false;break}}return b}}function oa(a,b){return"live."+(a?a+".":"")+b.replace(/\./g,"`").replace(/ /g,"&")}function pa(a){return!a||!a.parentNode||a.parentNode.nodeType===
-11}function qa(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var i in f)for(var j in f[i])c.event.add(this,i,f[i][j],f[i][j].data)}}})}function ra(a,b,d){var f,e,i;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0&&(c.support.checkClone||!sa.test(a[0]))){e=true;if(i=c.fragments[a[0]])if(i!==1)f=i}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:r;f=b.createDocumentFragment();
-c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=i?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(ta.concat.apply([],ta.slice(0,b)),function(){d[this]=a});return d}function ua(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Na=z.jQuery,Oa=z.$,r=z.document,S,Pa=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Qa=/^.[^:#\[\.,]*$/,Ra=/\S/,Sa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Ta=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,O=navigator.userAgent,
-va=false,P=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,Q=Array.prototype.slice,wa=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(typeof a==="string")if((d=Pa.exec(a))&&(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:r;if(a=Ta.exec(a))if(c.isPlainObject(b)){a=[r.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=ra([d[1]],
-[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}}else{if(b=r.getElementById(d[2])){if(b.id!==d[2])return S.find(a);this.length=1;this[0]=b}this.context=r;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=r;a=r.getElementsByTagName(a)}else return!b||b.jquery?(b||S).find(a):c(b).find(a);else if(c.isFunction(a))return S.ready(a);if(a.selector!==v){this.selector=a.selector;this.context=a.context}return c.isArray(a)?this.setArray(a):c.makeArray(a,
-this)},selector:"",jquery:"1.4.1",length:0,size:function(){return this.length},toArray:function(){return Q.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){a=c(a||null);a.prevObject=this;a.context=this.context;if(b==="find")a.selector=this.selector+(this.selector?" ":"")+d;else if(b)a.selector=this.selector+"."+b+"("+d+")";return a},setArray:function(a){this.length=0;ba.apply(this,a);return this},each:function(a,b){return c.each(this,
-a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(r,c);else P&&P.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(Q.apply(this,arguments),"slice",Q.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};
-c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,i,j,n;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(i in e){j=a[i];n=e[i];if(a!==n)if(f&&n&&(c.isPlainObject(n)||c.isArray(n))){j=j&&(c.isPlainObject(j)||c.isArray(j))?j:c.isArray(n)?[]:{};a[i]=c.extend(f,j,n)}else if(n!==v)a[i]=n}return a};c.extend({noConflict:function(a){z.$=
-Oa;if(a)z.jQuery=Na;return c},isReady:false,ready:function(){if(!c.isReady){if(!r.body)return setTimeout(c.ready,13);c.isReady=true;if(P){for(var a,b=0;a=P[b++];)a.call(r,c);P=null}c.fn.triggerHandler&&c(r).triggerHandler("ready")}},bindReady:function(){if(!va){va=true;if(r.readyState==="complete")return c.ready();if(r.addEventListener){r.addEventListener("DOMContentLoaded",L,false);z.addEventListener("load",c.ready,false)}else if(r.attachEvent){r.attachEvent("onreadystatechange",L);z.attachEvent("onload",
-c.ready);var a=false;try{a=z.frameElement==null}catch(b){}r.documentElement.doScroll&&a&&la()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,"isPrototypeOf"))return false;var b;for(b in a);return b===v||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;
-return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return z.JSON&&z.JSON.parse?z.JSON.parse(a):(new Function("return "+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Ra.test(a)){var b=r.getElementsByTagName("head")[0]||
-r.documentElement,d=r.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(r.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,i=a.length,j=i===v||c.isFunction(a);if(d)if(j)for(f in a){if(b.apply(a[f],d)===false)break}else for(;e<i;){if(b.apply(a[e++],d)===false)break}else if(j)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=
-a[0];e<i&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Sa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==
-v;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,i=a.length;e<i;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,i=0,j=a.length;i<j;i++){e=b(a[i],i,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=v}else if(b&&!c.isFunction(b)){d=b;b=v}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},
-uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});O=c.uaMatch(O);if(O.browser){c.browser[O.browser]=true;c.browser.version=O.version}if(c.browser.webkit)c.browser.safari=true;if(wa)c.inArray=function(a,b){return wa.call(b,a)};S=c(r);if(r.addEventListener)L=function(){r.removeEventListener("DOMContentLoaded",
-L,false);c.ready()};else if(r.attachEvent)L=function(){if(r.readyState==="complete"){r.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=r.documentElement,b=r.createElement("script"),d=r.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=d.getElementsByTagName("*"),i=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!i)){c.support=
-{leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55$/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:r.createElement("select").appendChild(r.createElement("option")).selected,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};
-b.type="text/javascript";try{b.appendChild(r.createTextNode("window."+f+"=1;"))}catch(j){}a.insertBefore(b,a.firstChild);if(z[f]){c.support.scriptEval=true;delete z[f]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function n(){c.support.noCloneEvent=false;d.detachEvent("onclick",n)});d.cloneNode(true).fireEvent("onclick")}d=r.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=r.createDocumentFragment();a.appendChild(d.firstChild);
-c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var n=r.createElement("div");n.style.width=n.style.paddingLeft="1px";r.body.appendChild(n);c.boxModel=c.support.boxModel=n.offsetWidth===2;r.body.removeChild(n).style.display="none"});a=function(n){var o=r.createElement("div");n="on"+n;var m=n in o;if(!m){o.setAttribute(n,"return;");m=typeof o[n]==="function"}return m};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=i=null}})();c.props=
-{"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ua=0,xa={},Va={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var f=a[G],e=c.cache;if(!b&&!f)return null;f||(f=++Ua);if(typeof b==="object"){a[G]=f;e=e[f]=c.extend(true,
-{},b)}else e=e[f]?e[f]:typeof d==="undefined"?Va:(e[f]={});if(d!==v){a[G]=f;e[b]=d}return typeof b==="string"?e[b]:e}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{try{delete a[G]}catch(i){a.removeAttribute&&a.removeAttribute(G)}delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,
-a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===v){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===v&&this.length)f=c.data(this[0],a);return f===v&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);
-return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===v)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||
-a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var ya=/[\n\t]/g,ca=/\s+/,Wa=/\r/g,Xa=/href|src|style/,Ya=/(button|input)/i,Za=/(button|input|object|select|textarea)/i,$a=/^(a|area)$/i,za=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(o){var m=
-c(this);m.addClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className)for(var i=" "+e.className+" ",j=0,n=b.length;j<n;j++){if(i.indexOf(" "+b[j]+" ")<0)e.className+=" "+b[j]}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(o){var m=c(this);m.removeClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string"||a===v)for(var b=(a||"").split(ca),
-d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var i=(" "+e.className+" ").replace(ya," "),j=0,n=b.length;j<n;j++)i=i.replace(" "+b[j]+" "," ");e.className=i.substring(1,i.length-1)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var i=c(this);i.toggleClass(a.call(this,e,i.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,i=0,j=c(this),n=b,o=
-a.split(ca);e=o[i++];){n=f?n:!j.hasClass(e);j[n?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(ya," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===v){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||
-{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var i=b?d:0;for(d=b?d+1:e.length;i<d;i++){var j=e[i];if(j.selected){a=c(j).val();if(b)return a;f.push(a)}}return f}if(za.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Wa,"")}return v}var n=c.isFunction(a);return this.each(function(o){var m=c(this),s=a;if(this.nodeType===1){if(n)s=a.call(this,o,m.val());
-if(typeof s==="number")s+="";if(c.isArray(s)&&za.test(this.type))this.checked=c.inArray(m.val(),s)>=0;else if(c.nodeName(this,"select")){var x=c.makeArray(s);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),x)>=0});if(!x.length)this.selectedIndex=-1}else this.value=s}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return v;if(f&&b in c.attrFn)return c(a)[b](d);
-f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==v;b=f&&c.props[b]||b;if(a.nodeType===1){var i=Xa.test(b);if(b in a&&f&&!i){if(e){b==="type"&&Ya.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Za.test(a.nodeName)||$a.test(a.nodeName)&&a.href?0:v;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=
-""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&i?a.getAttribute(b,2):a.getAttribute(b);return a===null?v:a}return c.style(a,b,d)}});var ab=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==z&&!a.frameElement)a=z;if(!d.guid)d.guid=c.guid++;if(f!==v){d=c.proxy(d);d.data=f}var e=c.data(a,"events")||c.data(a,"events",{}),i=c.data(a,"handle"),j;if(!i){j=
-function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(j.elem,arguments):v};i=c.data(a,"handle",j)}if(i){i.elem=a;b=b.split(/\s+/);for(var n,o=0;n=b[o++];){var m=n.split(".");n=m.shift();if(o>1){d=c.proxy(d);if(f!==v)d.data=f}d.type=m.slice(0).sort().join(".");var s=e[n],x=this.special[n]||{};if(!s){s=e[n]={};if(!x.setup||x.setup.call(a,f,m,d)===false)if(a.addEventListener)a.addEventListener(n,i,false);else a.attachEvent&&a.attachEvent("on"+n,i)}if(x.add)if((m=x.add.call(a,
-d,f,m,s))&&c.isFunction(m)){m.guid=m.guid||d.guid;m.data=m.data||d.data;m.type=m.type||d.type;d=m}s[d.guid]=d;this.global[n]=true}a=null}}},global:{},remove:function(a,b,d){if(!(a.nodeType===3||a.nodeType===8)){var f=c.data(a,"events"),e,i,j;if(f){if(b===v||typeof b==="string"&&b.charAt(0)===".")for(i in f)this.remove(a,i+(b||""));else{if(b.type){d=b.handler;b=b.type}b=b.split(/\s+/);for(var n=0;i=b[n++];){var o=i.split(".");i=o.shift();var m=!o.length,s=c.map(o.slice(0).sort(),ab);s=new RegExp("(^|\\.)"+
-s.join("\\.(?:.*\\.)?")+"(\\.|$)");var x=this.special[i]||{};if(f[i]){if(d){j=f[i][d.guid];delete f[i][d.guid]}else for(var A in f[i])if(m||s.test(f[i][A].type))delete f[i][A];x.remove&&x.remove.call(a,o,j);for(e in f[i])break;if(!e){if(!x.teardown||x.teardown.call(a,o)===false)if(a.removeEventListener)a.removeEventListener(i,c.data(a,"handle"),false);else a.detachEvent&&a.detachEvent("on"+i,c.data(a,"handle"));e=null;delete f[i]}}}}for(e in f)break;if(!e){if(A=c.data(a,"handle"))A.elem=null;c.removeData(a,
-"events");c.removeData(a,"handle")}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();this.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return v;a.result=v;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,
-b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(i){}if(!a.isPropagationStopped()&&f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){d=a.target;var j;if(!(c.nodeName(d,"a")&&e==="click")&&!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()])){try{if(d[e]){if(j=d["on"+e])d["on"+e]=null;this.triggered=true;d[e]()}}catch(n){}if(j)d["on"+e]=j;this.triggered=false}}},handle:function(a){var b,
-d;a=arguments[0]=c.event.fix(a||z.event);a.currentTarget=this;d=a.type.split(".");a.type=d.shift();b=!d.length&&!a.exclusive;var f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");d=(c.data(this,"events")||{})[a.type];for(var e in d){var i=d[e];if(b||f.test(i.type)){a.handler=i;a.data=i.data;i=i.apply(this,arguments);if(i!==v){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
-fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||r;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=r.documentElement;d=r.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
-d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==v)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a,b){c.extend(a,b||{});a.guid+=b.selector+b.live;b.liveProxy=a;c.event.add(this,b.live,na,b)},remove:function(a){if(a.length){var b=
-0,d=new RegExp("(^|\\.)"+a[0]+"(\\.|$)");c.each(c.data(this,"events").live||{},function(){d.test(this.type)&&b++});b<1&&c.event.remove(this,a[0],na)}},special:{}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};
-c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y};var Aa=function(a){for(var b=
-a.relatedTarget;b&&b!==this;)try{b=b.parentNode}catch(d){break}if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}},Ba=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ba:Aa,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ba:Aa)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(a,b,d){if(this.nodeName.toLowerCase()!==
-"form"){c.event.add(this,"click.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="submit"||i==="image")&&c(e).closest("form").length)return ma("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="text"||i==="password")&&c(e).closest("form").length&&f.keyCode===13)return ma("submit",this,arguments)})}else return false},remove:function(a,b){c.event.remove(this,"click.specialSubmit"+(b?"."+b.guid:""));c.event.remove(this,
-"keypress.specialSubmit"+(b?"."+b.guid:""))}};if(!c.support.changeBubbles){var da=/textarea|input|select/i;function Ca(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d}function ea(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Ca(d);if(a.type!=="focusout"||
-d.type!=="radio")c.data(d,"_change_data",e);if(!(f===v||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}}c.event.special.change={filters:{focusout:ea,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return ea.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return ea.call(this,a)},beforeactivate:function(a){a=
-a.target;a.nodeName.toLowerCase()==="input"&&a.type==="radio"&&c.data(a,"_change_data",Ca(a))}},setup:function(a,b,d){for(var f in T)c.event.add(this,f+".specialChange."+d.guid,T[f]);return da.test(this.nodeName)},remove:function(a,b){for(var d in T)c.event.remove(this,d+".specialChange"+(b?"."+b.guid:""),T[d]);return da.test(this.nodeName)}};var T=c.event.special.change.filters}r.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,
-f)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var i in d)this[b](i,f,d[i],e);return this}if(c.isFunction(f)){e=f;f=v}var j=b==="one"?c.proxy(e,function(n){c(this).unbind(n,j);return e.apply(this,arguments)}):e;return d==="unload"&&b!=="one"?this.one(d,f,e):this.each(function(){c.event.add(this,d,j,f)})}});c.fn.extend({unbind:function(a,
-b){if(typeof a==="object"&&!a.preventDefault){for(var d in a)this.unbind(d,a[d]);return this}return this.each(function(){c.event.remove(this,a,b)})},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+
-a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e){var i,j=0;if(c.isFunction(f)){e=f;f=v}for(d=(d||"").split(/\s+/);(i=d[j++])!=null;){i=i==="focus"?"focusin":i==="blur"?"focusout":i==="hover"?d.push("mouseleave")&&"mouseenter":i;b==="live"?c(this.context).bind(oa(i,this.selector),{data:f,selector:this.selector,
-live:i},e):c(this.context).unbind(oa(i,this.selector),e?{guid:e.guid+this.selector+i}:null)}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});z.attachEvent&&!z.addEventListener&&z.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
-(function(){function a(g){for(var h="",k,l=0;g[l];l++){k=g[l];if(k.nodeType===3||k.nodeType===4)h+=k.nodeValue;else if(k.nodeType!==8)h+=a(k.childNodes)}return h}function b(g,h,k,l,q,p){q=0;for(var u=l.length;q<u;q++){var t=l[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===k){y=l[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=k;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}l[q]=y}}}function d(g,h,k,l,q,p){q=0;for(var u=l.length;q<u;q++){var t=l[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===
-k){y=l[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=k;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(o.filter(h,[t]).length>0){y=t;break}}t=t[g]}l[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,i=Object.prototype.toString,j=false,n=true;[0,0].sort(function(){n=false;return 0});var o=function(g,h,k,l){k=k||[];var q=h=h||r;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||
-typeof g!=="string")return k;for(var p=[],u,t,y,R,H=true,M=w(h),I=g;(f.exec(""),u=f.exec(I))!==null;){I=u[3];p.push(u[1]);if(u[2]){R=u[3];break}}if(p.length>1&&s.exec(g))if(p.length===2&&m.relative[p[0]])t=fa(p[0]+p[1],h);else for(t=m.relative[p[0]]?[h]:o(p.shift(),h);p.length;){g=p.shift();if(m.relative[g])g+=p.shift();t=fa(g,t)}else{if(!l&&p.length>1&&h.nodeType===9&&!M&&m.match.ID.test(p[0])&&!m.match.ID.test(p[p.length-1])){u=o.find(p.shift(),h,M);h=u.expr?o.filter(u.expr,u.set)[0]:u.set[0]}if(h){u=
-l?{expr:p.pop(),set:A(l)}:o.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=u.expr?o.filter(u.expr,u.set):u.set;if(p.length>0)y=A(t);else H=false;for(;p.length;){var D=p.pop();u=D;if(m.relative[D])u=p.pop();else D="";if(u==null)u=h;m.relative[D](y,u,M)}}else y=[]}y||(y=t);y||o.error(D||g);if(i.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))k.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&
-y[g].nodeType===1&&k.push(t[g]);else k.push.apply(k,y);else A(y,k);if(R){o(R,q,k,l);o.uniqueSort(k)}return k};o.uniqueSort=function(g){if(C){j=n;g.sort(C);if(j)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};o.matches=function(g,h){return o(g,null,null,h)};o.find=function(g,h,k){var l,q;if(!g)return[];for(var p=0,u=m.order.length;p<u;p++){var t=m.order[p];if(q=m.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");l=m.find[t](q,
-h,k);if(l!=null){g=g.replace(m.match[t],"");break}}}}l||(l=h.getElementsByTagName("*"));return{set:l,expr:g}};o.filter=function(g,h,k,l){for(var q=g,p=[],u=h,t,y,R=h&&h[0]&&w(h[0]);g&&h.length;){for(var H in m.filter)if((t=m.leftMatch[H].exec(g))!=null&&t[2]){var M=m.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(u===p)p=[];if(m.preFilter[H])if(t=m.preFilter[H](t,u,k,p,l,R)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=u[U])!=null;U++)if(D){I=M(D,t,U,u);var Da=
-l^!!I;if(k&&I!=null)if(Da)y=true;else u[U]=false;else if(Da){p.push(D);y=true}}if(I!==v){k||(u=p);g=g.replace(m.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)o.error(g);else break;q=g}return u};o.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var m=o.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
-TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,h){var k=typeof h==="string",l=k&&!/\W/.test(h);k=k&&!l;if(l)h=h.toLowerCase();l=0;for(var q=g.length,
-p;l<q;l++)if(p=g[l]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[l]=k||p&&p.nodeName.toLowerCase()===h?p||false:p===h}k&&o.filter(h,g,true)},">":function(g,h){var k=typeof h==="string";if(k&&!/\W/.test(h)){h=h.toLowerCase();for(var l=0,q=g.length;l<q;l++){var p=g[l];if(p){k=p.parentNode;g[l]=k.nodeName.toLowerCase()===h?k:false}}}else{l=0;for(q=g.length;l<q;l++)if(p=g[l])g[l]=k?p.parentNode:p.parentNode===h;k&&o.filter(h,g,true)}},"":function(g,h,k){var l=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=
-h=h.toLowerCase();q=b}q("parentNode",h,l,g,p,k)},"~":function(g,h,k){var l=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,l,g,p,k)}},find:{ID:function(g,h,k){if(typeof h.getElementById!=="undefined"&&!k)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var k=[];h=h.getElementsByName(g[1]);for(var l=0,q=h.length;l<q;l++)h[l].getAttribute("name")===g[1]&&k.push(h[l]);return k.length===0?null:k}},
-TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,k,l,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var u;(u=h[p])!=null;p++)if(u)if(q^(u.className&&(" "+u.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))k||l.push(u);else if(k)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&
-"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,k,l,q,p){h=g[1].replace(/\\/g,"");if(!p&&m.attrMap[h])g[1]=m.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,k,l,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=o(g[3],null,null,h);else{g=o.filter(g[3],h,k,true^q);k||l.push.apply(l,g);return false}else if(m.match.POS.test(g[0])||m.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);
-return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,k){return!!o(k[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===
-g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,h){return h===0},last:function(g,h,k,l){return h===l.length-1},even:function(g,h){return h%2===
-0},odd:function(g,h){return h%2===1},lt:function(g,h,k){return h<k[3]-0},gt:function(g,h,k){return h>k[3]-0},nth:function(g,h,k){return k[3]-0===h},eq:function(g,h,k){return k[3]-0===h}},filter:{PSEUDO:function(g,h,k,l){var q=h[1],p=m.filters[q];if(p)return p(g,k,h,l);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=h[3];k=0;for(l=h.length;k<l;k++)if(h[k]===g)return false;return true}else o.error("Syntax error, unrecognized expression: "+
-q)},CHILD:function(g,h){var k=h[1],l=g;switch(k){case "only":case "first":for(;l=l.previousSibling;)if(l.nodeType===1)return false;if(k==="first")return true;l=g;case "last":for(;l=l.nextSibling;)if(l.nodeType===1)return false;return true;case "nth":k=h[2];var q=h[3];if(k===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var u=0;for(l=p.firstChild;l;l=l.nextSibling)if(l.nodeType===1)l.nodeIndex=++u;p.sizcache=h}g=g.nodeIndex-q;return k===0?g===0:g%k===0&&g/k>=
-0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var k=h[1];g=m.attrHandle[k]?m.attrHandle[k](g):g[k]!=null?g[k]:g.getAttribute(k);k=g+"";var l=h[2];h=h[4];return g==null?l==="!=":l==="="?k===h:l==="*="?k.indexOf(h)>=0:l==="~="?(" "+k+" ").indexOf(h)>=0:!h?k&&g!==false:l==="!="?k!==h:l==="^="?
-k.indexOf(h)===0:l==="$="?k.substr(k.length-h.length)===h:l==="|="?k===h||k.substr(0,h.length+1)===h+"-":false},POS:function(g,h,k,l){var q=m.setFilters[h[2]];if(q)return q(g,k,h,l)}}},s=m.match.POS;for(var x in m.match){m.match[x]=new RegExp(m.match[x].source+/(?![^\[]*\])(?![^\(]*\))/.source);m.leftMatch[x]=new RegExp(/(^(?:.|\r|\n)*?)/.source+m.match[x].source.replace(/\\(\d+)/g,function(g,h){return"\\"+(h-0+1)}))}var A=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};
-try{Array.prototype.slice.call(r.documentElement.childNodes,0)}catch(B){A=function(g,h){h=h||[];if(i.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var k=0,l=g.length;k<l;k++)h.push(g[k]);else for(k=0;g[k];k++)h.push(g[k]);return h}}var C;if(r.documentElement.compareDocumentPosition)C=function(g,h){if(!g.compareDocumentPosition||!h.compareDocumentPosition){if(g==h)j=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===
-h?0:1;if(g===0)j=true;return g};else if("sourceIndex"in r.documentElement)C=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)j=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)j=true;return g};else if(r.createRange)C=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)j=true;return g.ownerDocument?-1:1}var k=g.ownerDocument.createRange(),l=h.ownerDocument.createRange();k.setStart(g,0);k.setEnd(g,0);l.setStart(h,0);l.setEnd(h,0);g=k.compareBoundaryPoints(Range.START_TO_END,
-l);if(g===0)j=true;return g};(function(){var g=r.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var k=r.documentElement;k.insertBefore(g,k.firstChild);if(r.getElementById(h)){m.find.ID=function(l,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(l[1]))?q.id===l[1]||typeof q.getAttributeNode!=="undefined"&&q.getAttributeNode("id").nodeValue===l[1]?[q]:v:[]};m.filter.ID=function(l,q){var p=typeof l.getAttributeNode!=="undefined"&&l.getAttributeNode("id");
-return l.nodeType===1&&p&&p.nodeValue===q}}k.removeChild(g);k=g=null})();(function(){var g=r.createElement("div");g.appendChild(r.createComment(""));if(g.getElementsByTagName("*").length>0)m.find.TAG=function(h,k){k=k.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var l=0;k[l];l++)k[l].nodeType===1&&h.push(k[l]);k=h}return k};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")m.attrHandle.href=function(h){return h.getAttribute("href",
-2)};g=null})();r.querySelectorAll&&function(){var g=o,h=r.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){o=function(l,q,p,u){q=q||r;if(!u&&q.nodeType===9&&!w(q))try{return A(q.querySelectorAll(l),p)}catch(t){}return g(l,q,p,u)};for(var k in g)o[k]=g[k];h=null}}();(function(){var g=r.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===
-0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){m.order.splice(1,0,"CLASS");m.find.CLASS=function(h,k,l){if(typeof k.getElementsByClassName!=="undefined"&&!l)return k.getElementsByClassName(h[1])};g=null}}})();var E=r.compareDocumentPosition?function(g,h){return g.compareDocumentPosition(h)&16}:function(g,h){return g!==h&&(g.contains?g.contains(h):true)},w=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},fa=function(g,h){var k=[],
-l="",q;for(h=h.nodeType?[h]:h;q=m.match.PSEUDO.exec(g);){l+=q[0];g=g.replace(m.match.PSEUDO,"")}g=m.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)o(g,h[q],k);return o.filter(l,k)};c.find=o;c.expr=o.selectors;c.expr[":"]=c.expr.filters;c.unique=o.uniqueSort;c.getText=a;c.isXMLDoc=w;c.contains=E})();var bb=/Until$/,cb=/^(?:parents|prevUntil|prevAll)/,db=/,/;Q=Array.prototype.slice;var Ea=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,i){return!!b.call(e,i,e)===d});else if(b.nodeType)return c.grep(a,
-function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Qa.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;c.find(a,this[f],b);if(f>0)for(var i=d;i<b.length;i++)for(var j=0;j<d;j++)if(b[j]===b[i]){b.splice(i--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=
-0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ea(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ea(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,i={},j;if(f&&a.length){e=0;for(var n=a.length;e<n;e++){j=a[e];i[j]||(i[j]=c.expr.match.POS.test(j)?c(j,b||this.context):j)}for(;f&&f.ownerDocument&&f!==b;){for(j in i){e=i[j];if(e.jquery?e.index(f)>
--1:c(f).is(e)){d.push({selector:j,elem:f});delete i[j]}}f=f.parentNode}}return d}var o=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(m,s){for(;s&&s.ownerDocument&&s!==b;){if(o?o.index(s)>-1:c(s).is(a))return s;s=s.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),
-a);return this.pushStack(pa(a[0])||pa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},
-nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);bb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):
-e;if((this.length>1||db.test(f))&&cb.test(a))e=e.reverse();return this.pushStack(e,a,Q.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===v||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==
-b&&d.push(a);return d}});var Fa=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ga=/(<([\w:]+)[^>]*?)\/>/g,eb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,Ha=/<([\w:]+)/,fb=/<tbody/i,gb=/<|&\w+;/,sa=/checked\s*(?:[^=]|=\s*.checked.)/i,Ia=function(a,b,d){return eb.test(d)?a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],
-col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==v)return this.empty().append((this[0]&&this[0].ownerDocument||r).createTextNode(a));return c.getText(this)},
-wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?
-d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,
-false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&
-!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Fa,"").replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){qa(this,b);qa(this.find("*"),b.find("*"))}return b},html:function(a){if(a===v)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Fa,""):null;else if(typeof a==="string"&&!/<script/i.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(Ha.exec(a)||
-["",""])[1].toLowerCase()]){a=a.replace(Ga,Ia);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var i=c(this),j=i.html();i.empty().append(function(){return a.call(this,e,j)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,
-b,f))});else a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(s){return c.nodeName(s,"table")?s.getElementsByTagName("tbody")[0]||s.appendChild(s.ownerDocument.createElement("tbody")):s}var e,i,j=a[0],n=[];if(!c.support.checkClone&&arguments.length===3&&typeof j===
-"string"&&sa.test(j))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(j))return this.each(function(s){var x=c(this);a[0]=j.call(this,s,b?x.html():v);x.domManip(a,b,d)});if(this[0]){e=a[0]&&a[0].parentNode&&a[0].parentNode.nodeType===11?{fragment:a[0].parentNode}:ra(a,this,n);if(i=e.fragment.firstChild){b=b&&c.nodeName(i,"tr");for(var o=0,m=this.length;o<m;o++)d.call(b?f(this[o],i):this[o],e.cacheable||this.length>1||o>0?e.fragment.cloneNode(true):e.fragment)}n&&c.each(n,
-Ma)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);for(var e=0,i=d.length;e<i;e++){var j=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),j);f=f.concat(j)}return this.pushStack(f,a,d.selector)}});c.each({remove:function(a,b){if(!a||c.filter(a,[this]).length){if(!b&&this.nodeType===1){c.cleanData(this.getElementsByTagName("*"));c.cleanData([this])}this.parentNode&&
-this.parentNode.removeChild(this)}},empty:function(){for(this.nodeType===1&&c.cleanData(this.getElementsByTagName("*"));this.firstChild;)this.removeChild(this.firstChild)}},function(a,b){c.fn[a]=function(){return this.each(b,arguments)}});c.extend({clean:function(a,b,d,f){b=b||r;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||r;var e=[];c.each(a,function(i,j){if(typeof j==="number")j+="";if(j){if(typeof j==="string"&&!gb.test(j))j=b.createTextNode(j);else if(typeof j===
-"string"){j=j.replace(Ga,Ia);var n=(Ha.exec(j)||["",""])[1].toLowerCase(),o=F[n]||F._default,m=o[0];i=b.createElement("div");for(i.innerHTML=o[1]+j+o[2];m--;)i=i.lastChild;if(!c.support.tbody){m=fb.test(j);n=n==="table"&&!m?i.firstChild&&i.firstChild.childNodes:o[1]==="<table>"&&!m?i.childNodes:[];for(o=n.length-1;o>=0;--o)c.nodeName(n[o],"tbody")&&!n[o].childNodes.length&&n[o].parentNode.removeChild(n[o])}!c.support.leadingWhitespace&&V.test(j)&&i.insertBefore(b.createTextNode(V.exec(j)[0]),i.firstChild);
-j=c.makeArray(i.childNodes)}if(j.nodeType)e.push(j);else e=c.merge(e,j)}});if(d)for(a=0;e[a];a++)if(f&&c.nodeName(e[a],"script")&&(!e[a].type||e[a].type.toLowerCase()==="text/javascript"))f.push(e[a].parentNode?e[a].parentNode.removeChild(e[a]):e[a]);else{e[a].nodeType===1&&e.splice.apply(e,[a+1,0].concat(c.makeArray(e[a].getElementsByTagName("script"))));d.appendChild(e[a])}return e},cleanData:function(a){for(var b=0,d;(d=a[b])!=null;b++){c.event.remove(d);c.removeData(d)}}});var hb=/z-?index|font-?weight|opacity|zoom|line-?height/i,
-Ja=/alpha\([^)]*\)/,Ka=/opacity=([^)]*)/,ga=/float/i,ha=/-([a-z])/ig,ib=/([A-Z])/g,jb=/^-?\d+(?:px)?$/i,kb=/^-?\d/,lb={position:"absolute",visibility:"hidden",display:"block"},mb=["Left","Right"],nb=["Top","Bottom"],ob=r.defaultView&&r.defaultView.getComputedStyle,La=c.support.cssFloat?"cssFloat":"styleFloat",ia=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===v)return c.curCSS(d,f);if(typeof e==="number"&&!hb.test(f))e+="px";c.style(d,f,e)})};
-c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return v;if((b==="width"||b==="height")&&parseFloat(d)<0)d=v;var f=a.style||a,e=d!==v;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=Ja.test(a)?a.replace(Ja,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Ka.exec(f.filter)[1])/100+"":""}if(ga.test(b))b=La;b=b.replace(ha,ia);if(e)f[b]=d;return f[b]},css:function(a,
-b,d,f){if(b==="width"||b==="height"){var e,i=b==="width"?mb:nb;function j(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(i,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,"border"+this+"Width",true))||0})}a.offsetWidth!==0?j():c.swap(a,lb,j);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&
-a.currentStyle){f=Ka.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ga.test(b))b=La;if(!d&&e&&e[b])f=e[b];else if(ob){if(ga.test(b))b="float";b=b.replace(ib,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ha,ia);f=a.currentStyle[b]||a.currentStyle[d];if(!jb.test(f)&&kb.test(f)){b=e.left;var i=a.runtimeStyle.left;a.runtimeStyle.left=
-a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=i}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var pb=
-J(),qb=/<script(.|\s)*?\/script>/gi,rb=/select|textarea/i,sb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ja=/\?/,tb=/(\?|&)_=.*?(&|$)/,ub=/^(\w+:)?\/\/([^\/?#]+)/,vb=/%20/g;c.fn.extend({_load:c.fn.load,load:function(a,b,d){if(typeof a!=="string")return this._load(a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=
-c.param(b,c.ajaxSettings.traditional);f="POST"}var i=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(j,n){if(n==="success"||n==="notmodified")i.html(e?c("<div />").append(j.responseText.replace(qb,"")).find(e):j.responseText);d&&i.each(d,[j.responseText,n,j])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&
-(this.checked||rb.test(this.nodeName)||sb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,
-b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:z.XMLHttpRequest&&(z.location.protocol!=="file:"||!z.ActiveXObject)?function(){return new z.XMLHttpRequest}:
-function(){try{return new z.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&e.success.call(o,n,j,w);e.global&&f("ajaxSuccess",[w,e])}function d(){e.complete&&e.complete.call(o,w,j);e.global&&f("ajaxComplete",[w,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}
-function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),i,j,n,o=a&&a.context||e,m=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(m==="GET")N.test(e.url)||(e.url+=(ja.test(e.url)?"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||
-N.test(e.url))){i=e.jsonpCallback||"jsonp"+pb++;if(e.data)e.data=(e.data+"").replace(N,"="+i+"$1");e.url=e.url.replace(N,"="+i+"$1");e.dataType="script";z[i]=z[i]||function(q){n=q;b();d();z[i]=v;try{delete z[i]}catch(p){}A&&A.removeChild(B)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===false&&m==="GET"){var s=J(),x=e.url.replace(tb,"$1_="+s+"$2");e.url=x+(x===e.url?(ja.test(e.url)?"&":"?")+"_="+s:"")}if(e.data&&m==="GET")e.url+=(ja.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&
-c.event.trigger("ajaxStart");s=(s=ub.exec(e.url))&&(s[1]&&s[1]!==location.protocol||s[2]!==location.host);if(e.dataType==="script"&&m==="GET"&&s){var A=r.getElementsByTagName("head")[0]||r.documentElement,B=r.createElement("script");B.src=e.url;if(e.scriptCharset)B.charset=e.scriptCharset;if(!i){var C=false;B.onload=B.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;b();d();B.onload=B.onreadystatechange=null;A&&B.parentNode&&
-A.removeChild(B)}}}A.insertBefore(B,A.firstChild);return v}var E=false,w=e.xhr();if(w){e.username?w.open(m,e.url,e.async,e.username,e.password):w.open(m,e.url,e.async);try{if(e.data||a&&a.contentType)w.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[e.url]);c.etag[e.url]&&w.setRequestHeader("If-None-Match",c.etag[e.url])}s||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",
-e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(fa){}if(e.beforeSend&&e.beforeSend.call(o,w,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");w.abort();return false}e.global&&f("ajaxSend",[w,e]);var g=w.onreadystatechange=function(q){if(!w||w.readyState===0||q==="abort"){E||d();E=true;if(w)w.onreadystatechange=c.noop}else if(!E&&w&&(w.readyState===4||q==="timeout")){E=true;w.onreadystatechange=c.noop;j=q==="timeout"?"timeout":!c.httpSuccess(w)?
-"error":e.ifModified&&c.httpNotModified(w,e.url)?"notmodified":"success";var p;if(j==="success")try{n=c.httpData(w,e.dataType,e)}catch(u){j="parsererror";p=u}if(j==="success"||j==="notmodified")i||b();else c.handleError(e,w,j,p);d();q==="timeout"&&w.abort();if(e.async)w=null}};try{var h=w.abort;w.abort=function(){w&&h.call(w);g("abort")}}catch(k){}e.async&&e.timeout>0&&setTimeout(function(){w&&!E&&g("timeout")},e.timeout);try{w.send(m==="POST"||m==="PUT"||m==="DELETE"?e.data:null)}catch(l){c.handleError(e,
-w,null,l);d()}e.async||g();return w}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=
-f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(j,n){if(c.isArray(n))c.each(n,
-function(o,m){b?f(j,m):d(j+"["+(typeof m==="object"||c.isArray(m)?o:"")+"]",m)});else!b&&n!=null&&typeof n==="object"?c.each(n,function(o,m){d(j+"["+o+"]",m)}):f(j,n)}function f(j,n){n=c.isFunction(n)?n():n;e[e.length]=encodeURIComponent(j)+"="+encodeURIComponent(n)}var e=[];if(b===v)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var i in a)d(i,a[i]);return e.join("&").replace(vb,"+")}});var ka={},wb=/toggle|show|hide/,xb=/^([+-]=)?([\d+-.]+)(.*)$/,
-W,ta=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(ka[d])f=ka[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();
-ka[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&
-c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var i=c.extend({},e),j,n=this.nodeType===1&&c(this).is(":hidden"),
-o=this;for(j in a){var m=j.replace(ha,ia);if(j!==m){a[m]=a[j];delete a[j];j=m}if(a[j]==="hide"&&n||a[j]==="show"&&!n)return i.complete.call(this);if((j==="height"||j==="width")&&this.style){i.display=c.css(this,"display");i.overflow=this.style.overflow}if(c.isArray(a[j])){(i.specialEasing=i.specialEasing||{})[j]=a[j][1];a[j]=a[j][0]}}if(i.overflow!=null)this.style.overflow="hidden";i.curAnim=c.extend({},a);c.each(a,function(s,x){var A=new c.fx(o,i,s);if(wb.test(x))A[x==="toggle"?n?"show":"hide":x](a);
-else{var B=xb.exec(x),C=A.cur(true)||0;if(B){x=parseFloat(B[2]);var E=B[3]||"px";if(E!=="px"){o.style[s]=(x||1)+E;C=(x||1)/A.cur(true)*C;o.style[s]=C+E}if(B[1])x=(B[1]==="-="?-1:1)*x+C;A.custom(C,x,E)}else A.custom(C,x,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",
-1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration==="number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,
-b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==
-null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(i){return e.step(i)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop===
-"width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=
-this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=
-c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=
-null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in r.documentElement?function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),
-f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(s){c.offset.setOffset(this,a,s)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=
-b,e=b.ownerDocument,i,j=e.documentElement,n=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var o=b.offsetTop,m=b.offsetLeft;(b=b.parentNode)&&b!==n&&b!==j;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;i=e?e.getComputedStyle(b,null):b.currentStyle;o-=b.scrollTop;m-=b.scrollLeft;if(b===d){o+=b.offsetTop;m+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){o+=parseFloat(i.borderTopWidth)||
-0;m+=parseFloat(i.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&i.overflow!=="visible"){o+=parseFloat(i.borderTopWidth)||0;m+=parseFloat(i.borderLeftWidth)||0}f=i}if(f.position==="relative"||f.position==="static"){o+=n.offsetTop;m+=n.offsetLeft}if(c.offset.supportsFixedPosition&&f.position==="fixed"){o+=Math.max(j.scrollTop,n.scrollTop);m+=Math.max(j.scrollLeft,n.scrollLeft)}return{top:o,left:m}};c.offset={initialize:function(){var a=r.body,b=r.createElement("div"),
-d,f,e,i=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);
-d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i;a.removeChild(b);c.offset.initialize=c.noop},
-bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),i=parseInt(c.curCSS(a,"top",true),10)||0,j=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,d,e);d={top:b.top-e.top+i,left:b.left-
-e.left+j};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=
-this.offsetParent||r.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],i;if(!e)return null;if(f!==v)return this.each(function(){if(i=ua(this))i.scrollTo(!a?f:c(i).scrollLeft(),a?f:c(i).scrollTop());else this[d]=f});else return(i=ua(e))?"pageXOffset"in i?i[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&i.document.documentElement[d]||i.document.body[d]:e[d]}});
-c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(i){var j=c(this);j[d](f.call(this,i,j[d]()))});return"scrollTo"in e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||
-e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===v?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});z.jQuery=z.$=c})(window);
diff --git a/doc/config/scripts/narrow.js b/doc/config/scripts/narrow.js
deleted file mode 100644
index a5e8b97..0000000
--- a/doc/config/scripts/narrow.js
+++ /dev/null
@@ -1,133 +0,0 @@
-/* This function generates menus and search box in narrow/slim fit mode */
-var narrowInit = function() {
- /* 1: Create search form */
- var narrowSearch = $('<div id="narrowsearch"></div>');
- var searchform = $("#qtdocsearch");
- narrowSearch.append(searchform);
- $("#qtdocheader .content .qtref").after(narrowSearch);
-
- /* 2: Create dropdowns */
- var narrowmenu = $('<ul id="narrowmenu" class="sf-menu"></ul>');
-
- /* Lookup */
- var lookuptext = $("#lookup h2").attr("title");
- $("#lookup ul").removeAttr("id");
- $("#lookup ul li").removeAttr("class");
- $("#lookup ul li").removeAttr("style");
- var lookupul = $("#lookup ul");
- var lookuplist = $('<li></li>');
- var lookuplink = $('<a href="#"></a>');
- lookuplink.append(lookuptext);
- lookuplist.append(lookuplink);
- lookuplist.append(lookupul);
- narrowmenu.append(lookuplist);
-
- /* Topics */
- var topicstext = $("#topics h2").attr("title");
- $("#topics ul").removeAttr("id");
- $("#topics ul li").removeAttr("class");
- $("#topics ul li").removeAttr("style");
- var topicsul = $("#topics ul");
- var topicslist = $('<li></li>');
- var topicslink = $('<a href="#"></a>');
- topicslink.append(topicstext);
- topicslist.append(topicslink);
- topicslist.append(topicsul);
- narrowmenu.append(topicslist);
-
- /* Examples */
- var examplestext = $("#examples h2").attr("title");
- $("#examples ul").removeAttr("id");
- $("#examples ul li").removeAttr("class");
- $("#examples ul li").removeAttr("style");
- var examplesul = $("#examples ul");
- var exampleslist = $('<li></li>');
- var exampleslink = $('<a href="#"></a>');
- exampleslink.append(examplestext);
- exampleslist.append(exampleslink);
- exampleslist.append(examplesul);
- narrowmenu.append(exampleslist);
-
- $("#shortCut").after(narrowmenu);
- $('ul#narrowmenu').superfish({
- delay: 100,
- autoArrows: false,
- disableHI: true
- });
-}
-
-/* Executes on doc ready */
-$(document).ready(function(){
- /* check if body has the narrow class */
- if ($('body').hasClass('narrow')) {
- /* run narrowInit */
- narrowInit();
- }
-
- /* messure window width and add class if it is smaller than 600 px */
- if($(window).width()<600) {
- $('body').addClass('narrow');
- /* if the search box contains */
- if ($("#narrowsearch").length == 0) {
- /* run narrowInit */
- narrowInit();
- }
- }
- else { /* if the window is wider than 600 px, narrow is removed */
- $('body').removeClass('narrow');
- if ($("#narrowsearch").length == 0) {
- }
- }
-});
-/* binding resize event to this funciton */
-$(window).bind('resize', function () {
- /* if the window is wider than 600 px, narrow class is added */
- if($(window).width()<600) {
- $('body').addClass('narrow');
- if ($("#narrowsearch").length == 0) {
- narrowInit();
- }
- }
- else {
- /* else we remove the narrow class */
- $('body').removeClass('narrow');
- }
-});
-
- $('#narrowsearch').keyup(function () {
- /* extract the search box content */
- var searchString = $('#narrowsearch').val();
- /* if the string is less than three characters */
- if ((searchString == null) || (searchString.length < 3)) {
- /* remove classes and elements*/
- $('#narrowsearch').removeClass('loading');
- $('.searching').remove();
- /* run CheckEmptyAndLoadList */
- CheckEmptyAndLoadList();
-
- $('.report').remove();
- return;
- }
- /* if timer checks out */
- if (this.timer) clearTimeout(this.timer);
- this.timer = setTimeout(function () {
- /* add loading image by adding loading class */
- $('#narrowsearch').addClass('loading');
- $('.searching').remove();
-
- /* run the actual search */
- $.ajax({
- contentType: "application/x-www-form-urlencoded",
- url: 'http://' + location.host + '/nokiasearch/GetDataServlet',
- data: 'searchString='+searchString,
- dataType:'xml',
- type: 'post',
- success: function (response, textStatus) {
- /* on success remove loading img */
- $('.searching').remove();
- $('#narrowsearch').removeClass('loading');
- processNokiaData(response);
- }
- });
- }, 500); /* timer set to 500 ms */
- }); \ No newline at end of file
diff --git a/doc/config/scripts/superfish.js b/doc/config/scripts/superfish.js
deleted file mode 100644
index c6a9c7d..0000000
--- a/doc/config/scripts/superfish.js
+++ /dev/null
@@ -1,121 +0,0 @@
-
-/*
- * Superfish v1.4.8 - jQuery menu widget
- * Copyright (c) 2008 Joel Birch
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
- */
-
-;(function($){
- $.fn.superfish = function(op){
-
- var sf = $.fn.superfish,
- c = sf.c,
- $arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
- over = function(){
- var $$ = $(this), menu = getMenu($$);
- clearTimeout(menu.sfTimer);
- $$.showSuperfishUl().siblings().hideSuperfishUl();
- },
- out = function(){
- var $$ = $(this), menu = getMenu($$), o = sf.op;
- clearTimeout(menu.sfTimer);
- menu.sfTimer=setTimeout(function(){
- o.retainPath=($.inArray($$[0],o.$path)>-1);
- $$.hideSuperfishUl();
- if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
- },o.delay);
- },
- getMenu = function($menu){
- var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
- sf.op = sf.o[menu.serial];
- return menu;
- },
- addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
-
- return this.each(function() {
- var s = this.serial = sf.o.length;
- var o = $.extend({},sf.defaults,op);
- o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
- $(this).addClass([o.hoverClass,c.bcClass].join(' '))
- .filter('li:has(ul)').removeClass(o.pathClass);
- });
- sf.o[s] = sf.op = o;
-
- $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
- if (o.autoArrows) addArrow( $('>a:first-child',this) );
- })
- .not('.'+c.bcClass)
- .hideSuperfishUl();
-
- var $a = $('a',this);
- $a.each(function(i){
- var $li = $a.eq(i).parents('li');
- $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
- });
- o.onInit.call(this);
-
- }).each(function() {
- var menuClasses = [c.menuClass];
- if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
- $(this).addClass(menuClasses.join(' '));
- });
- };
-
- var sf = $.fn.superfish;
- sf.o = [];
- sf.op = {};
- sf.IE7fix = function(){
- var o = sf.op;
- if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
- this.toggleClass(sf.c.shadowClass+'-off');
- };
- sf.c = {
- bcClass : 'sf-breadcrumb',
- menuClass : 'sf-js-enabled',
- anchorClass : 'sf-with-ul',
- arrowClass : 'sf-sub-indicator',
- shadowClass : 'sf-shadow'
- };
- sf.defaults = {
- hoverClass : 'sfHover',
- pathClass : 'overideThisToUse',
- pathLevels : 1,
- delay : 800,
- animation : {opacity:'show'},
- speed : 'normal',
- autoArrows : true,
- dropShadows : true,
- disableHI : false, // true disables hoverIntent detection
- onInit : function(){}, // callback functions
- onBeforeShow: function(){},
- onShow : function(){},
- onHide : function(){}
- };
- $.fn.extend({
- hideSuperfishUl : function(){
- var o = sf.op,
- not = (o.retainPath===true) ? o.$path : '';
- o.retainPath = false;
- var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
- .find('>ul').hide().css('visibility','hidden');
- o.onHide.call($ul);
- return this;
- },
- showSuperfishUl : function(){
- var o = sf.op,
- sh = sf.c.shadowClass+'-off',
- $ul = this.addClass(o.hoverClass)
- .find('>ul:hidden').css('visibility','visible');
- sf.IE7fix.call($ul);
- o.onBeforeShow.call($ul);
- $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
- return this;
- }
- });
-
-})(jQuery);
diff --git a/doc/config/style/narrow.css b/doc/config/style/narrow.css
deleted file mode 100644
index de5b0a0..0000000
--- a/doc/config/style/narrow.css
+++ /dev/null
@@ -1,270 +0,0 @@
- /* start narrow mode */
-
- body.narrow
- {
- background-image: none;
- }
-
- .narrow a {
- color: #44a51c;
- }
-
- .narrow .header, .narrow .header .content, .narrow .footer, .narrow .wrapper {
- margin: 0 7px;
- min-width: 300px;
- }
-
- .narrow .footer {
- margin: 0px;
- }
-
- .creator .header, .creator .header .content, .creator .footer, .creator .wrapper {
- margin: 0px;
- min-width: 300px;
- }
- .narrow .header
- {
- width: 100%;
- margin: 0;
- height: auto;
- background: #fff url(../images/header_bg.png) repeat-x 0 100%;
- padding: 10px 0 5px 0;
- overflow: visible;
- }
-
- .narrow .header .content
- {
- }
-
- .narrow .header #nav-logo
- {
- display: none;
- }
-
- .narrow .header .qtref
- {
- width: auto;
- height: auto;
- color: #363534;
- position: static;
- float: left;
- margin-left: 25px;
- font: bold 18px/1 Arial;
- }
-
- .narrow .header .qtref a
- {
- color: #00732F;
- }
-
- .narrow .header .qtref span
- {
- background-image: none;
- text-indent: 0;
- }
-
- .narrow .header #nav-topright
- {
- display: none;
- }
-
- .narrow .header #shortCut
- {
- clear: both;
- font-weight: normal;
- position: static;
- float: left;
- margin: 15px 0 0 25px;
- overflow: hidden;
- padding: 0;
- height: auto;
- }
-
- .narrow .header #shortCut ul
- {
- float: none;
- margin: 0;
- width: auto;
- font-size: 11px;
- }
-
- .narrow .header #shortCut ul li
- {
- background-image: none;
- }
-
- .narrow .header #shortCut ul .shortCut-topleft-active,
- .narrow .header #shortCut ul .shortCut-topleft-inactive
- {
- background-image: none;
- height: auto;
- padding: 0;
- width: auto;
- }
- .narrow .header #shortCut ul li a
- {
- color: #00732F;
- }
-
- .narrow .wrapper .hd
- {
- background: url(../images/bg_ul_blank.png) no-repeat 0 0;
- }
-
- .narrow .wrapper .bd
- {
- background: url(../images/bg_l_blank.png) repeat-y 0 0;
- }
-
- .narrow .wrapper .ft
- {
- background: url(../images/bg_ll_blank.png) no-repeat 0 0;
- }
-
- .narrow .sidebar
- {
- display: none;
- }
-
- .narrow .wrap
- {
- margin: 0 5px 0 5px;
- }
-
- .creator .wrap
- {
- margin: 0px;
- background:#FFFFFF;
- }
- .narrow .wrap .toolbar
- {
- border-bottom: none;
- }
-
- .narrow .wrap .content
- {
- padding-top: 15px;
- }
- .creator .wrap .content
- {
- padding-top: 10px;
- }
- .creator .wrap .content .guide
- {
- padding-top: 15px;
- }
- .narrow .wrap .feedback
- {
- display: none;
- }
-
- .narrow .wrap .breadcrumb ul li {
- font-weight: normal;
- }
-
- .narrow .wrap .breadcrumb ul li a {
- color: #44a51c;
- }
-
- .narrow .wrap .breadcrumb ul li.last a {
- color: #363534;
- }
-
- #narrowsearch {
- display: none;
- }
-
- .narrow #narrowsearch {
- display: block;
- float: right;
- margin-right: 25px;
- _position: relative;
- }
-
- .narrow #narrowsearch fieldset {
- _position: absolute;
- _margin-top: -1px;
- }
-
- .narrow #narrowsearch {
- background: url("http://doc.qt.nokia.com/prototype/html/images/sprites-combined.png") no-repeat scroll -6px -348px transparent;
- height: 21px;
- padding: 2px 0 0 5px;
- width: 167px;
- }
-
- .narrow #narrowsearch input {
- border: none;
- font: 13px/1.2 Verdana;
- height: 19px;
- outline: none;
- padding: 0;
- width: 158px;
- *border: 1px solid #fff;
- *height: 17px;
- _height: 18px;
- /* to be fixed */
- display: none;
- /* to be fixed */
- }
-
- .narrow .indexbox .indexIcon {
- display: none;
- }
-
- .narrow .indexboxcont .section {
- width: 64%;
- padding-left: 0;
- }
-
- .narrow .indexboxcont .sectionlist {
- width: 32.5%;
- }
-
- #narrowmenu {
- display: none;
- float: right;
- margin: 15px 40px 0 0;
- font-size: 11px;
- }
-
- .narrow #narrowmenu {
- display: block;
- }
-
- #narrowmenu a {
- line-height: 1.1;
- background: url(../images/arrow_down.png) no-repeat 100% 50%;
- white-space: nowrap;
- padding: 0 16px 0 5px;
- }
-
- #narrowmenu li {
- margin-left: 20px;
- }
-
- #narrowmenu li li {
- margin: 0 0 5px 0;
- }
-
- #narrowmenu li li a {
- padding: 0;
- background-image: none;
- }
-
- #narrowmenu li,
- #narrowmenu li ul {
- background-color: #fff;
- margin-top:-1px;
- }
-
- #narrowmenu li ul {
- width: auto;
- padding: 5px;
- }
-
- .sf-menu li:hover ul, .sf-menu li.sfHover ul {
- top: 1.2em;
- }
-
- /* end narrow mode */
diff --git a/doc/config/style/offline.css b/doc/config/style/offline.css
deleted file mode 100644
index c3f90c3..0000000
--- a/doc/config/style/offline.css
+++ /dev/null
@@ -1,675 +0,0 @@
-@media screen
-{
-
-/* basic elements */
- html
- {
- color: #000000;
- background: #FFFFFF;
- }
- table
- {
- border-collapse: collapse;
- border-spacing: 0;
- }
- fieldset, img
- {
- border: 0;
- max-width:100%;
- }
- address, caption, cite, code, dfn, em, strong, th, var, optgroup
- {
- font-style: inherit;
- font-weight: inherit;
- }
- del, ins
- {
- text-decoration: none;
- }
- ol li
- {
- list-style: decimal;
- }
- ul li
- {
- list-style: none;
- }
- caption, th
- {
- text-align: left;
- }
- h1, h2, h3, h4, h5, h6
- {
- font-size: 100%;
- }
- q:before, q:after
- {
- content: '';
- }
- abbr, acronym
- {
- border: 0;
- font-variant: normal;
- }
- sup, sub
- {
- vertical-align: baseline;
- }
- tt, .qmlreadonly span, .qmldefault span
- {
- word-spacing:0.5em;
- }
- legend
- {
- color: #000000;
- }
- strong
- {
- font-weight: bold;
- }
- em
- {
- font-style: italic;
- }
-
- body
- {
- margin-left: 0.5em;
- margin-right: 0.5em;
- font-family: sans-serif;
- line-height: normal
- }
- a
- {
- color: #00732F;
- text-decoration: none;
- }
- hr
- {
- background-color: #E6E6E6;
- border: 1px solid #E6E6E6;
- height: 1px;
- width: 100%;
- text-align: left;
- margin: 1.5em 0 1.5em 0;
- }
-
- pre
- {
- border: 1px solid #DDDDDD;
- -moz-border-radius: 0.7em 0.7em 0.7em 0.7em;
- -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em;
- border-radius: 0.7em 0.7em 0.7em 0.7em;
- margin: 0 1.5em 1em 1em;
- padding: 1em 1em 1em 1em;
- overflow-x: auto;
- }
- table, pre
- {
- -moz-border-radius: 0.7em 0.7em 0.7em 0.7em;
- -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em;
- border-radius: 0.7em 0.7em 0.7em 0.7em;
- background-color: #F6F6F6;
- border: 1px solid #E6E6E6;
- border-collapse: separate;
- margin-bottom: 2.5em;
- }
- pre {
- font-size: 90%;
- display: block;
- overflow:hidden;
- }
- thead
- {
- margin-top: 0.5em;
- font-weight: bold
- }
- th
- {
- padding: 0.5em 1.5em 0.5em 1em;
- background-color: #E1E1E1;
- border-left: 1px solid #E6E6E6;
- }
- td
- {
- padding: 0.25em 1.5em 0.25em 1em;
- }
-
- td.rightAlign
- {
- padding: 0.25em 0.5em 0.25em 1em;
- }
- table tr.odd
- {
- border-left: 1px solid #E6E6E6;
- background-color: #F6F6F6;
- color: #66666E;
- }
- table tr.even
- {
- border-left: 1px solid #E6E6E6;
- background-color: #ffffff;
- color: #66666E;
- }
-
- div.float-left
- {
- float: left; margin-right: 2em
- }
- div.float-right
- {
- float: right; margin-left: 2em
- }
-
- span.comment
- {
- color: #008B00;
- }
- span.string, span.char
- {
- color: #000084;
- }
- span.number
- {
- color: #a46200;
- }
- span.operator
- {
- color: #202020;
- }
- span.keyword
- {
- color: #840000;
- }
- span.name
- {
- color: black
- }
- span.type
- {
- font-weight: bold
- }
- span.type a:visited
- {
- color: #0F5300;
- }
- span.preprocessor
- {
- color: #404040
- }
-/* end basic elements */
-
-/* font style elements */
- .heading
- {
- font-weight: bold;
- font-size: 125%;
- }
- .subtitle
- {
- font-size: 110%
- }
- .small-subtitle
- {
- font-size: 100%
- }
- .red
- {
- color:red;
- }
-/* end font style elements */
-
-/* global settings*/
- .header, .footer
- {
- display: block;
- clear: both;
- overflow: hidden;
- }
-/* end global settings*/
-
-/* header elements */
- .header .qtref
- {
- color: #00732F;
- font-weight: bold;
- font-size: 130%;
- }
-
- .header .content
- {
- margin-bottom: 0.5em
- }
-
- .header .breadcrumb
- {
- font-size: 90%;
- padding: 0.5em 0 0.5em 1em;
- margin: 0;
- background-color: #fafafa;
- height: 1.35em;
- border-bottom: 1px solid #d1d1d1;
- }
-
- .header .breadcrumb ul
- {
- margin: 0;
- padding: 0;
- }
-
- .header .content
- {
- word-wrap: break-word;
- }
-
- .header .breadcrumb ul li
- {
- float: left;
- background: url(../images/breadcrumb.png) no-repeat 0 3px;
- padding-left: 1.5em;
- margin-left: 1.5em;
- }
-
- .header .breadcrumb ul li.last
- {
- font-weight: normal;
- }
-
- .header .breadcrumb ul li a
- {
- color: #00732F;
- }
-
- .header .breadcrumb ul li.first
- {
- background-image: none;
- padding-left: 0;
- margin-left: 0;
- }
-
- .header .content ol li {
- background: none;
- margin-bottom: 1.0em;
- margin-left: 1.2em;
- padding-left: 0
- }
-
- .header .content li
- {
- background: url(../images/bullet_sq.png) no-repeat 0 5px;
- margin-bottom: 1em;
- padding-left: 1.2em;
- }
-
-/* end header elements */
-
-/* content elements */
- .content h1
- {
- font-weight: bold;
- font-size: 130%
- }
-
- .content h2
- {
- font-weight: bold;
- font-size: 120%;
- width: 100%;
- }
- .content h3
- {
- font-weight: bold;
- font-size: 110%;
- width: 100%;
- }
- .content table p
- {
- margin: 0
- }
- .content ul
- {
- padding-left: 2.5em;
- }
- .content li
- {
- padding-top: 0.25em;
- padding-bottom: 0.25em;
- }
- .content ul img {
- vertical-align: middle;
- }
-
- .content a:visited
- {
- color: #4c0033;
- text-decoration: none;
- }
-
- .content a:visited:hover
- {
- color: #4c0033;
- text-decoration: underline;
- }
-
- a:hover
- {
- color: #4c0033;
- text-decoration: underline;
- }
- descr p a
- {
- text-decoration: underline;
- }
-
- .descr p a:visited
- {
- text-decoration: underline;
- }
-
- .alphaChar{
- width:95%;
- background-color:#F6F6F6;
- border:1px solid #E6E6E6;
- -moz-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- font-size:12pt;
- padding-left:10px;
- margin-top:10px;
- margin-bottom:10px;
- }
- .flowList{
- /*vertical-align:top;*/
- /*margin:20px auto;*/
-
- column-count:3;
- -webkit-column-count:3;
- -moz-column-count:3;
-/*
- column-width:100%;
- -webkit-column-width:200px;
- -col-column-width:200px;
-*/
- column-gap:41px;
- -webkit-column-gap:41px;
- -moz-column-gap:41px;
-
- column-rule: 1px dashed #ccc;
- -webkit-column-rule: 1px dashed #ccc;
- -moz-column-rule: 1px dashed #ccc;
- }
-
- .flowList dl{
- }
- .flowList dd{
- /*display:inline-block;*/
- margin-left:10px;
- min-width:250px;
- line-height: 1.5;
- min-width:100%;
- min-height:15px;
- }
-
- .flowList dd a{
- }
-
- .content .flowList p{
- padding:0px;
- }
-
- .content .alignedsummary
- {
- margin: 15px;
- }
-
-
- .qmltype
- {
- text-align: center;
- font-size: 120%;
- }
- .qmlreadonly
- {
- padding-left: 5px;
- float: right;
- color: #254117;
- }
-
- .qmldefault
- {
- padding-left: 5px;
- float: right;
- color: red;
- }
-
- .qmldoc
- {
- }
-
- .generic .alphaChar{
- margin-top:5px;
- }
-
- .generic .odd .alphaChar{
- background-color: #F6F6F6;
- }
-
- .generic .even .alphaChar{
- background-color: #FFFFFF;
- }
-
- .memItemRight{
- padding: 0.25em 1.5em 0.25em 0;
- }
- .highlightedCode
- {
- margin: 1.0em;
- }
- .annotated td {
- padding: 0.25em 0.5em 0.25em 0.5em;
- }
-
- .toc
- {
- font-size: 80%
- }
-
- .header .content .toc ul
- {
- padding-left: 0px;
- }
-
- .content .toc h3 {
- border-bottom: 0px;
- margin-top: 0px;
- }
-
- .content .toc h3 a:hover {
- color: #00732F;
- text-decoration: none;
- }
-
- .content .toc .level2
- {
- margin-left: 1.5em;
- }
-
- .content .toc .level3
- {
- margin-left: 3.0em;
- }
-
- .content ul li
- {
- background: url(../images/bullet_sq.png) no-repeat 0 0.7em;
- padding-left: 1em
- }
-
- .content .toc li
- {
- background: url(../images/bullet_dn.png) no-repeat 0 5px;
- padding-left: 1em
- }
-
- .relpage
- {
- -moz-border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- border: 1px solid #DDDDDD;
- padding: 25px 25px;
- clear: both;
- }
- .relpage ul
- {
- float: none;
- padding: 1.5em;
- }
-
- h3.fn, span.fn
- {
- -moz-border-radius:7px 7px 7px 7px;
- -webkit-border-radius:7px 7px 7px 7px;
- border-radius:7px 7px 7px 7px;
- background-color: #F6F6F6;
- border-width: 1px;
- border-style: solid;
- border-color: #E6E6E6;
- font-weight: bold;
- word-spacing:3px;
- padding:3px 5px;
- }
-
- .functionIndex {
- font-size:12pt;
- word-spacing:10px;
- margin-bottom:10px;
- background-color: #F6F6F6;
- border-width: 1px;
- border-style: solid;
- border-color: #E6E6E6;
- -moz-border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- width:100%;
- }
-
- .centerAlign
- {
- text-align:center;
- }
-
- .rightAlign
- {
- text-align:right;
- }
-
- .leftAlign
- {
- text-align:left;
- }
-
- .topAlign{
- vertical-align:top
- }
-
- .functionIndex a{
- display:inline-block;
- }
-
-/* end content elements */
-/* footer elements */
-
- .footer
- {
- color: #393735;
- font-size: 0.75em;
- text-align: center;
- padding-top: 1.5em;
- padding-bottom: 1em;
- background-color: #E6E7E8;
- margin: 0;
- }
- .footer p
- {
- margin: 0.25em
- }
- .small
- {
- font-size: 0.5em;
- }
-/* end footer elements */
-
- .item {
- float: left;
- position: relative;
- width: 100%;
- overflow: hidden;
- }
-
-
- .item .primary {
- margin-right: 220px;
- position: relative;
- }
-
- .item hr {
- margin-left: -220px;
- }
-
- .item .secondary {
- float: right;
- width: 200px;
- position: relative;
- }
-
- .item .cols {
- clear: both;
- display: block;
- }
-
- .item .cols .col {
- float: left;
- margin-left: 1.5%;
- }
-
- .item .cols .col.first {
- margin-left: 0;
- }
-
- .item .cols.two .col {
- width: 45%;
- }
-
- .item .box {
- margin: 0 0 10px 0;
- }
-
- .item .box h3 {
- margin: 0 0 10px 0;
- }
-
- .cols.unclear {
- clear:none;
- }
-}
-
-/* end of screen media */
-
-/* start of print media */
-
-@media print
-{
- input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult
- {
- display: none;
- background: none;
- }
- .content
- {
- background: none;
- display: block;
- width: 100%; margin: 0; float: none;
- }
-}
-/* end of print media */
diff --git a/doc/config/style/qtmultimedia.css b/doc/config/style/qtmultimedia.css
deleted file mode 100644
index 282f596..0000000
--- a/doc/config/style/qtmultimedia.css
+++ /dev/null
@@ -1,160 +0,0 @@
-a:link, a:visited {
- color: #00732F;
- text-decoration: none;
- font-weight: bold;
-}
-
-body {
- font: normal 400 14px/1.2 Arial;
- margin-top: 85px;
-}
-
-h1 {
- margin: 0;
-}
-
-h2 {
- font: 500 20px/1.2 Arial;
-}
-
-h3.fn, span.fn {
- -moz-border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- background-color: #F6F6F6;
- border-width: 1px;
- border-style: solid;
- border-color: #E6E6E6;
- word-spacing: 3px;
- padding: 3px 5px;
-}
-
-table, pre {
- -moz-border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- background-color: #F6F6F6;
- border: 1px solid #E6E6E6;
- border-collapse: separate;
- font-size: 12px;
- line-height: 1.2;
- margin-bottom: 25px;
- margin-left: 15px;
-}
-
-table td {
- padding: 3px 15px 3px 20px;
-}
-
-table tr.even {
- background-color: white;
- color: #66666E;
-}
-
-table tr.odd {
- background-color: #F6F6F6;
- color: #66666E;
-}
-
-li {
- margin-bottom: 10px;
- padding-left: 12px;
-}
-
-.cpp {
- display: block;
- margin: 10;
- overflow: hidden;
- overflow-x: hidden;
- overflow-y: hidden;
- padding: 20px 0 20px 0;
-}
-
-.footer {
- margin-top: 50px;
-}
-
-.memItemLeft {
- padding-right: 3px;
-}
-
-.memItemRight {
- padding: 3px 15px 3px 0;
-}
-
-.qml {
- display: block;
- margin: 10;
- overflow: hidden;
- overflow-x: hidden;
- overflow-y: hidden;
- padding: 20px 0 20px 0;
-}
-
-.qmldefault {
- padding-left: 5px;
- float: right;
- color: red;
-}
-
-.qmlreadonly {
- padding-left: 5px;
- float: right;
- color: #254117;
-}
-
-.rightAlign {
- padding: 3px 5px 3px 10px;
- text-align: right;
-}
-
-.title {
- background-color: white;
- color: #44A51C;
- font-family: Verdana;
- font-size: 35px;
- font-weight: normal;
- left: 0;
- padding-bottom: 5px;
- padding-left: 16px;
- padding-top: 20px;
- position: absolute;
- right: 0;
- top: 0;
-}
-
-.toc {
- float: right;
- -moz-border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- background-color: #F6F6F6;
- border: 1px solid #DDD;
- margin: 0 20px 10px 10px;
- padding: 20px 15px 20px 20px;
- height: auto;
- width: 200px;
-}
-/* offset the child sections */
-.toc .level2 {
- margin-left: 15px;
-}
-.toc .level3 {
- margin-left: 30px;
-}
-.toc .level4 {
- margin-left: 40px;
-}
-
-/* modify the TOC layouts */
-div.toc ul {
- padding-left: 20px;
-}
-div.toc li {
- padding-left: 4px;
-}
-/* Remove the border around images*/
-a img
-{
- border:none;
-}
diff --git a/doc/config/style/style.css b/doc/config/style/style.css
deleted file mode 100644
index 128eb27..0000000
--- a/doc/config/style/style.css
+++ /dev/null
@@ -1,1627 +0,0 @@
-@media screen
-{
-
-/* basic elements */
- html
- {
- color: #000000;
- background: #FFFFFF;
- }
- body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td
- {
- margin: 0;
- padding: 0;
- }
- table
- {
- border-collapse: collapse;
- border-spacing: 0;
- }
- fieldset, img
- {
- border: 0;
- max-width:100%;
- }
- address, caption, cite, code, dfn, em, strong, th, var, optgroup
- {
- font-style: inherit;
- font-weight: inherit;
- }
- del, ins
- {
- text-decoration: none;
- }
- li
- {
- list-style: none;
- }
- ol li
- {
- list-style: decimal;
- }
- caption, th
- {
- text-align: left;
- }
- h1, h2, h3, h4, h5, h6
- {
- font-size: 100%;
- }
- q:before, q:after
- {
- content: '';
- }
- abbr, acronym
- {
- border: 0;
- font-variant: normal;
- }
- sup, sub
- {
- vertical-align: baseline;
- }
- tt, .qmlreadonly span, .qmldefault span
- {
- word-spacing:5px;
- }
- legend
- {
- color: #000000;
- }
- input, button, textarea, select, optgroup, option
- {
- font-family: inherit;
- font-size: inherit;
- font-style: inherit;
- font-weight: inherit;
- }
- input, button, textarea, select
- {
- font-size: 100%;
- }
- strong
- {
- font-weight: bold;
- }
- em
- {
- font-style: italic;
- }
-
- /* adding Qt theme */
- html
- {
- /* background-color: #e5e5e5;*/
- }
- body
- {
- background: #e6e7e8 url(../images/page_bg.png) repeat-x 0 0;
- font: normal 13px/1.2 Verdana;
- color: #363534;
- }
- a
- {
- color: #00732f;
- text-decoration: none;
- }
- hr
- {
- background-color: #E6E6E6;
- border: 1px solid #E6E6E6;
- height: 1px;
- width: 100%;
- text-align: left;
- margin: 15px 0px 15px 0px;
- }
-
- pre
- {
- border: 1px solid #DDDDDD;
- -moz-border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- margin: 0 20px 10px 10px;
- padding: 20px 15px 20px 20px;
- overflow-x: auto;
- }
- table, pre
- {
- -moz-border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- background-color: #F6F6F6;
- border: 1px solid #E6E6E6;
- border-collapse: separate;
- font-size: 11px;
- margin-bottom: 25px;
- }
- pre.highlightedCode {
- display: block;
- overflow:hidden;
- }
- thead
- {
- margin-top: 5px;
- font:600 12px/1.2 Arial;
- }
- th
- {
- padding: 5px 15px 5px 15px;
- background-color: #E1E1E1;
- border-left: 1px solid #E6E6E6;
- }
- td
- {
- padding: 3px 15px 3px 15px;
- }
- tr.odd td:hover, tr.even td:hover {}
-
- td.rightAlign
- {
- padding: 3px 5px 3px 10px;
- }
- table tr.odd
- {
- border-left: 1px solid #E6E6E6;
- background-color: #F6F6F6;
- color: #66666E;
- }
- table tr.even
- {
- border-left: 1px solid #E6E6E6;
- background-color: #ffffff;
- color: #66666E;
- }
- table tr.odd td:hover, table tr.even td:hover
- {
- /* background-color: #E6E6E6;*/ /* disabled until further notice */
- }
-
- div.float-left
- {
- float: left; margin-right: 2em
- }
- div.float-right
- {
- float: right; margin-left: 2em
- }
-
- span.comment
- {
- color: #008B00;
- font-style: italic
- }
- span.string, span.char
- {
- color: #000084;
- }
- span.number
- {
- color: #a46200;
- }
- span.operator
- {
- color: #202020;
- }
- span.keyword
- {
- color: #840000;
- }
- span.name
- {
- color: black
- }
- span.type
- {
- font-weight: bold
- }
- span.type a:visited
- {
- color: #0F5300;
- }
- span.preprocessor
- {
- color: #404040
- }
-/* end basic elements */
-
-/* font style elements */
- .heading
- {
- font: normal bold 16px/1.2 Arial;
- padding-bottom: 15px;
- }
- .subtitle
- {
- font-size: 13px;
- }
- .small-subtitle
- {
- font-size: 13px;
- }
-/* end font style elements */
-
-/* global settings*/
- .header, .footer, .wrapper
- {
- min-width: 600px;
- max-width: 1500px;
- margin: 0 30px;
- }
- .header, .footer
- {
- display: block;
- clear: both;
- overflow: hidden;
- }
- .header:after, .footer:after, .breadcrumb:after, .wrap .content:after, .group:after
- {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;
- }
-
-/* end global settings*/
-/* header elements */
- .header
- {
- height: 115px;
- position: relative;
- }
- .header .icon
- {
- position: absolute;
- top: 13px;
- left: 0;
- }
- .header .qtref
- {
- position: absolute;
- top: 28px;
- left: 88px;
- width: 302px;
- height: 22px;
- }
- .header .qtref span
- {
- display: block;
- width: 420px;
- height: 30px;
- text-indent: -999em;
- background: url(../images/sprites-combined.png) no-repeat -80px -235px;
- }
- .content a:visited
- {
- color: #4c0033;
- text-decoration: none;
- }
- .content a:visited:hover
- {
- color: #4c0033;
- text-decoration: underline;
- }
-
- #nav-topright
- {
- height: 70px;
- }
-
- #nav-topright ul
- {
- list-style-type: none;
- float: right;
- width: 370px;
- margin-top: 11px;
- }
-
- #nav-topright li
- {
- display: inline-block;
- margin-right: 20px;
- float: left;
- }
-
- #nav-topright li.nav-topright-last
- {
- margin-right: 0;
- }
-
- #nav-topright li a
- {
- background: transparent url(../images/sprites-combined.png) no-repeat;
- height: 18px;
- display: block;
- overflow: hidden;
- text-indent: -9999px;
- }
-
- #nav-topright li.nav-topright-home a
- {
- width: 65px;
- background-position: -2px -91px;
- }
-
- #nav-topright li.nav-topright-home a:hover
- {
- background-position: -2px -117px;
- }
-
-
- #nav-topright li.nav-topright-dev a
- {
- width: 30px;
- background-position: -76px -91px;
- }
-
- #nav-topright li.nav-topright-dev a:hover
- {
- background-position: -76px -117px;
- }
-
-
- #nav-topright li.nav-topright-labs a
- {
- width: 40px;
- background-position: -114px -91px;
- }
-
- #nav-topright li.nav-topright-labs a:hover
- {
- background-position: -114px -117px;
- }
-
- #nav-topright li.nav-topright-doc a
- {
- width: 32px;
- background-position: -162px -91px;
- }
-
- #nav-topright li.nav-topright-doc a:hover, #nav-topright li.nav-topright-doc-active a
- {
- background-position: -162px -117px;
- }
-
- #nav-topright li.nav-topright-blog a
- {
- width: 40px;
- background-position: -203px -91px;
- }
-
- #nav-topright li.nav-topright-blog a:hover, #nav-topright li.nav-topright-blog-active a
- {
- background-position: -203px -117px;
- }
-
- #nav-topright li.nav-topright-shop a
- {
- width: 40px;
- background-position: -252px -91px;
- }
-
- #nav-topright li.nav-topright-shop a:hover, #nav-topright li.nav-topright-shop-active a
- {
- background-position: -252px -117px;
- }
-
- #nav-logo
- {
- background: transparent url(../images/sprites-combined.png ) no-repeat 0 -225px;
- left: -3px;
- position: absolute;
- width: 75px;
- height: 75px;
- top: 13px;
- }
- #nav-logo a
- {
- width: 75px;
- height: 75px;
- display: block;
- text-indent: -9999px;
- overflow: hidden;
- }
-
-
- .shortCut-topleft-inactive
- {
- padding-left: 3px;
- padding-right: 3px;
- background: transparent url( ../images/sprites-combined.png) no-repeat 0px -58px;
- height: 20px;
- }
- .shortCut-topleft-inactive span
- {
- font-variant: normal;
- }
- .shortCut-topleft-inactive span a:hover, .shortCut-topleft-active a:hover
- {
- text-decoration:none;
- }
- #shortCut
- {
- padding-top: 10px;
- font-weight: bolder;
- color: #b0adab;
- }
- #shortCut ul
- {
- list-style-type: none;
- float: left;
- width: 347px;
- margin-left: 100px;
- }
- #shortCut li
- {
- display: inline-block;
- margin-right: 25px;
- float: left;
- white-space: nowrap;
- }
- #shortCut li a
- {
- color: #b0adab;
- }
- #shortCut li a:hover
- {
- color: #44a51c;
- }
-
-
-
-/* end header elements */
-/* content and sidebar elements */
- .wrapper
- {
- background: url(../images/bg_r.png) repeat-y 100% 0;
- }
- .wrapper .hd
- {
- padding-left: 216px;
- height: 15px;
- background: url(../images/page.png) no-repeat 0 0;
- overflow: hidden;
- }
-
-
-
-
- .wrapper .hd span
- {
- height: 15px;
- display: block;
- overflow: hidden;
- background: url(../images/page.png) no-repeat 100% -30px;
- }
- .wrapper .bd
- {
- background: url(../images/bg_l.png) repeat-y 0 0;
- position: relative;
- }
-
-
-
-
- .wrapper .ft
- {
- padding-left: 216px;
- height: 15px;
- background: url(../images/page.png) no-repeat 0 -75px;
- overflow: hidden;
- }
-
-
-
-
- .wrapper .ft span
- {
- height: 15px;
- display: block;
- background: url(../images/page.png) no-repeat 100% -60px;
- overflow: hidden;
- }
- .navTop{
- float:right;
- display:block;
- padding-right:15px;
-
-
- }
-
-
-
-/* end content and sidebar elements */
-/* sidebar elements */
- .sidebar
- {
- float: left;
- margin-left: 5px;
- width: 200px;
- font-size: 11px;
- }
-
-
-
-
-
-
- .sidebar .searchlabel
- {
- padding: 0 0 2px 17px;
- font: normal bold 11px/1.2 Verdana;
- }
-
- .sidebar .search
- {
- padding: 0 15px 0 16px;
- }
-
- .sidebar .search form
- {
- background: url(../images/sprites-combined.png) no-repeat -6px -348px;
- height:21px;
- padding:2px 0 0 5px;
- width:167px;
- }
-
- .sidebar .search form input#pageType
- {
- width: 158px;
- height: 19px;
- padding: 0;
- border: 0px;
- outline: none;
- font: 13px/1.2 Verdana;
- }
-
- .sidebar .box
- {
- padding: 17px 15px 5px 16px;
- }
-
- .sidebar .box .first
- {
- background-image: none;
- }
-
- .sidebar .box h2
- {
- font: bold 16px/1.2 Arial;
- padding: 0;
- }
- .sidebar .box h2 span
- {
- overflow: hidden;
- display: inline-block;
- }
- .sidebar .box#lookup h2
- {
- background-image: none;
- }
- .sidebar #lookup.box h2 span
- {
- }
- .sidebar .box#topics h2
- {
- background-image: none;
- }
- .sidebar #topics.box h2 span
- {
- }
- .sidebar .box#examples h2
- {
- background-image: none;
- }
- .sidebar #examples.box h2 span
- {
- }
-
- .sidebar .box .list
- {
- display: block;
- max-height:200px;
- min-height:120px;
- overflow-y:auto;
- overflow-x:none;
- }
- .list li a:hover
- {
- text-decoration: underline;
- }
- .sidebar .box ul
- {
- padding-bottom:5px;
- padding-left:10px;
- padding-top:5px;
- }
- .sidebar .box ul li
- {
- padding-left: 12px;
- background: url(../images/bullet_gt.png) no-repeat 0 5px;
- margin-bottom: 5px;
- }
- .sidebar .bottombar
- {
- background: url(../images/box_bg.png) repeat-x 0 bottom;
- }
- .sidebar .box ul li.noMatch
- {
- background: none;
- color:#FF2A00;
- font-style:italic;
- }
- .sidebar .box ul li.hit
- {
- background: none;
- color:#AAD2F0;
- font-style:italic;
- }
- .sidebar .search form input.loading
- {
- background:url("../images/spinner.gif") no-repeat scroll right center transparent;
- }
-
-.floatingResult{
- z-index:1;
- position:relative;
- padding-top:0px;
- background-color:white;
- border:solid 1px black;
- height:250px;
- width:600px;
- overflow-x:hidden;
- overflow-y:auto;
-}
-
- .floatingResult:hover{
- display:block;
- }
- .floatingResult:hover{
- }
-
-/* end sidebar elements */
-/* content elements */
- .wrap
- {
- margin: 0 5px 0 208px;
- overflow: visible;
- }
-
-
-
-
- .wrap .toolbar
- {
- background-color: #fafafa;
- border-bottom: 1px solid #d1d1d1;
- height: 20px;
- position: relative;
- }
- .wrap .toolbar .toolblock
- {
- position: absolute;
- }
- .wrap .toolbar .breadcrumb
- {
- font-size: 11px;
- line-height: 1.2;
- padding: 0 0 10px 21px;
- height: 10px;
- }
- .wrap .toolbar .toolbuttons
- {
- padding: 0 0 10px 21px;
- right: 5px;
- vertical-align: middle;
- overflow: hidden;
- }
- .wrap .toolbar .toolbuttons .active
- {
- color: #00732F;
- }
- .wrap .toolbar .toolbuttons ul
- {
- float: right;
- }
- .wrap .toolbar .toolbuttons li
- {
- float: left;
- text-indent: -10px;
- margin-top: -5px;
- margin-right: 15px;
- font-weight: bold;
- color: #B0ADAB;
- }
-
- .toolbuttons #print
- {
- border-left: 1px solid #c5c4c4;
- margin-top: 0;
- padding-left: 7px;
- text-indent: 0;
- }
- .toolbuttons #print a
- {
- width: 16px;
- height: 16px;
- }
-
- .toolbuttons #print a span
- {
- width: 16px;
- height: 16px;
- text-indent: -999em;
- display: block;
- overflow: hidden;
- background: url(../images/sprites-combined.png) no-repeat -137px -311px;
- }
-
- .toolbuttons #smallA
- {
- font-size: 10pt;
- }
- .toolbuttons #medA
- {
- font-size: 12pt;
- }
- .toolbuttons #bigA
- {
- font-size: 14pt;
- margin-right: 7px;
- }
-
- #smallA:hover, #medA:hover, #bigA:hover
- {
- color: #00732F;
- }
-
-
- .wrap .content
- {
- padding: 30px;
- word-wrap:break-word;
- }
-
- .wrap .breadcrumb ul
- {
- }
- .wrap .breadcrumb ul li
- {
- float: left;
- background: url(../images/breadcrumb.png) no-repeat 0 3px;
- padding-left: 15px;
- margin-left: 15px;
- font-weight: bold;
- }
- .wrap .breadcrumb ul li.last
- {
- font-weight: normal;
- }
- .wrap .breadcrumb ul li a
- {
- color: #363534;
- }
- .wrap .breadcrumb ul li.first
- {
- background-image: none;
- padding-left: 0;
- margin-left: 0;
- }
-
-
-
-
- .wrap .content ol li {
- background:none;
- font:normal 10pt/1.2 Verdana;
-
- margin-bottom:10px;
- margin-left:12px;
- /*list-style-type:disc;*/
- }
-
- .wrap .content ol li
- {
- background:none;
- margin-bottom: 10px;
- padding-left:0px;
- margin-left:52px;
- }
-
- .wrap .content li
- {
- background: url(../images/bullet_sq.png) no-repeat 0 5px;
- font: normal 400 10pt/1.2 Verdana;
- margin-bottom: 10px;
- padding-left:12px;
- }
-
- .content li:hover {}
-
- .wrap .content h1
- {
- font: bold 18px/1.2 Arial;
- }
- .wrap .content h2
- {
- border-bottom:1px solid #DDDDDD;
- font:600 16px/1.2 Arial;
- margin-top:15px;
- width:100%;
- }
- .wrap .content h3
- {
- font: bold 14px/1.2 Arial;
- font:600 16px/1.2 Arial;
- margin-top:15px;
- width:100%;
- }
- .wrap .content p
- {
- line-height: 20px;
- padding: 5px;
- }
- .wrap .content table p
- {
- line-height: 20px;
- /* padding: 0px;*/
- }
- .wrap .content ul
- {
- padding-left: 25px;
- padding-top: 10px;
- }
- .wrap .content ul img {
- vertical-align:middle;
- }
- a:hover
- {
- color: #4c0033;
- text-decoration: underline;
- }
- .feedback
- {
- float: none;
- position: absolute;
- right: 15px;
- bottom: 10px;
- font: normal 8px/1 Verdana;
- color: #B0ADAB;
- }
- .feedback:hover
- {
- float: right;
- font: normal 8px/1 Verdana;
- color: #00732F;
- text-decoration: underline;
- }
- .alphaChar{
- width:95%;
- background-color:#F6F6F6;
- border:1px solid #E6E6E6;
- -moz-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- font-size:12pt;
- padding-left:10px;
- margin-top:10px;
- margin-bottom:10px;
- }
- .flowList{
- /*vertical-align:top;*/
- /*margin:20px auto;*/
-
- column-count:3;
- -webkit-column-count:3;
- -moz-column-count:3;
-/*
- column-width:100%;
- -webkit-column-width:200px;
- -col-column-width:200px;
-*/
- column-gap:41px;
- -webkit-column-gap:41px;
- -moz-column-gap:41px;
-
- column-rule: 1px dashed #ccc;
- -webkit-column-rule: 1px dashed #ccc;
- -moz-column-rule: 1px dashed #ccc;
- }
-
- .flowList dl{
- }
- .flowList dd{
- /*display:inline-block;*/
- margin-left:10px;
- min-width:250px;
- line-height: 1.2;
- min-width:100%;
-
- }
-
- .flowList dd a{
- }
-
- .wrap .content .flowList p{
- padding:0px;
- }
-
- .content .alignedsummary
- {
- margin: 15px;
- }
-
-
- .qmltype
- {
- text-align: center;
- font-size: 160%;
- }
- .qmlreadonly
- {
- padding-left: 5px;
- float: right;
- color: #254117;
- }
-
- .qmldefault
- {
- padding-left: 5px;
- float: right;
- color: red;
- }
-
- .qmldoc
- {
- }
-
- *.qmlitem p
- {
- }
- #feedbackBox
- {
- display: none;
- -moz-border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- border: 1px solid #DDDDDD;
- position: fixed;
- top: 100px;
- left: 33%;
- height: 230px;
- width: 400px;
- padding: 5px;
- background-color: #e6e7e8;
- z-index: 4;
- }
- #feedcloseX
- {
- display: inline;
- padding: 5px 5px 0 0;
- margin-bottom: 3px;
- color: #363534;
- font-weight: bold;
- float: right;
- text-decoration: none;
- }
-
- #feedbox
- {
- display: inline;
- width: 370px;
- height: 120px;
- margin: 0px 25px 10px 15px;
- }
- #noteHead
- {
- font-weight:bold;
- padding:10px 10px 10px 20px;
- }
- #feedsubmit
- {
- display: inline;
- float: right;
- margin: 4px 32px 0 0;
- }
-
- .note
- {
- font-size:7pt;
- padding-bottom:3px;
- padding-left:20px;
- }
-
- #blurpage
- {
- display: none;
- position: fixed;
- float: none;
- top: 0px;
- left: 0px;
- right: 0px;
- bottom: 0px;
- background: transparent url(../images/feedbackground.png) 0 0;
- z-index: 3;
- }
- .toc
- {
- float: right;
- -moz-border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- background-color: #F6F6F6;
- border: 1px solid #DDDDDD;
- margin: 0 20px 10px 10px;
- padding: 20px 15px 20px 20px;
- height: auto;
- width: 200px;
- }
-
- .toc h3, .generic a
- {
- font: bold 12px/1.2 Arial;
- }
-
- .generic{
- }
- .generic td{
- /* padding:5px;*/
- }
- .generic .alphaChar{
- margin-top:5px;
- }
-
- .generic .odd .alphaChar{
- background-color: #F6F6F6;
- }
-
- .generic .even .alphaChar{
- background-color: #FFFFFF;
- }
-
- .alignedsummary{}
- .propsummary{}
- .memItemLeft{}
- .memItemRight{
- padding:3px 15px 3px 0;
- }
- .bottomAlign{}
- .highlightedCode
- {
- margin:10px;
- }
- .LegaleseLeft{}
- .valuelist{}
- .annotated td{
- padding: 3px 5px 3px 5px;
- }
- .obsolete{}
- .compat{}
- .flags{}
- .qmlsummary{}
- .qmlitem{}
- .qmlproto{}
- .qmlname{}
- .qmlreadonly{}
- .qmldefault{}
- .qmldoc{}
- .qt-style{}
- .redFont{}
- code{}
-
- .wrap .content .toc ul
- {
- padding-left: 0px;
- }
-
- .wrap .content .toc h3{
- border-bottom:0px;
- margin-top:0px;
- }
-
- .wrap .content .toc h3 a:hover{
- color:#00732F;
- text-decoration:none;
- }
-
-
- .wrap .content .toc .level2
- {
- margin-left: 15px;
- }
-
- .wrap .content .toc .level3
- {
- margin-left: 30px;
- }
-
- .content .toc li
- {
- font: normal 10px/1.2 Verdana;
- background: url(../images/bullet_dn.png) no-repeat 0 5px;
- }
- .relpage
- {
- -moz-border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- border: 1px solid #DDDDDD;
- padding: 25px 25px;
- clear: both;
- }
- .relpage ul
- {
- float: none;
- padding: 15px;
- }
- .content .relpage li
- {
- font: normal 11px/1.2 Verdana;
- }
- h3.fn, span.fn
- {
- -moz-border-radius:7px 7px 7px 7px;
- -webkit-border-radius:7px 7px 7px 7px;
- border-radius:7px 7px 7px 7px;
- background-color: #F6F6F6;
- border-width: 1px;
- border-style: solid;
- border-color: #E6E6E6;
- font-weight: bold;
- word-spacing:3px;
- padding:3px 5px;
- }
-
- .functionIndex {
- font-size:12pt;
- word-spacing:10px;
- margin-bottom:10px;
- background-color: #F6F6F6;
- border-width: 1px;
- border-style: solid;
- border-color: #E6E6E6;
- -moz-border-radius: 7px 7px 7px 7px;
- -webkit-border-radius: 7px 7px 7px 7px;
- border-radius: 7px 7px 7px 7px;
- width:100%;
- }
-
- .centerAlign
- {
- text-align:center;
- }
-
- .rightAlign
- {
- text-align:right;
- }
-
-
- .leftAlign
- {
- text-align:left;
- }
-
- .topAlign{
- vertical-align:top
- }
-
- .functionIndex a{
- display:inline-block;
- }
-
-/* end content elements */
-/* footer elements */
-
- .footer
- {
- min-height: 100px;
- color: #797775;
- font: normal 9px/1 Verdana;
- text-align: center;
- padding-top: 40px;
- background-color: #E6E7E8;
- margin: 0;
- }
-/* end footer elements */
-
-
-
-
- /* start index box */
- .indexbox
- {
- width: 100%;
- display:inline-block;
- }
-
- .indexboxcont
- {
- display: block;
-
- }
-
- .indexboxbar
- {
- background: transparent url(../images/horBar.png ) repeat-x left bottom;
- margin-bottom: 25px;
-
-
- }
-
- .indexboxcont .section
- {
- display: inline-block;
- width: 49%;
- *width:42%;
- _width:42%;
- padding:0 2% 0 1%;
- vertical-align:top;
-
-}
-
- .indexboxcont .indexIcon
- {
- width: 11%;
- *width:18%;
- _width:18%;
- overflow:hidden;
-
-}
-
-.indexboxcont .section {
- float: left;
-}
-
- .indexboxcont .section p
- {
- padding-top: 20px;
- padding-bottom: 20px;
- }
- .indexboxcont .sectionlist
- {
- display: inline-block;
- vertical-align:top;
- width: 32.5%;
- padding: 0;
- }
- .indexboxcont .sectionlist ul
- {
- margin-bottom: 20px;
- }
-
- .indexboxcont .sectionlist ul li
- {
- line-height: 12px;
- }
-
- .content .indexboxcont li
- {
- font: normal bold 13px/1 Verdana;
- }
-
- .indexbox a:hover, .indexbox a:visited:hover
- {
- color: #4c0033;
- text-decoration: underline;
- }
-
- .indexbox a:visited
- {
- color: #00732f;
- text-decoration: none;
- }
-
- .indexbox .indexIcon {
- width: 11%;
- }
-
-
- .indexbox .indexIcon span
- {
- display: block;
- }
-
- .indexbox.guide .indexIcon span
- {
- width: 96px;
- height: 137px;
- background: url(../images/sprites-combined.png) no-repeat -5px -376px;
- padding: 0;
- }
-
- .indexbox.tools .indexIcon span
- {
- width: 115px;
- height: 137px;
- background: url(../images/sprites-combined.png) no-repeat -111px -376px;
- padding: 0;
- }
- .indexboxcont:after
- {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;
- }
-
-
-
-/* start of creator spec*/
- .creator
- {
- margin-left:0px;
- margin-right:0px;
- padding-left:0px;
- padding-right:0px;
- }
- .creator .wrap .content ol li {
- list-style-type:decimal;
-
- }
- .creator .header .icon,
- .creator .feedback,
- .creator .t_button,
- .creator .feedback,
- .creator #feedbackBox,
- .creator #feedback,
- .creator #blurpage,
- /*.creator .indexbox .indexIcon span,*/
- .creator .wrapper .hd,
-/* .creator .indexbox .indexIcon,*/
- .creator .header #nav-logo,
- .creator #offlinemenu,
- .creator #offlinesearch,
- .creator .header #nav-topright,
- .creator .header #shortCut ,
- .creator .wrapper .hd,
- .creator .wrapper .ft,
- .creator .sidebar,
- .creator .wrap .feedback
- {
- display:none;
- }
-
- body.creator
- {
- background: none;
-
- font: normal 13px/1.2 Verdana;
- color: #363534;
- background-color: #FAFAFA;
- }
-
- .wrap .content ol li {
-
- }
-
-
- .creator .header, .footer, .wrapper
- {
- max-width: 1500px;
- margin: 0px;
- }
-
- .creator .wrapper
- {
- position:relative;
- top:5px;
- }
- .creator .wrapper .bd
- {
-
- background:#FFFFFF;
- }
-
-
- .creator .header, .footer
- {
- display: block;
- clear: both;
- overflow: hidden;
- }
- .creator .wrap .content p
-
- {
- line-height: 20px;
- padding: 5px;
- }
-
- .creator .header .qtref span
- {
- background:none;
- }
-
-
-
- .creator .footer
- {
- border-top:1px solid #E5E5E5;
- height: 50px;
- margin:0px;
- padding:10px;
- }
-
- .creator .footer p
- {
- text-align:justify;
- max-width:900px;
- }
-
- .creator .wrap
- {
-
- padding:0 5px 0 5px;
- margin: 0px;
- }
- .creator .wrap .toolbar
- {
-
-
- border-bottom:1px solid #E5E5E5;
- /*width:100%;*/
- margin-left:-5px;
- margin-right:-5px;
- }
- .creator .wrap .breadcrumb ul li a
- {
- /* color: #363534;*/
- color: #00732F;
- }
-
- .creator .wrap .content
- {
- padding: 0px;
- word-wrap:break-word;
- }
-
- .creator .wrap .content ol li {
- background:none;
- font: inherit;
- padding-left: 0px;
- }
-
- .creator .wrap .content .descr ol li {
- margin-left: 45px;
-
- }
- .creator .content .alignedsummary
- {
- margin: 5px;
- width:100%;
- }
- .creator .generic{
- max-width:75%;
- }
- .creator .generic td{
- /* padding:0;*/
- }
- .creator .indexboxbar
- {
- border-bottom:1px solid #E5E5E5;
- margin-bottom: 25px;
- background: none;
- }
-
-
-
- .creator .header
- {
- width: 100%;
- margin: 0;
- height: auto;
- background-color: #ffffff;
- padding: 10px 0 5px 0;
- overflow: visible;
- border-bottom: solid #E5E5E5 1px;
- z-index:1;
-
-
-
-
-
-
-
-
- /* position:fixed;*/
- }
-
-
- .creator .header .content
- {
- }
- .creator .header .qtref
- {
- color: #00732F;
- position: static;
- float: left;
- margin-left: 5px;
- font: bold 18px/1 Arial;
- }
-
- .creator .header .qtref:visited
- {
- color: #00732F;
- }
- .creator .header .qtref:hover
- {
- color: #00732F;
- text-decoration:none;
- }
- .creator .header .qtref span
- {
- background-image: none;
- text-indent: 0;
- text-decoration:none;
- }
-
-
-
-
-
-
- .creator .wrap .toolbar
- {
- display:block;
- padding-top:0px;
- }
-
-
-
- .creator .wrap .breadcrumb ul li {
- font-weight: normal;
- }
-
- .creator .wrap .breadcrumb ul li a {
- /*color: #44a51c;*/
- }
-
- .creator .wrap .breadcrumb ul li.last a {
- /*color: #363534;*/
- }
-
- .creator #narrowmenu ul
- {
- border-bottom:solid 1px #E5E5E5;
- border-left:solid 1px #E5E5E5;
- border-right:solid 1px #E5E5E5;
- }
-
- .creator #narrowmenu li ul {
- margin-top:-15px;
- }
-
-
- .creator .toc {
- margin:10px 20px 10px 10px;
- }
-
- .creator #narrowsearch, .creator #narrowmenu{
- display:none;
- }
-/* end of creator spec*/
-
-}
-
-/* end of screen media */
-
-/* start of print media */
-
-@media print
-{
- input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult
- {
- display: none;
- background: none;
- }
- .content
- {
- background: none;
- display: block;
- width: 100%; margin: 0; float: none;
-
- }
-}
-/* end of print media */
diff --git a/doc/config/style/style_ie6.css b/doc/config/style/style_ie6.css
deleted file mode 100644
index 16fb850..0000000
--- a/doc/config/style/style_ie6.css
+++ /dev/null
@@ -1,54 +0,0 @@
-.indexbox, .indexboxcont, .group {
- zoom: 1;
- height: 1%;
-}
-
-.sidebar {
- margin-left: 3px;
- width: 199px;
- overflow: hidden;
-}
-
-.sidebar .search form {
- position: relative;
-}
-
-.sidebar .search form fieldset {
- position: absolute;
- margin-top: -1px;
-}
-
-.sidebar .search form input#searchstring {
- border: 1px solid #fff;
- height: 18px;
-}
-
-.wrap {
- zoom: 1;
-}
-
-.content,
-.toolbar {
- zoom: 1;
- margin-left: -3px;
- position: relative;
-}
-
-.indexbox {
- clear: both;
-}
-
-.indexboxcont .section {
- zoom: 1;
- float: left;
-}
-
-.indexboxcont .sectionlist {
- zoom: 1;
- float: left;
-}
-
-.wrap .toolbar .toolbuttons li {
- text-indent: 0;
- margin-right: 8px;
-} \ No newline at end of file
diff --git a/doc/config/style/style_ie7.css b/doc/config/style/style_ie7.css
deleted file mode 100644
index afbff5f..0000000
--- a/doc/config/style/style_ie7.css
+++ /dev/null
@@ -1,19 +0,0 @@
-.indexbox, .indexboxcont, .group {
- min-height: 1px;
-}
-
-.sidebar .search form input#searchstring {
- border: 1px solid #fff;
- height: 17px;
-}
-
-
-.indexboxcont .section {
- zoom: 1;
- float: left;
-}
-
-.indexboxcont .sectionlist {
- zoom: 1;
- float: left;
-}
diff --git a/doc/config/style/style_ie8.css b/doc/config/style/style_ie8.css
deleted file mode 100644
index e69de29..0000000
--- a/doc/config/style/style_ie8.css
+++ /dev/null
diff --git a/doc/config/style/superfish.css b/doc/config/style/superfish.css
deleted file mode 100644
index 2bdaef4..0000000
--- a/doc/config/style/superfish.css
+++ /dev/null
@@ -1,51 +0,0 @@
-.sf-menu, .sf-menu * {
- margin: 0;
- padding: 0;
- list-style: none;
-}
-.sf-menu {
- line-height: 1.0;
-}
-.sf-menu ul {
- position: absolute;
- top: -999em;
- width: 10em; /* left offset of submenus need to match (see below) */
-}
-.sf-menu ul li {
- width: 100%;
-}
-.sf-menu li:hover {
- visibility: inherit; /* fixes IE7 'sticky bug' */
-}
-.sf-menu li {
- float: left;
- position: relative;
-}
-.sf-menu a {
- display: block;
- position: relative;
-}
-.sf-menu li:hover ul,
-.sf-menu li.sfHover ul {
- left: 0;
- top: 2.5em; /* match top ul list item height */
- z-index: 99;
-}
-ul.sf-menu li:hover li ul,
-ul.sf-menu li.sfHover li ul {
- top: -999em;
-}
-ul.sf-menu li li:hover ul,
-ul.sf-menu li li.sfHover ul {
- left: 10em; /* match ul width */
- top: 0;
-}
-ul.sf-menu li li:hover li ul,
-ul.sf-menu li li.sfHover li ul {
- top: -999em;
-}
-ul.sf-menu li li li:hover ul,
-ul.sf-menu li li li.sfHover ul {
- left: 10em; /* match ul width */
- top: 0;
-}
diff --git a/doc/doc.pri b/doc/doc.pri
deleted file mode 100644
index 285a887..0000000
--- a/doc/doc.pri
+++ /dev/null
@@ -1,31 +0,0 @@
-
-win32:!win32-g++ {
- unixstyle = false
-} else:win32-g++:isEmpty(QMAKE_SH) {
- unixstyle = false
-} else {
- unixstyle = true
-}
-
-LINE_SEP=$$escape_expand(\\n\\t)
-GENERATOR = $$[QT_INSTALL_BINS]/qhelpgenerator
-QDOC = $$[QT_INSTALL_BINS]/qdoc3
-MOBILITY_DOCUMENTATION = $$QDOC $${QT_MOBILITY_SOURCE_TREE}/doc/config/qtmobility.qdocconf $$LINE_SEP \
- cd $${QT_MOBILITY_SOURCE_TREE} && \
- $$GENERATOR doc/html/qtmobility.qhp -o doc/qch/qtmobility.qch
-
-ONLINE_MOBILITY_DOCUMENTATION = $$QDOC $${QT_MOBILITY_SOURCE_TREE}/doc/config/qtmobility-online.qdocconf $$LINE_SEP \
- cd $${QT_MOBILITY_SOURCE_TREE} && \
- $$GENERATOR doc/html/qtmobility.qhp -o doc/qch/qtmobility.qch
-
-contains(unixstyle, false):MOBILITY_DOCUMENTATION = $$replace(MOBILITY_DOCUMENTATION, "/", "\\")
-
-# Build rules
-qch_docs.commands = $$MOBILITY_DOCUMENTATION
-qch_onlinedocs.commands = $$ONLINE_MOBILITY_DOCUMENTATION
-
-docs.depends = qch_docs
-onlinedocs.depends = qch_onlinedocs
-
-
-QMAKE_EXTRA_TARGETS += qch_docs qch_onlinedocs docs onlinedocs
diff --git a/doc/doc.pro b/doc/doc.pro
deleted file mode 100644
index d0e0ed4..0000000
--- a/doc/doc.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-######################################################################
-#
-# Mobility API project
-#
-######################################################################
-
-TEMPLATE = subdirs
-SUBDIRS += src/snippets
diff --git a/doc/src/camera.qdoc b/doc/src/camera.qdoc
deleted file mode 100644
index 36b8e9a..0000000
--- a/doc/src/camera.qdoc
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 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$
-**
-****************************************************************************/
-
-/*!
-
-\page camera.html
-
-\title Camera
-\brief An API to control camera devices.
-
-The Camera API provides control of system camera devices. Providing support
-for still or video image capture with sound support.
-
-\tableofcontents
-
-
-\section1 Namespace
-
-The QtMobility APIs are placed into the \i{QtMobility} namespace. This is done
-to facilitate the future migration of QtMobility APIs into Qt. See the
-\l {Quickstart guide} for an example on how the
-namespace impacts on application development.
-
-
-\section1 Overview
-
-The Camera API allows high level control of various aspects of still images
-and video. Camera is a part of the Multimedia API and this relationship is
-apparent when you notice that certain core classes are subclassed from some
-Multimedia base classes including \l QMediaObject and \l QMediaControl.
-
-
-
-\section1 Still Images
-
-In order to capture an image we need to create a \l QCamera object and use
-it to initialize a \l QVideoWidget, so we can see where the camera is
-pointing - a viewfinder. The camera object is also used to initialize a new
-QCameraImageCapture object, imageCapture. All that is then needed is to start
-the camera, lock it so that the settings are not changed while the image
-capture occurs, capture the image, and finally unlock the camera ready for
-the next photo.
-
- \code
- camera = new QCamera;
- viewFinder = new QCameraViewfinder;
- camera->setViewfinder(viewFinder);
- viewFinder->show();
-
- imageCapture = new QCameraImageCapture(camera);
-
- camera->setCaptureMode(QCamera::CaptureStillImage);
- camera->start();
-
- //on half pressed shutter button
- camera->searchA{QCameraFocus::FocusMode}{ndLock();
-
- //on shutter button pressed
- imageCapture->capture();
-
- //on shutter button released
- camera->unlock();
- \endcode
-
-Alternatively, we could have used a QGraphicsVideoItem as a viewfinder.
-
-
-\section1 Video Clips
-
-Previously we saw code that allowed the capture of a still image. Recording
-video requires the use of a \l QMediaRecorder object and a \l
-QAudioCaptureSource for sound.
-
-To record video we need to create a camera object as before but this time as
-well as creating a viewfinder, we will also initialize a media recorder object.
-
- \code
- camera = new QCamera;
- mediaRecorder = new QMediaRecorder(camera);
-
- camera->setCaptureMode(QCamera::CaptureVideo);
- camera->start();
-
- //on shutter button pressed
- mediaRecorder->record();
- \endcode
-
-Signals from the \i mediaRecorder can be connected to slots to react to
-changes in the state of the recorder or error events. Recording itself
-starts with the \l {QMediaRecorder::record()}{record()} function of
-mediaRecorder being called, this causes the signal \l
-{QMediaRecorder::stateChanged()}{stateChanged()} to be emitted. The
-recording process can be changed with the \l {QMediaRecorder::record()}{record()},
-\l {QMediaRecorder::pause()}{pause()}, \l {QMediaRecorder::stop()}{stop()} and
-\l {QMediaRecorder::setMuted()}{setMuted()} slots in \l QMediaRecorder.
-
-When the camera is in video mode, as decided by the application, then as the
-shutter button is pressed the camera is locked as before but instead the
-\l {QMediaRecorder::record()}{record()} function in \l QMediaRecorder is used.
-
-
-
-\section1 Focus
-
-Focusing is managed by the classes \l QCameraFocus and \l QCameraFocusControl.
-QCameraFocus allows the developer to set the general policy by means of the
-enums for the \l {QCameraFocus::FocusMode}{FocusMode} and the
-\l {QCameraFocus::FocusPointMode}{FocusPointMode}. \l {QCameraFocus::FocusMode}{FocusMode}
-deals with settings such as \l {QCameraFocus::FocusMode}{AutoFocus},
-\l {QCameraFocus::FocusMode}{ContinuousFocus} and \l {QCameraFocus::FocusMode}{InfinityFocus}, whereas \l {QCameraFocus::FocusMode}{FocusPointMode} deals with the various focus zones within the view. \l {QCameraFocus::FocusMode}{FocusPointMode} has support for face recognition, center focus and a custom
-focus where the focus point can be specified.
-
-
-
-\section1 Cancelling Asynchronous Operations
-
-Various operations such as image capture and auto focusing occur
-asynchrously. These operations can often be cancelled by the start of a new
-operation as long as this is supported by the backend. For image capture,
-the operation can be cancelled by calling
-\l {QCameraImageCapture::cancelCapture()}{cancelCapture()}. For AutoFocus,
-autoexposure or white balance cancellation can be done by calling
-\i {QCamera::unlock(QCamera::LockFocus)}.
-
-
-
-\section1 Camera Controls
-
- \table
- \header
- \o Control Name
- \o Description
- \row
- \o camera
- \o the interface for system camera devices
- \row
- \o exposure
- \o Includes: flash mode; flash power; metering mode; aperture; shutter speed, iso setting
- \row
- \o focus
- \o Includes: optical zoom; digital zoom; focus point; focus zones
- \row
- \o image processing
- \o white balance; contrast; saturation; sharpen; denoise
- \row
- \o locks
- \o handles the locking and unlocking of camera devices
- \endtable
-
-
-\section1 Classes
-\annotatedlist camera
-
-
-*/
-
-
diff --git a/doc/src/classic.css b/doc/src/classic.css
deleted file mode 100644
index b8cae8e..0000000
--- a/doc/src/classic.css
+++ /dev/null
@@ -1,284 +0,0 @@
-BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
- font-family: Arial, Geneva, Helvetica, sans-serif;
-}
-H1 {
- text-align: center;
- font-size: 160%;
-}
-H2 {
- font-size: 120%;
-}
-H3 {
- font-size: 100%;
-}
-
-h3.fn,span.fn
-{
- background-color: #eee;
- border-width: 1px;
- border-style: solid;
- border-color: #ddd;
- font-weight: bold;
- padding: 6px 0px 6px 10px;
- margin: 42px 0px 0px 0px;
-}
-
-hr {
- border: 0;
- color: #a0a0a0;
- background-color: #ccc;
- height: 1px;
- width: 100%;
- text-align: left;
- margin: 34px 0px 34px 0px;
-}
-
-table.valuelist {
- border-width: 1px 1px 1px 1px;
- border-style: solid;
- border-color: #dddddd;
- border-collapse: collapse;
- background-color: #f0f0f0;
-}
-
-table.indextable {
- border-width: 1px 1px 1px 1px;
- border-style: solid;
- border-collapse: collapse;
- background-color: #f0f0f0;
- border-color:#555;
- font-size: 100%;
-}
-
-table td.largeindex {
- border-width: 1px 1px 1px 1px;
- border-collapse: collapse;
- background-color: #f0f0f0;
- border-color:#555;
- font-size: 120%;
-}
-
-table.valuelist th {
- border-width: 1px 1px 1px 2px;
- padding: 4px;
- border-style: solid;
- border-color: #666;
- color:white;
- background-color:#666;
-}
-
-th.titleheader {
- border-width: 1px 0px 1px 0px;
- padding: 2px;
- border-style: solid;
- border-color: #666;
- color:white;
- background-color:#555;
- background-image:url('images/gradient.png')};
- background-repeat: repeat-x;
- font-size: 100%;
-}
-
-
-th.largeheader {
- border-width: 1px 0px 1px 0px;
- padding: 4px;
- border-style: solid;
- border-color: #444;
- color:white;
- background-color:#555555;
- font-size: 120%;
-}
-
-p {
-
- margin-left: 4px;
- margin-top: 8px;
- margin-bottom: 8px;
-}
-
-a:link
-{
- color: #0046ad;
- text-decoration: none
-}
-
-a:visited
-{
- color: #672967;
- text-decoration: none
-}
-
-a.obsolete
-{
- color: #661100;
- text-decoration: none
-}
-
-a.compat
-{
- color: #661100;
- text-decoration: none
-}
-
-a.obsolete:visited
-{
- color: #995500;
- text-decoration: none
-}
-
-a.compat:visited
-{
- color: #995500;
- text-decoration: none
-}
-
-body
-{
- background: #ffffff;
- color: black
-}
-
-table.generic, table.annotated
-{
- border-width: 1px;
- border-color:#bbb;
- border-style:solid;
- border-collapse:collapse;
-}
-
-table td.memItemLeft {
- width: 180px;
- padding: 2px 0px 0px 8px;
- margin: 4px;
- border-width: 1px;
- border-color: #E0E0E0;
- border-style: none;
- font-size: 100%;
- white-space: nowrap
-}
-
-table td.memItemRight {
- padding: 2px 8px 0px 8px;
- margin: 4px;
- border-width: 1px;
- border-color: #E0E0E0;
- border-style: none;
- font-size: 100%;
-}
-
-table tr.odd {
- background: #f0f0f0;
- color: black;
-}
-
-table tr.even {
- background: #e4e4e4;
- color: black;
-}
-
-table.annotated th {
- padding: 3px;
- text-align: left
-}
-
-table.annotated td {
- padding: 3px;
-}
-
-table tr pre
-{
- padding-top: 0px;
- padding-bottom: 0px;
- padding-left: 0px;
- padding-right: 0px;
- border: none;
- background: none
-}
-
-tr.qt-style
-{
- background: #96E066;
- color: black
-}
-
-body pre
-{
- padding: 0.2em;
- border: #e7e7e7 1px solid;
- background: #f1f1f1;
- color: black
-}
-
-table tr.qt-code pre
-{
- padding: 0.2em;
- border: #e7e7e7 1px solid;
- background: #f1f1f1;
- color: black
-}
-
-span.preprocessor, span.preprocessor a
-{
- color: darkblue;
-}
-
-span.comment
-{
- color: darkred;
- font-style: italic
-}
-
-span.string,span.char
-{
- color: darkgreen;
-}
-
-.title
-{
- text-align: center
-}
-
-.subtitle
-{
- font-size: 0.8em
-}
-
-.small-subtitle
-{
- font-size: 0.65em
-}
-
-.qmlitem {
- padding: 0;
-}
-
-.qmlname {
- white-space: nowrap;
-}
-
-.qmltype {
- text-align: center;
- font-size: 160%;
-}
-
-.qmlproto {
- background-color: #eee;
- border-width: 1px;
- border-style: solid;
- border-color: #ddd;
- font-weight: bold;
- padding: 6px 10px 6px 10px;
- margin: 42px 0px 0px 0px;
-}
-
-.qmlreadonly {
- float: right;
- color: red
-}
-
-.qmldoc {
-}
-
-*.qmlitem p {
-}
diff --git a/doc/src/examples/audiodevices.qdoc b/doc/src/examples/audiodevices.qdoc
deleted file mode 100644
index 5f32693..0000000
--- a/doc/src/examples/audiodevices.qdoc
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 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$
-**
-****************************************************************************/
-
-/*!
- \example audiodevices
- \title Audio Devices Example
-
-
-
- This example shows how to create a simple application to list and test
- the configuration for the various audio devices available on the device
- or machine. This is done using the QtMobility Multimedia API.
-
- \image audiodevices.png
-
-*/
-
-
diff --git a/doc/src/examples/audiorecorder.qdoc b/doc/src/examples/audiorecorder.qdoc
deleted file mode 100644
index 3c0dcd2..0000000
--- a/doc/src/examples/audiorecorder.qdoc
+++ /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 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$
-**
-****************************************************************************/
-
-/*!
- \example audiorecorder
- \title Audio Recorder Example
-
-
-
- This example shows how to create a simple audio recorder using the QtMobility
- Multimedia API.
-
- We can easily setup the capture when we create the objects using a
- QMediaRecorder initialized with a QAudioCaptureSource object.
-
- \snippet snippets/multimedia-snippets/audiorecorder.cpp create-objs-1
-
- Then we set up the display of a list of available sources to use
-
- \snippet snippets/multimedia-snippets/audiorecorder.cpp device-list
-
- And available codecs
-
- \snippet snippets/multimedia-snippets/audiorecorder.cpp codec-list
-
- We display a dialog for the user to select the appropriate codec and the
- input device to capture. Once selected we can use user interface objects
- like buttons to start and stop the recording and display elapsed time.
-
- \snippet snippets/multimedia-snippets/audiorecorder.cpp get-device
-
- Then use signals to indicate a change to the output filename, the codec
- and the audio source.
-
- When the button to record is pushed the toggleRecord() slot will start
- or stop the recording process using the \l{QMediaRecorder::record()}
- and \l{QMediaRecorder::stop()} functions of the QMediaRecorder object.
-
- \snippet snippets/multimedia-snippets/audiorecorder.cpp toggle-record
-
-
-*/
-
-
diff --git a/doc/src/examples/camera.qdoc b/doc/src/examples/camera.qdoc
deleted file mode 100644
index 455e45f..0000000
--- a/doc/src/examples/camera.qdoc
+++ /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 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$
-**
-****************************************************************************/
-
-
-
-/*!
-
-\example camera
-\title Camera Example
-\brief The Camera Example shows how to use the API to capture a still image
-or video.
-
-
-
-The Camera Example demonstrates how you can use QtMultimedia to implement
-some basic Camera functionality to take still images and record video clips
-with audio.
-
-A Camera class is created that will act as our Camera. It has a user interface,
-control functions, setting values and a means of defining the location where
-the image or video clip is to be saved. It will also store the image and video
-settings.
-
-The Camera class contains an instance of \l {QCamera}, the API class interface to
-the hardware. It also has an instance of \l {QCameraImageCapture} to take still images
-and an instance of \l {QMediaRecorder} to record video. It also contains the user
-interface object.
-
-The Camera constructor does some basic initialization. The camera object is
-set to '0', the user interface is initialized and UI signal are connected to
-slots that react to the triggering event. However, most of the work is done when
-the \i {setCamera()} function is called, passing in a \l {QByteArray}.
-
-\i {setCamera()} sets up various connections between the user interface and the functionality
-of the Camera class using signals and slots. It also instantiates and initializes the \l {QCamera},
-\l {QCameraImageCapture} and \l {QMediaRecorder} objects mentioned above. The still
-and video recording visual tabs are enabled and finally the
-\l {QCamera::start()}{start()} function of the \l{QCamera} object is called.
-
-Now that the camera is ready for user commands it waits for a suitable event.
-Such an event will be the key press of either the \l {Qt::Key_CameraFocus} or
-\l {Qt::Key_Camera} buttons on the application window. Camera focus will
-simply display the viewfinder and lock the camera settings. Key_Camera will
-either call \i {takeImage()} if the \l {QCamera::captureMode()}{captureMode()}
-is QCamera::CaptureStillImage, or if the capture mode is for video then one
-of two actions will occur. If the recording state shows that we are currently
-recording then the \i {stop()} function is called resulting in a call to
-\l {QCamera::stop()}, whereas if we are not recording then a video recording
-is started with a call to \l {QMediaRecorder::record()}.
-
-\image camera-example.png
-
-*/
-
-
diff --git a/doc/src/examples/declarative-camera.qdoc b/doc/src/examples/declarative-camera.qdoc
deleted file mode 100644
index 9e0ca5d..0000000
--- a/doc/src/examples/declarative-camera.qdoc
+++ /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 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$
-**
-****************************************************************************/
-
-/*!
-\example declarative-camera
-\title QML Camera Example
-
-\brief The Camera Example shows how to use the API to capture a still image
-or video.
-
-\image qml-camera.png
-
-This example demonstrates the basic use of the Camera QML Plugin elements. The
-plugin provides access to the API functionality for camera settings and
-capturing an image.
-
-Most of the QML code supports the user interface for this application with the
-Camera elements being mostly found in \i {declarative-camera.qml} and
-\i {CaptureControls.qml}.
-
-In \i {declarative-camera.qml} the Camera element is initialized with an id
-of \i {camera }, a photo preview is setup, states are implemented for image
-preview or capture and a CaptureControls element is initialized. The initial
-\i state is \i PhotoCapture. The camera element includes a handler, \i onImageCaptured,
-for the \l {imageCaptured} signal. The handler sets up the application to process
-the preview including a change in the user interface state. The PhotoPreview
-element now becomes visible with any key press being picked up by the handler
-in PhotoPreview and returning the state to \i PhotoCapture.
-
-The \i CaptureControls element, which is implemented in \i {CaptureControls.qml},
-generates a column on the right hand side of the screen which includes control
-buttons for \i focus (not initially visible), \i {capture}, \i {flash modes},
-\i {white balance}, \i {exposure compensation}, and if a preview is
-available a \i {preview} button. The last button exits from the application.
-
-When the Capture button is pressed the \i onClicked handler calls
-\l {Camera::captureImage()}{captureImage()}
-
-
-
-
-
-
-
-*/
diff --git a/doc/src/examples/hapticsplayer.qdoc b/doc/src/examples/hapticsplayer.qdoc
deleted file mode 100644
index 25a6b5f..0000000
--- a/doc/src/examples/hapticsplayer.qdoc
+++ /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 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$
-**
-****************************************************************************/
-
-/*!
- \example hapticsplayer
- \title Haptics Player
-
- \tableofcontents
-
- \section1 Overview
-
- This example shows how to use various haptic effects in an application via
- the \l{Feedback}{QtMobility Feedback API}.
-
- It provides an example of how to use the QtMobility libraries to:
- \list
- \o play "system theme" haptic effects corresponding to certain predefined events
- \o play a dynamic custom effect, single or repeating
- \o play a custom effect which is stored in a file
- \endlist
-
- \section2 Use Case
-
- This example is more feature complete than the \l{hapticsquare}{Haptic Square} example,
- but is intended more as a way to test the haptics provider plugins which
- are available on a system, than as an example for application developers.
-
- It is useful for people who wish to learn how to use the API to create and
- play custom effects dynamically, or to allow users of an application to
- select which haptic effect to play when a particular event occurs. It is also useful
- to test how effects are implemented on specific devices.
-
- It is a more complex example than the \l{hapticsquare}{Haptic Square} example, so it is
- suggested that developers look at that example first.
-
- \section2 Interface
- The application is designed to work on desktop and mobile platforms with
- minimal differences in code between the platforms. The interface consists
- of three tabs which allow the user to select and play different custom,
- system theme, and file effects, respectively. The custom effect tab also
- allows the user to modify the custom effect dynamically, and see the effect
- of attack and fade, intensity and duration, and periodicity, on the user
- experience.
-
- \section2 Known Issues
- The example will not work correctly on platforms which do not have a
- QFeedbackHapticInterface (haptic effect provider) plugin loaded. On such
- platforms, the example will do nothing.
-*/
diff --git a/doc/src/examples/player.qdoc b/doc/src/examples/player.qdoc
deleted file mode 100644
index 1c985dc..0000000
--- a/doc/src/examples/player.qdoc
+++ /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 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$
-**
-****************************************************************************/
-
-/*!
- \example player
- \title Media Player Example
-
-
- This example creates a simple multimedia player. We can play audio and
- or video files using various codecs.
-
- The example uses a QMediaPlayer object passed into a QVideoWidget to
- control the video output. To give the application playlist capability
- we also use a QPlayList object.
-
- To activate the various functions such as play and stop on the dialog
- we connect clicked() signals to slots that emit the play() and stop()
- signals and in turn which we connect to the play() and stop() slots in
- QMediaPlayer.
-
- \code
- connect(controls, SIGNAL(play()), player, SLOT(play()));
- connect(controls, SIGNAL(pause()), player, SLOT(pause()));
- connect(controls, SIGNAL(stop()), player, SLOT(stop()));
- \endcode
-
- We can get the volume (and set our user interface representation)
-
- \code
- controls->setVolume(player->volume());
- \endcode
-
- and we can make widget 'volume' changes change the volume
-
- \code
- connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int)));
- \endcode
-
- The example also allows us to change various video properties by means
- of the QVideoWidget object. We can go to Full Screen mode with a single
- button click, and back again. Or if we press the "Color Options" dialog
- button we can have access to more subtle influences. The dialog has a
- set of sliders so that we can change the brightness, contrast, hue and
- saturation of the video being watched. The connect() statements are in
- pairs so that changes to either the user interface widget (the relevant
- slider) or the QVideoWidget object will update the other object.
-
- \code
- connect(brightnessSlider, SIGNAL(sliderMoved(int)), videoWidget,
- SLOT(setBrightness(int)));
- connect(videoWidget, SIGNAL(brightnessChanged(int)),
- brightnessSlider, SLOT(setValue(int)));
-
- connect(contrastSlider, SIGNAL(sliderMoved(int)), videoWidget,
- SLOT(setContrast(int)));
- connect(videoWidget, SIGNAL(contrastChanged(int)), contrastSlider,
- SLOT(setValue(int)));
-
- connect(hueSlider, SIGNAL(sliderMoved(int)), videoWidget,
- SLOT(setHue(int)));
- connect(videoWidget, SIGNAL(hueChanged(int)), hueSlider,
- SLOT(setValue(int)));
-
- connect(saturationSlider, SIGNAL(sliderMoved(int)), videoWidget,
- SLOT(setSaturation(int)));
- connect(videoWidget, SIGNAL(saturationChanged(int)),
- saturationSlider, SLOT(setValue(int)));
- \endcode
-
-*/
-
diff --git a/doc/src/examples/slideshow.qdoc b/doc/src/examples/slideshow.qdoc
deleted file mode 100644
index 939b605..0000000
--- a/doc/src/examples/slideshow.qdoc
+++ /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 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$
-**
-****************************************************************************/
-
-/*!
- \example slideshow
- \title SlideShow Example
-
-
- \image slideshow-img1.png
-
-
- Slideshow displays a series of time delayed images after you select a
- source image directory to use. The folder button presents a list of three
- options: browse for a directory, load a playlist or enter a location.
-
- This implementation uses a QMediaImageViewer object for the image with
- a QVideoWidget used to do the display. Whether the the source is a
- browsed directory, a playlist file or a URL to a local or remote
- location the playlist object in Slideshow is updated with the file or
- multiple file locations.
-
- \code
- connect(imageViewer, SIGNAL(stateChanged(QMediaImageViewer::State)),
- this, SLOT(stateChanged(QMediaImageViewer::State)));
-
- playlist = new QMediaPlaylist;
- playlist->setMediaObject(imageViewer);
- \endcode
-
- We create a QVideoWidget to display the viewer and add it to the dialog.
-
- \code
- QVideoWidget *videoWidget = new QVideoWidget;
- videoWidget->setMediaObject(imageViewer);
- \endcode
-
-
- \code
- layout->addWidget(videoWidget, Qt::AlignCenter);
- \endcode
-
-
- The timeout between images is set by changing the timeout property in
- QMediaImageViewer which is in milliseconds. So to change the timeout
- to five seconds
- \code
- imageViewer->setTimeout( 5000 );
- \endcode
-
-
-*/
diff --git a/doc/src/images/annotatedurl.png b/doc/src/images/annotatedurl.png
deleted file mode 100644
index 38d86fb..0000000
--- a/doc/src/images/annotatedurl.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/audiodevices.png b/doc/src/images/audiodevices.png
deleted file mode 100644
index 419b40f..0000000
--- a/doc/src/images/audiodevices.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/camera-example.png b/doc/src/images/camera-example.png
deleted file mode 100644
index 12e1b57..0000000
--- a/doc/src/images/camera-example.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/codeless.png b/doc/src/images/codeless.png
deleted file mode 100644
index 3901022..0000000
--- a/doc/src/images/codeless.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/qml-camera.png b/doc/src/images/qml-camera.png
deleted file mode 100644
index 0cd61f0..0000000
--- a/doc/src/images/qml-camera.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/slideshow-img1.png b/doc/src/images/slideshow-img1.png
deleted file mode 100644
index 72255d6..0000000
--- a/doc/src/images/slideshow-img1.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/legal/3rdparty.qdoc b/doc/src/legal/3rdparty.qdoc
deleted file mode 100644
index f8c9976..0000000
--- a/doc/src/legal/3rdparty.qdoc
+++ /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 documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page 3rdparty.html
-
- \title Third-Party Licenses Used in Qt
- \ingroup licensing
- \brief License information for third-party libraries supplied with Qt.
-
- Qt includes a number of third-party libraries that are used to provide
- certain features. Unlike the code described in the
- \l{Other Licenses Used in Qt}{code used in Qt} document, these
- libraries are supplied alongside the Qt modules.
-
- Third Party Software may impose additional restrictions and it is the
- user's responsibility to ensure that they have met the licensing
- requirements of the GPL, LGPL, or Qt Commercial license and the relevant
- license of the Third Party Software they are using.
-
- Run \c{configure -help} to see any options that may be available for
- controlling the use of these libraries.
-
- \tableofcontents
-
- \section1 DES (\c des.cpp)
-
- \i{Implementation of DES encryption for NTLM\br
- Copyright 1997-2005 Simon Tatham.\br
- This software is released under the MIT license.}
-
- See \c src/3rdparty/des/des.cpp for more information about the terms and
- conditions under which the code is supplied.
-
- \section1 FreeType 2 (\c freetype) version 2.3.6
-
- \i{The FreeType project is a team of volunteers who develop free, portable
- and high-quality software solutions for digital typography. We specifically
- target embedded systems and focus on bringing small, efficient and
- ubiquitous products.} -- quoted from \c 3rdparty/freetype/docs/freetype2.html.
-
- See \c src/3rdparty/freetype/docs/FTL.txt and \c
- src/3rdparty/freetype/docs/GPL.txt for license details.
-
- See also the files in \c src/3rdparty/harfbuzz, which are used by
- FreeType.
-
- Parts of the FreeType projects have been modified and put into Qt
- for use in the painting subsystem. These files are ftraster.h,
- ftraster.c, ftgrays.h and ftgrays.c. The following modifications
- has been made to these files:
-
- \list
- \o Renamed FT_ and ft_ symbols to QT_FT_ and qt_ft_ to avoid name
- conflicts.
- \o Removed parts of code not relevant when compiled with
- _STANDALONE_ defined.
- \o Changed behavior in ftraster.c to follow X polygon filling
- rules.
- \o Implemented support in ftraster.c for winding / odd even
- polygon fill rules.
- \o Replaced bitmap generation with span generation in ftraster.c
- \o Renamed: ftraster.h to qblackraster_p.h
- \o Renamed: ftraster.c to qblackraster.c
- \o Renamed: ftgrays.h to qgrayraster_p.h
- \o Renamed: ftgrays.c to qgrayraster.c
- \endlist
-
- \section1 HarfBuzz (\c harfbuzz)
-
- \i{This is HarfBuzz, an OpenType Layout engine.}
-
- \i{It was derived originally from the OpenType code in FreeType-1.x, ported to
- FreeType2. (This code has been abandoned for FreeType2, but until something
- better comes along, should serve our purposes.) In addition to porting to
- FreeType-2, it has been modified in various other ways.} -- quoted from
- \c src/3rdparty/harfbuzz/README.
-
- See \c src/3rdparty/harfbuzz/COPYING.FTL and src/3rdparty/harfbuzz/COPYING.GPL
- for license details.
-
- \section1 The Independent JPEG Group's JPEG Software (\c libjpeg) version 6b
-
- \i{This package contains C software to implement JPEG image compression and
- decompression. JPEG (pronounced "jay-peg") is a standardized compression
- method for full-color and gray-scale images. JPEG is intended for compressing
- "real-world" scenes; line drawings, cartoons and other non-realistic images
- are not its strong suit. JPEG is lossy, meaning that the output image is not
- exactly identical to the input image.} -- quoted from \c
- src/3rdparty/libjpeg/README.
-
- See \c src/3rdparty/libjpeg/README for license details.
-
- \section1 MD4 (\c md4.cpp and \c md4.h)
-
- \i{MD4 (RFC-1320) message digest.\br
- Modified from MD5 code by Andrey Panin <pazke@donpac.ru>\br\br
- Written by Solar Designer <solar@openwall.com> in 2001, and placed in\br
- the public domain. There's absolutely no warranty.}
-
- See \c src/3rdparty/md4/md4.cpp and \c src/3rdparty/md4/md4.h for more
- information about the terms and conditions under which the code is
- supplied.
-
- \section1 MD5 (\c md5.cpp and \c md5.h)
-
- \i{This code implements the MD5 message-digest algorithm.
- The algorithm is due to Ron Rivest. This code was
- written by Colin Plumb in 1993, no copyright is claimed.
- This code is in the public domain; do with it what you wish.} -- quoted from
- \c src/3rdparty/md5/md5.h
-
- See \c src/3rdparty/md5/md5.cpp and \c src/3rdparty/md5/md5.h for more
- information about the terms and conditions under which the code is
- supplied.
-
- \section1 MNG Library (\c libmng) version 1.0.10
-
- \i{The libmng library supports decoding, displaying, encoding, and various
- other manipulations of the Multiple-image Network Graphics (MNG) format
- image files. It uses the zlib compression library, and optionally the
- JPEG library by the Independant JPEG Group (IJG) and/or
- lcms (little cms), a color-management library by Marti Maria Saguer.}
- -- quoted from \c src/3rdparty/libmng/doc/libmng.txt
-
- See \c src/3rdparty/libmng/LICENSE for license details.
-
- \section1 PNG Reference Library (\c libpng) version 1.2.29
-
- \i{Libpng was written as a companion to the PNG specification, as a way
- of reducing the amount of time and effort it takes to support the PNG
- file format in application programs.} -- quoted from \c
- src/3rdparty/libpng/libpng.txt.
-
- See \c src/3rdparty/libpng/LICENSE for license details.
-
- \section1 The ptmalloc memory allocator (\c ptmalloc3) version 1.8
-
- \i ptmcalloc3 is a scalable concurrent memory allocator suitable
- for use in multi-threaded programs.
-
- \hr
-
- Copyright (c) 2001-2006 Wolfram Gloger
-
- Permission to use, copy, modify, distribute, and sell this software
- and its documentation for any purpose is hereby granted without fee,
- provided that (i) the above copyright notices and this permission
- notice appear in all copies of the software and related documentation,
- and (ii) the name of Wolfram Gloger may not be used in any advertising
- or publicity relating to the software.
-
- THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
- EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
- WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
- IN NO EVENT SHALL WOLFRAM GLOGER BE LIABLE FOR ANY SPECIAL,
- INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY
- DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY
- OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
-
- \hr
-
- See \c src/3rdparty/ptmalloc/COPYRIGHT for license details.
-
- \section1 SHA-1 (\c sha1.cpp)
-
- \i{Based on the public domain implementation of the SHA-1 algorithm\br
- Copyright (C) Dominik Reichl <dominik.reichl@t-online.de>}
-
- See \c src/3rdparty/sha1/sha1.cpp for more information about the terms and
- conditions under which the code is supplied.
-
- \section1 SQLite (\c sqlite) version 3.5.9
-
- \i{SQLite is a small C library that implements a
- self-contained, embeddable, zero-configuration SQL database engine.}
- -- quoted from \l{http://www.sqlite.org/}{www.sqlite.org}.
-
- According to the comments in the source files, the code is in the public
- domain. See the
- \l{http://www.sqlite.org/copyright.html}{SQLite Copyright} page on the
- SQLite web site for further information.
-
- \section1 TIFF Software Distribution (\c libtiff) version 3.8.2
-
- \i {libtiff is a set of C functions (a library) that support the
- manipulation of TIFF image files.} -- quoted from \c
- src/libtiff/html/libtiff.html
-
- \hr
-
- Copyright (c) 1988-1997 Sam Leffler\br
- Copyright (c) 1991-1997 Silicon Graphics, Inc.\br
- Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\br
- Copyright (c) 1997 Greg Ward Larson
-
- Permission to use, copy, modify, distribute, and sell this software and
- its documentation for any purpose is hereby granted without fee, provided
- that (i) the above copyright notices and this permission notice appear in
- all copies of the software and related documentation, and (ii) the names of
- Sam Leffler and Silicon Graphics may not be used in any advertising or
- publicity relating to the software without the specific, prior written
- permission of Sam Leffler and Silicon Graphics.
-
- THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
- EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
- WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
- IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
- ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
- OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
- LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- OF THIS SOFTWARE.
-
- \hr
-
- Copyright (c) 1996-1997 Sam Leffler\br
- Copyright (c) 1996 Pixar
-
- Permission to use, copy, modify, distribute, and sell this software and
- its documentation for any purpose is hereby granted without fee, provided
- that (i) the above copyright notices and this permission notice appear in
- all copies of the software and related documentation, and (ii) the names of
- Pixar, Sam Leffler and Silicon Graphics may not be used in any advertising or
- publicity relating to the software without the specific, prior written
- permission of Pixar, Sam Leffler and Silicon Graphics.
-
- THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
- EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
- WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
- IN NO EVENT SHALL PIXAR, SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
- ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
- OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
- LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- OF THIS SOFTWARE.
-
- \hr
-
- See \c src/3rdparty/libtiff/COPYRIGHT for license details.
-
- \section1 Wintab API (\c wintab)
-
- Wintab is a de facto API for pointing devices on Windows. The
- wintab code is from \l{http://www.pointing.com/WINTAB.HTM}.
-
- See \c src/3rdparty/wintab/wintab.h for license details.
-
- \section1 Data Compression Library (\c zlib) version 1.2.3
-
- \i{zlib is a general purpose data compression library. All the code
- is thread safe. The data format used by the zlib library is described
- by RFCs (Request for Comments) 1950 to 1952} -- quoted from \c
- src/3rdparty/zlib/README.
-
- See \c src/3rdparty/zlib/README for license details.
-*/
diff --git a/doc/src/legal/editions.qdoc b/doc/src/legal/editions.qdoc
deleted file mode 100644
index 7c1f76a..0000000
--- a/doc/src/legal/editions.qdoc
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 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:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page editions.html
- \title Qt Editions
- \ingroup licensing
- \brief Information about the different editions of Qt.
-
- Qt can be used to create both commercial and non-commercial
- software for a wide range of different deployment environments,
- and is supplied in a number of different forms to suit the needs
- of different kinds of developers.
-
- In terms of license conditions, there are two main forms of Qt:
-
- \list
- \o The \l{Qt Commercial Edition} are the commercial
- versions of \l{About Qt}{Qt}.
- \o The \l{Open Source Versions of Qt} are freely available for download.
- \endlist
-
- On the Qt web site, you can find a
- \l{Qt Licensing Overview} and information on \l{Qt License Pricing}
- for commercial editions of Qt and other Qt-related products.
-*/
diff --git a/doc/src/legal/gpl.qdoc b/doc/src/legal/gpl.qdoc
deleted file mode 100644
index a314a2e..0000000
--- a/doc/src/legal/gpl.qdoc
+++ /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 documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*! \page lgpl.html
-\title GNU Lesser General Public License (LGPL)
-\ingroup licensing
-\brief About the LGPL license used for Qt.
-
-The Qt GUI Toolkit is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).\br
-Contact: Nokia Corporation (qt-info@nokia.com)
-
-Qt is available under the LGPL.
-
-\section1 The GNU Lesser General Public License (Version 2.1)
-
-Reference: \l{GNU Lesser General Public License, version 2.1}
-
-\snippet doc/src/snippets/code/doc_src_lgpl.qdoc LGPL v2.1
-
-\section1 Nokia Qt LGPL Exception version 1.0
-
-As a special exception to the GNU Lesser General Public License version 2.1,
-the object code form of a "work that uses the Library" may incorporate material
-from a header file that is part of the Library. You may distribute such object
-code under terms of your choice, provided that the incorporated material
-(i) does not exceed more than 5% of the total size of the Library; and
-(ii) is limited to numerical parameters, data structure layouts, accessors,
-macros, inline functions and templates.
-*/
diff --git a/doc/src/legal/opensourceedition.qdoc b/doc/src/legal/opensourceedition.qdoc
deleted file mode 100644
index c0e6a88..0000000
--- a/doc/src/legal/opensourceedition.qdoc
+++ /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 documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page opensourceedition.html
-
- \title Open Source Versions of Qt
- \ingroup licensing
- \brief Information about the license and features of the Open Source Edition.
-
- Free (or open source) software is software that comes with a license
- that gives users certain rights. In particular the right to use the
- software, to modify it, to obtain its source, and to pass it on (under
- the same terms). Notice that the term "free" is about rights, not
- money. The Free Software Foundation (creators of the GNU GPL) speaks
- of free in this context as in "free speech", not as in "no cost".
-
- Nokia supports the free software concept by providing the Qt Open Source
- Edition, which is licensed under the \l{GNU General Public License (GPL)}
- (version 3) and the \l{GNU Lesser General Public License (LGPL)} (version 2.1).
- You can use this edition of Qt to create and distribute software with licenses
- that are compatible to these free software licenses.
-
- The support of open source with the Open Source Versions of Qt has enabled large
- successful software projects like KDE to thrive, with thousands of developers
- around the world using open source versions of Qt at no cost to themselves. With
- the release of Qt 4, open source versions of Qt became available for Unix/X11,
- Mac OS X, and Windows platforms.
-
- The Open Source Edition can be downloaded from the \l{Downloads}{Qt website}.
-
- Please refer to the online \l{License FAQ} for answers to frequently asked
- questions on open source licensing and its implications.
-
- More information on Free and Open Source software is available online:
-
- \list
- \o GNU GPL: \l http://www.gnu.org/.
- \o Open Source licensing: \l http://www.opensource.org/.
- \endlist
-
- See \l{Licensing Information} for a collection of documents about licenses
- used in Qt.
-
- Information about Qt Commercial License Agreements is available
- in the \l{Qt Licensing Overview} on the Qt website or by contacting
- the sales department at http://qt.nokia.com/contact.
-
- If you are in doubt what edition of Qt is right for your project,
- please contact
- \l{mailto:qt-info@nokia.com}{qt-info@nokia.com}.
-
-*/
diff --git a/doc/src/legal/trademarks.qdoc b/doc/src/legal/trademarks.qdoc
deleted file mode 100644
index d6716df..0000000
--- a/doc/src/legal/trademarks.qdoc
+++ /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 documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page trademarks.html
-
- \title Trademarks
- \ingroup licensing
- \brief Information about trademarks owned by Nokia and other organisations.
-
- Nokia, the Nokia logo, Qt, and the Qt logo are trademarks of Nokia \reg
- Corporation and/or its subsidiaries in Finland and other countries.
-
- \list
- \o Intel, Intel Inside (logos), MMX and Pentium are \reg trademarks of
- Intel Corporation in the United States, other countries, or both.
- \o Java and all Java-based trademarks are trademarks of Sun Microsystems,
- Inc. in the United States, other countries, or both.
- \o Linux is a \reg trademark of Linus Torvalds in the United States, other
- countries or both.
- \o Mac, Mac OS and Macintosh are \reg trademarks of Apple Computer, Inc.,
- registered in the U.S. and other countries.
- \o Microsoft, Windows, Windows NT, XP, Visual Studio and the Windows logo
- are \reg trademarks of Microsoft Corporation in the United States, other
- countries, or both.
- \o Motif is a registered trademark of The Open Group in the United States,
- other countries, or both.
- \o OpenGL is a \reg trademark of Silicon Graphics, Inc. in the United States
- and other countries.
- \o UNIX is a registered trademark of The Open Group in the United States
- and other countries.
- \o Versit is a \reg trademark of the Internet Mail Consortium in the United States
- and other countries.
- \o All other company, product, or service names may be trademarks or
- service marks of others and are the property of their respective owners.
- The use of the word partner does not imply a partnership relationship
- between Nokia and any other company.
- \endlist
-*/
diff --git a/doc/src/multimedia.qdoc b/doc/src/multimedia.qdoc
deleted file mode 100644
index 8cdf138..0000000
--- a/doc/src/multimedia.qdoc
+++ /dev/null
@@ -1,362 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 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$
-**
-****************************************************************************/
-
-
-/*!
- \group multimedia
- \title QtMobility Multimedia
- APIs to play and record media, and manage a collection of media content.
-*/
-
-/*!
-
-\page multimedia.html
-\title Multimedia
-\brief Provides a set of APIs to play and record media, and manage a
-collection of media content.
-\ingroup mobility
-
-Multimedia provides a set of APIs that allow the developer to play, record
-and manage a collection of media content. It is dependent on the
-QtMultimedia module. QtMultimedia is the recommended API to build multimedia
-applications using Qt. The Phonon API is no longer recommended.
-
-\tableofcontents
-
-\section1 No Special Namespace
-
-Unlike the other APIs in QtMobility, the Multimedia API is \i not in the
-\i QtMobility namespace.
-
-\section1 Overview
-
-This API delivers an easy to use interface to multimedia functions. The
-developer can use the API to display an image, or a video, record sound or play a
-multimedia stream.
-
-There are several benefits this API brings to Qt. Firstly, the
-developer can now implement fundamental multimedia functions with minimal
-code, mostly because they are already implemented. Also there is a great
-deal of flexibility with the media source or the generated multimedia. The
-source file does not need to be local to the device, it could be streamed
-from a remote location and identified by a URL. Finally, many different
-codecs are supported 'out
-of the box'.
-
-The supplied \l {qtmultimedia examples}{examples} give a good idea at the ease of use of the API. When
-the supporting user interface code is ignored we can see that functionality
-is immediately available with minimal effort.
-
-\section2 Audio
-
-The Audio Recorder example is a good introduction to the basic use of the API. We will use snippets from this example to illustrate how to use the
-API to quickly build functionality.
-
-The first step is to demonstrate recording audio to a file. When recording from an audio source there are a number of things we may want to control beyond the essential user interface. We may want a particular encoding of the file, MP3 or Ogg Vorbis for instance, or select a different input source. The user may modify the bitrate, number of channels, quality and sample rate. Here the example will only modify the codec and the source device, since they are essential.
-
-To begin, the developer sets up a source and a recorder object. A
-\l{QAudioCaptureSource} object is created and used to initialize a \l{QMediaRecorder} object. The output file name is then set for the \l{QMediaRecorder} object.
-
-\code
- audiosource = new QAudioCaptureSource;
- capture = new QMediaRecorder(audiosource);
-
- capture->setOutputLocation(QUrl("test.raw"));
-\endcode
-
-A list of devices is needed so that an input can be selected in the user interface
-
-\code
- for(int i = 0; i < audiosource->deviceCount(); i++)
- deviceBox->addItem(audiosource->name(i));
-\endcode
-
-and a list of the supported codecs for the user to select a codec,
-
-\code
- QStringList codecs = capture->supportedAudioCodecs();
- for(int i = 0; i < codecs.count(); i++)
- codecsBox->addItem(codecs.at(i));
-\endcode
-
-To set the selected device or codec just use the index of the device or codec by calling the setter in \i {audiosource} or \i {capture} as appropriate, for example,
-
-\code
- audiosource->setSelectedDevice(i);
- ...
- capture->setAudioCodec(codecIdx);
-\endcode
-
-Now start recording by using the \l {QMediaRecorder}{record()} function from the new \l{QMediaRecorder} object
-
-\code
- capture->record();
-\endcode
-
-And stop recording by calling the matching function \l {QMediaRecorder::stop()}{stop()} in \l{QMediaRecorder}.
-
-\code
- capture->stop();
-\endcode
-
-How then would this audio file be played? The \l {QMediaPlayer} class will be
-used as a generic player. Since the player can play both video and audio files the interface will be more complex, but for now the example will concentrate on the audio aspect.
-
-Playing the file is simple: create a player object, pass in the filename, set
-the volume or other parameters, then play. Not forgetting that the code will
-need to be hooked up to the user interface.
-
-\code
- QMediaPlayer *player = new QMediaPlayer;
- ...
- player->setMedia(QUrl::fromLocalFile("test.raw"));
- player->setVolume(50);
- player->play();
-\endcode
-
-The filename does not have to be a local file. It could be a URL to a
-remote resource. Also by using the \l{QMediaPlaylist} class from this API
-we can play a list of local or remote files. The \l{QMediaPlaylist}
-class supports constructing, managing and playing playlists.
-
-\code
- player = new QMediaPlayer;
-
- playlist = new QMediaPlaylist(player);
- playlist->addMedia(QUrl("http://example.com/myfile1.mp3"));
- playlist->addMedia(QUrl("http://example.com/myfile2.mp3"));
- ...
- playlist->setCurrentPosition(1);
- player->play();
-\endcode
-
-To manipulate the playlist there are the usual management functions (which are in fact slots): previous, next, setCurrentPosition and shuffle. Playlists can be built, saved and loaded using the API.
-
-
-
-\section2 Video
-
-Continuing with the example discussed for an Audio recorder/player, we can use this to show how to play video files with little change to the code.
-
-Moving from audio to video requires few changes in the sample code. To play a
-video playlist the code can be changed to include another new QtMobility
-Project class: \l{QVideoWidget}. This class enables control of a video
-resource with signals and slots for the control of brightness, contrast,
-hue, saturation and full screen mode.
-
-\code
- player = new QMediaPlayer;
-
- playlist = new QMediaPlaylist(player);
- playlist->addMedia(QUrl("http://example.com/myclip1.mp4"));
- playlist->addMedia(QUrl("http://example.com/myclip2.mp4"));
- ...
- widget = new QVideoWidget(player);
- widget->show();
-
- playlist->setCurrentPosition(1);
- player->play();
-\endcode
-
-The \l {player}{Player} example does things a bit differently to our sample
-code. Instead of using a QVideoWidget object directly, the Player example
-has a \i {VideoWidget} class that inherits from QVideoWidget. This means
-that functions can be added to provide functions such as full screen display,
-either on a double click or on a particular keypress.
-
-\snippet ../../demos/player/player.cpp 2
-
-\omit
-\section2 Radio
-
-QRadioTunerControl is a pure virtual base class that will be the basis for
-any platform specific radio device control. When the functions are
-implemented the developer will be able to quickly produce an application
-that supports the typical uses of an FM radio including tuning, volume,
-start, stop and various other controls.
-\endomit
-
-
-\section1 Camera Support
-
-Creating still images and video.
-
-\section2 Still Images
-
-In order to capture an image we need to create a \l QCamera object and use
-it to initialize a \l QVideoWidget, so we can see where the camera is
-pointing - a viewfinder. The camera object is also used to initialize a new
-QCameraImageCapture object, \i imageCapture. All that is then needed is to start
-the camera, lock it so that the settings are not changed while the image
-capture occurs, capture the image, and finally unlock the camera ready for
-the next photo.
-
- \code
- camera = new QCamera;
- viewFinder = new QCameraViewfinder();
- viewFinder->show();
-
- camera->setViewfinder(viewFinder);
-
- imageCapture = new QCameraImageCapture(camera);
-
- camera->setCaptureMode(QCamera::CaptureStillImage);
- camera->start();
-
- //on half pressed shutter button
- camera->searchAndLock();
-
- ...
-
- //on shutter button pressed
- imageCapture->capture();
-
- //on shutter button released
- camera->unlock();
- \endcode
-
-\note Alternatively, we could have used a QGraphicsVideoItem as a viewfinder.
-
-
-\section2 Video Clips
-
-Previously we saw code that allowed the capture of a still image. Recording
-video requires the use of a \l QMediaRecorder object and a \l
-QAudioCaptureSource for sound.
-
-To record video we need a camera object, as before, a media recorder and a
-viewfinder object. The media recorder object will need to be initialized.
-
- \code
- camera = new QCamera;
- mediaRecorder = new QMediaRecorder(camera);
-
- camera->setCaptureMode(QCamera::CaptureVideo);
- camera->start();
-
- //on shutter button pressed
- mediaRecorder->record();
- \endcode
-
-Signals from the \i mediaRecorder can be connected to slots to react to
-changes in the state of the recorder or error events. Recording itself
-starts with the \l {QMediaRecorder::record()}{record()} function of
-mediaRecorder being called, this causes the signal \l
-{QMediaRecorder::stateChanged()}{stateChanged()} to be emitted. The
-recording process can be changed with the \l {QMediaRecorder::record()}{record()},
-\l {QMediaRecorder::pause()}{pause()}, \l {QMediaRecorder::stop()}{stop()} and
-\l {QMediaRecorder::setMuted()}{setMuted()} slots in \l QMediaRecorder.
-
-When the camera is in video mode, as decided by the application, then as the
-shutter button is pressed the camera is locked as before but instead the
-\l {QMediaRecorder::record()}{record()} function in \l QMediaRecorder is used.
-
-
-
-\section2 Focus
-
-Focusing is managed by the classes \l QCameraFocus and \l QCameraFocusControl.
-QCameraFocus allows the developer to set the general policy by means of the
-enums for the \l {QCameraFocus::FocusMode}{FocusMode} and the
-\l {QCameraFocus::FocusPointMode}{FocusPointMode}.
-\l {QCameraFocus::FocusMode}{FocusMode} deals with
-settings such as \l {QCameraFocus::FocusMode}{AutoFocus},
-\l {QCameraFocus::FocusMode}{ContinuousFocus} and
-\l {QCameraFocus::FocusMode}{InfinityFocus}, whereas
-\l {QCameraFocus::FocusPointMode}{FocusPointMode} deals with the various focus zones within the view.
-\l {QCameraFocus::FocusPointMode}{FocusPointMode} has support for face
-recognition, center focus and a custom focus where the focus point can be specified.
-
-
-
-\section2 Canceling Asynchronous Operations
-
-Various operations such as image capture and auto focusing occur
-asynchrously. These operations can often be cancelled by the start of a new
-operation as long as this is supported by the backend. For image capture,
-the operation can be cancelled by calling
-\l {QCameraImageCapture::cancelCapture()}{cancelCapture()}. For \l {QCameraFocus::FocusMode}{auto-focus},
-\l {QCameraExposure::ExposureMode}{auto-exposure} or \l {QCameraImageProcessing::WhiteBalanceMode}{white balance}
-cancellation can be done by calling \l {QCamera::unlock()}{unlock}(QCamera::LockFocus).
-
-
-\target qtmultimedia examples
-\section1 Examples
-
-\section2 Record a Sound Source
-
-\l{audiorecorder}{AudioRecorder} is a demonstration of the discovery of
-the supported devices and codecs and the use of recording functions in the
-QMediaRecorder class.
-
-\section2 Play a Media File
-
-The \l{player}{Player} example is a simple multimedia player. Select a
-video file to play, stop, pause, show in fullscreen or manipulate various
-image attributes using the Color Options button.
-
-\section2 Slide Show
-
-The \l{slideshow}{Slide Show} shows the use of the QMediaImageViewer and
-QVideoWidget classes.
-
-\section2 Camera Example
-
-The \l{Camera Example} shows how use the QtMultimedia API to quickly
-write a camera application in C++.
-
-\section2 QML Camera Example
-
-The \l {QML Camera Example} demonstrates still image capture and controls
-using the QML plugin. Video recording is not currently available.
-
-
-\section1 Reference documentation
-
-\section2 Main audio and video classes
-
-\annotatedlist multimedia
-
-\section2 Camera classes
-
-\annotatedlist camera
-
-\section2 Advanced usage.
-
-For developers wishing to access some platform specific settings, or to
-port the Qt Multimedia APIs to a new platform or technology, see \l{Multimedia Backend Development}.
-
-\section2 QML Elements
-\list
-\o \l {SoundEffect}{SoundEffect: Low Latency Sound Effects}
-\o \l {Audio}{Audio: Music playback}
-\o \l {Video}{Video: Video playback}
-\endlist
-*/
-
-
-
diff --git a/doc/src/multimediabackend.qdoc b/doc/src/multimediabackend.qdoc
deleted file mode 100644
index 13ae95d..0000000
--- a/doc/src/multimediabackend.qdoc
+++ /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 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$
-**
-****************************************************************************/
-
-
-/*!
-
-\page multimediabackend.html
-\brief Information for implementing a new multimedia backend.
-\ingroup mobility
-
-\tableofcontents
-
-\section1 Multimedia Backend Development
-
-In some cases the available cross-platform Multimedia APIs or implementations are not sufficient,
-or not immediately available on a certain platform. In some cases the multimedia
-implementation on a platform might expose certain extra properties or functionality
-that other platforms do not, or a finer degree of control might be possible. For these
-cases, it is possible to use extended controls directly.
-
-In addition, if you plan to port the Qt Multimedia APIs to a new platform, you do
-this by implementing certain control and service classes, as detailed below.
-
-\section1 Extending the API
-
-For the developer who wishes to extend the functionality of the Multimedia
-classes there are several classes of particular importance. The default
-classes are QMediaService, QMediaServiceProvider and QMediaControl.
-
-Basically, the idea is that to use the Multimedia API you would use these
-three classes or classes derived from them as follows
-
- \list
- \o \l QMediaServiceProvider is used by the top level client class to request a service. The top level class knowing what kind of service it needs.
-
- \o \l QMediaService provides a service and when asked by the top level object, say a component, will return a QMediaControl object.
-
- \o \l QMediaControl allows the control of the service using a known interface.
- \endlist
-
-Consider a developer creating, for example, a media player class called MyPlayer.
-It may have special requirements beyond ordinary media players and so may
-need a custom service and a custom control. We can subclass \l QMediaServiceProvider
-to create our MyServiceProvider class. Also we will create a
-MyMediaService, and the MyMediaControl to manipulate the media service.
-
-The MyPlayer object calls MyServiceProvider::requestService() to get an
-instance of MyMediaService. Then the MyPlayer object calls this service
-object it has just received and calling \l {QMediaService::requestControl()}{requestControl()}
-it will receive the control object derived from QMediaControl. Now we have
-all the parts necessary for our media application. We have the service
-provider, the service it provides and the control used to manipulate the
-service. Since our MyPlayer object has instances of the service and its
-control then it would be possible for these to be used by associated classes
-that could do additional actions, perhaps with their own control since the
-parameter to requestControl() is a c-type string, \i {const char *}, for the
-interface.
-
-
-\section2 Adding a Media Service Provider
-
-The base class for creating new service providers is \l{QMediaServiceProvider}.
-The user must implement the \l{QMediaServiceProvider::requestService()}{requestService()}
-function
-
-\code
- QMediaService* requestService(const QByteArray &type, const QMediaServiceProviderHint &hint);
-\endcode
-
-The details of implementation will depend on the provider. Looking at the
-class \l QMediaServiceProvider for the default implementation. Notice that
-\l {QMediaServiceProvider::requestService()}{requestService()} uses the
-\l QMediaServiceProviderHint to look for the appropriate plugin and then to
-insert it into the plugin map. However, for a specific service provider there
-is probably no need for this approach, it will simply depend on what the
-developer wants to implement.
-
-Other methods that may be overloaded
-\code
- void releaseService(QMediaService *service);
-
- QtMediaServices::SupportEstimate hasSupport(const QByteArray &serviceType,
- const QString &mimeType,
- const QStringList& codecs,
- int flags) const;
-
- QStringList supportedMimeTypes(const QByteArray &serviceType, int flags) const;
-
- QList<QByteArray> devices(const QByteArray &serviceType) const;
-
- QString deviceDescription(const QByteArray &serviceType, const QByteArray &device);
-\endcode
-
-The choice of what needs to be done depends on what the developer wishes to do with the service.
-
-\section2 Classes for service implementers.
-
-\annotatedlist multimedia-serv
-
-*/
-
-
diff --git a/doc/src/plugins/qml-multimedia.qdoc b/doc/src/plugins/qml-multimedia.qdoc
deleted file mode 100644
index b539cf4..0000000
--- a/doc/src/plugins/qml-multimedia.qdoc
+++ /dev/null
@@ -1,291 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 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$
-**
-****************************************************************************/
-
-/*!
- \group qml-multimedia
- \title QML Multimedia Plugin
- QML Support for the QtMobility Project Multimedia API.
-*/
-
-/*!
- \page qml-multimedia.html
-
- \title Multimedia QML Plugin
-
- \brief A QML plugin for the QtMobility Project Multimedia API.
-
-
- \section1 Overview
-
- The Multimedia API in the QtMobility Project gives developers a simplified way to use audio and video playback, and access camera functionality. The Multimedia QML Plugin provides a QML friendly interface to these features.
-
- \section1 Elements
-
- \section2 Audio
-
- The \l Audio element is an easy way to add audio playback to a Qt Quick
- scene. QtMobility provides properties for control, methods (functions) and signals.
-
- The code extract below shows the creation and use of an audio element.
-
- \qml
-
- import Qt 4.7
- import QtMultimedia 4.0
- // ...
-
- Audio {
- id: playMusic
- source: "music.wav"
- }
-
- MouseArea {
- id: playArea
- anchors.fill: parent
- onPressed: { playMusic.play() }
- }
-
- \endqml
-
- The snippet above shows how the inclusion of \i playMusic enables audio features on the element that contains it. So that when the parent's MouseArea is clicked the \l {Audio::play()}{play()} method of the audio element is run. Other typical audio control methods are available such as \l {Audio::pause}{pause()} and \l {Audio::stop()}{stop()}.
-
- Much of the getting / setting of \l Audio parameters is done through properties. These include
- \table 70%
- \header
- \o Property
- \o Description
- \row
- \o \l {Audio::source}{source}
- \o The source URL of the media.
- \row
- \o \l {Audio::autoLoad}{autoLoad}
- \o Indicates if loading of media should begin immediately.
- \row
- \o \l{Audio::playing}{playing}
- \o Indicates that the media is playing.
- \row
- \o \l {Audio::paused}{paused}
- \o The media is paused.
- \row
- \o \l{Audio::status}{status}
- \o The status of media loading.
- \row
- \o \l{Audio::duration}{duration}
- \o Amount of time in milliseconds the media will play.
- \row
- \o \l{Audio::position}{position}
- \o Current position in the media in milliseconds of play.
- \row
- \o \l{Audio::volume}{volume}
- \o Audio output volume: from 0.0 (silent) to 1.0 (maximum)
- \row
- \o \l{Audio::muted}{muted}
- \o Indicates audio is muted.
- \row
- \o \l{Audio::bufferProgress}{bufferProgress}
- \o Indicates how full the data buffer is: 0.0 (empty) to 1.0 (full).
- \row
- \o \l{Audio::seekable}{seekable}
- \o Indicates whether the audio position can be changed.
- \row
- \o \l{Audio::playbackRate}{playbackRate}
- \o The rate at which audio is played at as a multiple of the normal rate.
- \row
- \o \l{Audio::error}{error}
- \o An error code for the error state including NoError
- \row
- \o \l{Audio::errorString}{errorString}
- \o A description of the current error condition.
- \endtable
-
- The set of signals available allow the developer to create custom behavior when the following events occur,
-
- \table 70%
- \header
- \o Signal
- \o Description
- \row
- \o \l{Audio::onStarted}{onStarted}
- \o Called when playback has been started.
- \row
- \o \l{Audio::onResumed}{onResumed}
- \o Called when playback is resumed from the paused state.
- \row
- \o \l{Audio::onPaused}{onPaused}
- \o Called when playback is paused.
- \row
- \o \l{Audio::onStopped}{onStopped}
- \o Called when playback is stopped.
- \row
- \o \l{Audio::onError}{onError}
- \o Called when the specified error occurs.
- \endtable
-
- \section2 Camera
-
- The \l Camera element in the plugin enables still image capture using
- QML. The element has methods for starting and stopping the camera, capturing
- the image, camera settings and many signals indicating critical events.
-
- The follow code is taken from the \l {QML Camera Example}. This snippet
- shows the setting up of the \l Camera element
-
- \qml
-
- Camera {
- id: camera
- x : 0
- y : 0
- width : 640
- height : 480
- focus : visible //to receive focus and capture key events
- //captureResolution : "640x480"
-
- flashMode: stillControls.flashMode
- whiteBalanceMode: stillControls.whiteBalance
- exposureCompensation: stillControls.exposureCompensation
-
- onImageCaptured : {
- photoPreview.source = preview
- stillControls.previewAvailable = true
- cameraUI.state = "PhotoPreview"
- }
- }
-
- \endqml
-
- Notice that the slot for the \l {Camera::imageCaptured()}{imageCaptured()}
- signal is implemented in \i onImageCaptured. However, this code only
- changes some state information to allow previewing.
-
- The capture call itself is part of the implementation of the button
- that the user presses to take the image. It uses a call to
- \l {Camera::captureImage()}{captureImage()}:
-
- \qml
-
- CameraButton {
- text: "Capture"
- onClicked: camera.captureImage()
- }
-
- \endqml
-
-
- \section2 Video
-
- Adding video playback, with sound, to a Qt Quick scene is also easy. The process is very similar to that of Audio above, in fact \l {Video} shares many of the property names, methods and signals. Here is the equivalent sample code to implement a video playback element in a scene
-
- \qml
-
- 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
-
- There are similar features like \l {Video::play()}{play()} with new
- features specific to video.
-
- In the above sample when the parent of MouseArea is clicked, an area of 800x600 pixels with an id of 'video', the source "video.avi" will play in that area. Notice also that signals for the Keys element have been defined so that a spacebar will toggle the pause button; the left arrow will move the current position in the video to 5 seconds previously; and the right arrow will advance the current position in the video by 5 seconds.
-
- Most of the differences will obviously be about video control and information. There are many properties associated with the \l {Video} element, most of them deal with meta-data, control of the video media and aspects of presentation.
-
- \section2 SoundEffect
-
- The \l SoundEffect element provides a way to play short sound effects, like in video games. Multiple sound effect instances can be played simultaneously.
- You should use the \l Audio element for music playback.
-
- \qml
-
- import Qt 4.7
- import QtMultimedia 4.0
-
-
- SoundEffect {
- id: effect
- source: "test.wav"
- }
- MouseArea {
- id: playArea
- anchors.fill: parent
- onPressed: { effect.play() }
- }
-
- \endqml
-
-
- In the above sample the sound effect will be played when the MouseArea is clicked.
-
- For a complete description of this element, see \l SoundEffect
-
- \section2 Camera
-
- Adding access to the camera viewfinder, and capturing images is possible by using the \l Camera element. You can adjust capture settings
- including white balance, exposure compensation and flash mode, and control zoom.
-
- \qml
- import Qt 4.7
- import QtMultimedia 4.0
-
- Camera {
- focus : visible // to receive focus and capture key events when visible
-
- flashMode: Camera.FlashRedEyeReduction
- whiteBalanceMode: Camera.WhiteBalanceFlash
- exposureCompensation: -1.0
-
- onImageCaptured : {
- photoPreview.source = preview // Show the preview in an Image element
- }
-
- }
- \endqml
-
- For a complete description of this element, see \l Camera, and look at the \l {declarative-camera}{QML Camera Example}.
-
- \section1 Multimedia QML Elements
-
- \annotatedlist qml-multimedia
-*/
-
-
diff --git a/doc/src/snippets/multimedia-snippets/audio.cpp b/doc/src/snippets/multimedia-snippets/audio.cpp
deleted file mode 100644
index d34bb96..0000000
--- a/doc/src/snippets/multimedia-snippets/audio.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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$
-**
-****************************************************************************/
-
-/* Audio related snippets */
-#include <QFile>
-#include <QTimer>
-#include <QDebug>
-
-#include "qaudiodeviceinfo.h"
-#include "qaudioinput.h"
-#include "qaudiooutput.h"
-
-class AudioInputExample : public QObject {
- Q_OBJECT
-public:
- void setup();
-
-
-public Q_SLOTS:
- void stopRecording();
- void stateChanged(QAudio::State newState);
-
-private:
- //! [Audio input class members]
- QFile destinationFile; // class member.
- QAudioInput* audio; // class member.
- //! [Audio input class members]
-};
-
-
-void AudioInputExample::setup()
-//! [Audio input setup]
-{
- destinationFile.setFileName("/tmp/test.raw");
- destinationFile.open( QIODevice::WriteOnly | QIODevice::Truncate );
-
- QAudioFormat format;
- // set up the format you want, eg.
- format.setFrequency(8000);
- format.setChannels(1);
- format.setSampleSize(8);
- format.setCodec("audio/pcm");
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::UnSignedInt);
-
- QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice();
- if (!info.isFormatSupported(format)) {
- qWarning()<<"default format not supported try to use nearest";
- format = info.nearestFormat(format);
- }
-
- audio = new QAudioInput(format, this);
- connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(stateChanged(QAudio::State)));
-
- QTimer::singleShot(3000, this, SLOT(stopRecording()));
- audio->start(&destinationFile);
- // Records audio for 3000ms
-}
-//! [Audio input setup]
-
-//! [Audio input stop recording]
-void AudioInputExample::stopRecording()
-{
- audio->stop();
- destinationFile.close();
- delete audio;
-}
-//! [Audio input stop recording]
-
-//! [Audio input state changed]
-void AudioInputExample::stateChanged(QAudio::State newState)
-{
- switch (newState) {
- case QAudio::StoppedState:
- if (audio->error() != QAudio::NoError) {
- // Error handling
- } else {
- // Finished recording
- }
- break;
-
- // ...
- }
-}
-//! [Audio input state changed]
-
-
-class AudioOutputExample : public QObject {
- Q_OBJECT
-public:
- void setup();
-
-public Q_SLOTS:
- void stateChanged(QAudio::State newState);
-
-private:
- //! [Audio output class members]
- QFile sourceFile; // class member.
- QAudioOutput* audio; // class member.
- //! [Audio output class members]
-};
-
-
-void AudioOutputExample::setup()
-//! [Audio output setup]
-{
- sourceFile.setFileName("/tmp/test.raw");
- sourceFile.open(QIODevice::ReadOnly);
-
- QAudioFormat format;
- // Set up the format, eg.
- format.setFrequency(8000);
- format.setChannels(1);
- format.setSampleSize(8);
- format.setCodec("audio/pcm");
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::UnSignedInt);
-
- QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
- if (!info.isFormatSupported(format)) {
- qWarning() << "raw audio format not supported by backend, cannot play audio.";
- return;
- }
-
- audio = new QAudioOutput(format, this);
- connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(stateChanged(QAudio::State)));
- audio->start(&sourceFile);
-}
-//! [Audio output setup]
-
-//! [Audio output state changed]
-void AudioOutputExample::stateChanged(QAudio::State newState)
-{
- switch (newState) {
- case QAudio::IdleState:
- // Finished playing (no more data)
- audio->stop();
- sourceFile.close();
- delete audio;
- break;
-
- case QAudio::StoppedState:
- // Stopped for other reasons
- if (audio->error() != QAudio::NoError) {
- // Error handling
- }
- break;
-
- // ...
- }
-}
-//! [Audio output state changed]
-
-void AudioDeviceInfo()
-{
- //! [Setting audio format]
- QAudioFormat format;
- format.setFrequency(44100);
- // ... other format parameters
- format.setSampleType(QAudioFormat::SignedInt);
-
- QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
-
- if (!info.isFormatSupported(format))
- format = info.nearestFormat(format);
- //! [Setting audio format]
-
- //! [Dumping audio formats]
- foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
- qDebug() << "Device name: " << deviceInfo.deviceName();
- //! [Dumping audio formats]
-}
diff --git a/doc/src/snippets/multimedia-snippets/audiorecorder.cpp b/doc/src/snippets/multimedia-snippets/audiorecorder.cpp
deleted file mode 100644
index 6ff4965..0000000
--- a/doc/src/snippets/multimedia-snippets/audiorecorder.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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 <QtWidgets>
-
-#include <qaudiocapturesource.h>
-#include <qmediarecorder.h>
-#include <qmediaservice.h>
-
-#include <QtMultimedia/qaudioformat.h>
-
-#include "audiorecorder.h"
-
-AudioRecorder::AudioRecorder()
-{
-//! [create-objs-1]
- audiosource = new QAudioCaptureSource;
- capture = new QMediaRecorder(audiosource);
-//! [create-objs-1]
-
- // set a default file
- capture->setOutputLocation(QUrl("test.raw"));
-
- QWidget *window = new QWidget;
- QGridLayout* layout = new QGridLayout;
-
- QLabel* deviceLabel = new QLabel;
- deviceLabel->setText("Devices");
- deviceBox = new QComboBox(this);
- deviceBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
-
- QLabel* codecLabel = new QLabel;
- codecLabel->setText("Codecs");
- codecsBox = new QComboBox(this);
- codecsBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
-
- QLabel* qualityLabel = new QLabel;
- qualityLabel->setText("Quality");
- qualityBox = new QComboBox(this);
- qualityBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
-
-//! [device-list]
- for(int i = 0; i < audiosource->deviceCount(); i++)
- deviceBox->addItem(audiosource->name(i));
-//! [device-list]
-
-//! [codec-list]
- QStringList codecs = capture->supportedAudioCodecs();
- for(int i = 0; i < codecs.count(); i++)
- codecsBox->addItem(codecs.at(i));
-//! [codec-list]
-
- qualityBox->addItem("Low");
- qualityBox->addItem("Medium");
- qualityBox->addItem("High");
-
- connect(capture, SIGNAL(durationChanged(qint64)), this, SLOT(updateProgress(qint64)));
- connect(capture, SIGNAL(stateChanged(QMediaRecorder::State)), this, SLOT(stateChanged(QMediaRecorder::State)));
-
- layout->addWidget(deviceLabel,0,0,Qt::AlignHCenter);
- connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int)));
- layout->addWidget(deviceBox,0,1,1,3,Qt::AlignLeft);
-
- layout->addWidget(codecLabel,1,0,Qt::AlignHCenter);
- connect(codecsBox,SIGNAL(activated(int)),SLOT(codecChanged(int)));
- layout->addWidget(codecsBox,1,1,Qt::AlignLeft);
-
- layout->addWidget(qualityLabel,1,2,Qt::AlignHCenter);
- connect(qualityBox,SIGNAL(activated(int)),SLOT(qualityChanged(int)));
- layout->addWidget(qualityBox,1,3,Qt::AlignLeft);
-
- fileButton = new QPushButton(this);
- fileButton->setText(tr("Output File"));
- connect(fileButton,SIGNAL(clicked()),SLOT(selectOutputFile()));
- layout->addWidget(fileButton,3,0,Qt::AlignHCenter);
-
- button = new QPushButton(this);
- button->setText(tr("Record"));
- connect(button,SIGNAL(clicked()),SLOT(toggleRecord()));
- layout->addWidget(button,3,3,Qt::AlignHCenter);
-
- recTime = new QLabel;
- recTime->setText("0 sec");
- layout->addWidget(recTime,4,0,Qt::AlignHCenter);
-
- window->setLayout(layout);
- setCentralWidget(window);
- window->show();
-
- active = false;
-}
-
-AudioRecorder::~AudioRecorder()
-{
- delete capture;
- delete audiosource;
-}
-
-void AudioRecorder::updateProgress(qint64 pos)
-{
- currentTime = pos;
- if(currentTime == 0) currentTime = 1;
- QString text = QString("%1 secs").arg(currentTime/1000);
- recTime->setText(text);
-}
-
-void AudioRecorder::stateChanged(QMediaRecorder::State state)
-{
- qWarning()<<"stateChanged() "<<state;
-}
-
-void AudioRecorder::deviceChanged(int idx)
-{
-//! [get-device]
- for(int i = 0; i < audiosource->deviceCount(); i++) {
- if(deviceBox->itemText(idx).compare(audiosource->name(i)) == 0)
- audiosource->setSelectedDevice(i);
- }
-//! [get-device]
-}
-
-void AudioRecorder::codecChanged(int idx)
-{
- Q_UNUSED(idx);
- //capture->setAudioCodec(codecsBox->itemText(idx));
-}
-
-void AudioRecorder::qualityChanged(int idx)
-{
- Q_UNUSED(idx);
- /*
- if(capture->audioCodec().compare("audio/pcm") == 0) {
- if(qualityBox->itemText(idx).compare("Low") == 0) {
- // 8000Hz mono is 8kbps
- capture->setAudioBitrate(8);
- } else if(qualityBox->itemText(idx).compare("Medium") == 0) {
- // 22050Hz mono is 44.1kbps
- capture->setAudioBitrate(44);
- } else if(qualityBox->itemText(idx).compare("High") == 0) {
- // 44100Hz mono is 88.2kbps
- capture->setAudioBitrate(88);
- }
- }
- */
-}
-
-//! [toggle-record]
-void AudioRecorder::toggleRecord()
-{
- if(!active) {
- recTime->setText("0 sec");
- currentTime = 0;
- capture->record();
-
- button->setText(tr("Stop"));
- active = true;
- } else {
- capture->stop();
- button->setText(tr("Record"));
- active = false;
- }
-}
-//! [toggle-record]
-
-void AudioRecorder::selectOutputFile()
-{
- QStringList fileNames;
-
- QFileDialog dialog(this);
-
- dialog.setFileMode(QFileDialog::AnyFile);
- if (dialog.exec())
- fileNames = dialog.selectedFiles();
-
- if(fileNames.size() > 0)
- capture->setOutputLocation(QUrl(fileNames.first()));
-}
diff --git a/doc/src/snippets/multimedia-snippets/camera.cpp b/doc/src/snippets/multimedia-snippets/camera.cpp
deleted file mode 100644
index 2cfaf41..0000000
--- a/doc/src/snippets/multimedia-snippets/camera.cpp
+++ /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 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$
-**
-****************************************************************************/
-
-/* Camera snippets */
-
-#include "qcamera.h"
-#include "qcameraviewfinder.h"
-#include "qmediarecorder.h"
-#include "qcameraimagecapture.h"
-
-void camera()
-{
- QCamera *camera = 0;
- QCameraViewfinder *viewfinder = 0;
- QMediaRecorder *recorder = 0;
- QCameraImageCapture *imageCapture = 0;
-
- //! [Camera]
- camera = new QCamera;
-
- viewfinder = new QCameraViewfinder();
- viewfinder->show();
-
- camera->setViewfinder(viewfinder);
-
- recorder = new QMediaRecorder(camera);
- imageCapture = new QCameraImageCapture(camera);
-
- camera->setCaptureMode(QCamera::CaptureStillImage);
- camera->start();
- //! [Camera]
-
- //! [Camera keys]
- //on half pressed shutter button
- camera->searchAndLock();
-
- //on shutter button pressed
- imageCapture->capture();
-
- //on shutter button released
- camera->unlock();
- //! [Camera keys]
-
-}
diff --git a/doc/src/snippets/multimedia-snippets/media.cpp b/doc/src/snippets/multimedia-snippets/media.cpp
deleted file mode 100644
index baff4d3..0000000
--- a/doc/src/snippets/multimedia-snippets/media.cpp
+++ /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 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$
-**
-****************************************************************************/
-
-/* Media related snippets */
-#include <QFile>
-#include <QTimer>
-
-#include "qaudiocapturesource.h"
-#include "qmediaplaylist.h"
-#include "qmediarecorder.h"
-#include "qmediaservice.h"
-#include "qmediaimageviewer.h"
-#include "qmediaimageviewer.h"
-#include "qmediaplayercontrol.h"
-#include "qmediaplayer.h"
-#include "qradiotuner.h"
-#include "qvideowidget.h"
-#include "qcameraimagecapture.h"
-
-class MediaExample : public QObject {
- Q_OBJECT
-
- void AudioCaptureSource();
- void MediaControl();
- void MediaImageViewer();
- void MediaPlayer();
- void RadioTuna();
- void MediaRecorder();
- void EncoderSettings();
- void ImageEncoderSettings();
-
-private:
- // Common naming
- QMediaService *mediaService;
- QVideoWidget *videoWidget;
- QWidget *widget;
- QMediaPlayer *player;
- QMediaPlaylist *playlist;
- QMediaContent video;
- QMediaRecorder *recorder;
- QMediaImageViewer *viewer;
- QCameraImageCapture *imageCapture;
- QAudioCaptureSource *audioSource;
- QString fileName;
- QRadioTuner *radio;
- QMediaContent image1;
- QMediaContent image2;
- QMediaContent image3;
-
- static const int yourRadioStationFrequency = 11;
-};
-
-void MediaExample::AudioCaptureSource()
-{
- //! [Audio capture source]
- QAudioCaptureSource* audioSource = new QAudioCaptureSource;
- QMediaRecorder* recorder = new QMediaRecorder(audioSource);
-
- recorder->setOutputLocation(QUrl("test.raw"));
- //! [Audio capture source]
-
- Q_UNUSED(audioSource);
-}
-
-
-void MediaExample::MediaControl()
-{
- {
- //! [Request control]
- QMediaPlayerControl *control = qobject_cast<QMediaPlayerControl *>(
- mediaService->requestControl("com.nokia.Qt.QMediaPlayerControl/1.0"));
- //! [Request control]
- Q_UNUSED(control);
- }
-
- {
- //! [Request control templated]
- QMediaPlayerControl *control = mediaService->requestControl<QMediaPlayerControl *>();
- //! [Request control templated]
- Q_UNUSED(control);
- }
-}
-
-
-void MediaExample::EncoderSettings()
-{
- //! [Audio encoder settings]
- QAudioEncoderSettings audioSettings;
- audioSettings.setCodec("audio/mpeg");
- audioSettings.setChannelCount(2);
-
- recorder->setEncodingSettings(audioSettings);
- //! [Audio encoder settings]
-
- //! [Video encoder settings]
- QVideoEncoderSettings videoSettings;
- videoSettings.setCodec("video/mpeg2");
- videoSettings.setResolution(640, 480);
-
- recorder->setEncodingSettings(audioSettings, videoSettings);
- //! [Video encoder settings]
-}
-
-void MediaExample::ImageEncoderSettings()
-{
- //! [Image encoder settings]
- QImageEncoderSettings imageSettings;
- imageSettings.setCodec("image/jpeg");
- imageSettings.setResolution(1600, 1200);
-
- imageCapture->setEncodingSettings(imageSettings);
- //! [Image encoder settings]
-}
-
-void MediaExample::MediaImageViewer()
-{
- //! [Binding]
- viewer = new QMediaImageViewer(this);
-
- videoWidget = new QVideoWidget;
- viewer->bind(videoWidget);
- videoWidget->show();
- //! [Binding]
-
- //! [Playlist]
- playlist = new QMediaPlaylist(this);
- playlist->setPlaybackMode(QMediaPlaylist::Loop);
- playlist->addMedia(image1);
- playlist->addMedia(image2);
- playlist->addMedia(image3);
-
- viewer->setPlaylist(playlist);
- viewer->setTimeout(5000);
- viewer->play();
- //! [Playlist]
-}
-
-void MediaExample::MediaPlayer()
-{
- //! [Player]
- player = new QMediaPlayer;
- connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
- player->setMedia(QUrl::fromLocalFile("/Users/me/Music/coolsong.mp3"));
- player->setVolume(50);
- player->play();
- //! [Player]
-
- //! [Movie playlist]
- playlist = new QMediaPlaylist;
- playlist->addMedia(QUrl("http://example.com/movie1.mp4"));
- playlist->addMedia(QUrl("http://example.com/movie2.mp4"));
- playlist->addMedia(QUrl("http://example.com/movie3.mp4"));
- playlist->setCurrentIndex(1);
-
- player = new QMediaPlayer;
- player->setPlaylist(playlist);
-
- videoWidget = new QVideoWidget;
- player->setVideoOutput(videoWidget);
- videoWidget->show();
-
- player->play();
- //! [Movie playlist]
-}
-
-void MediaExample::MediaRecorder()
-{
- //! [Media recorder]
- // Audio only recording
- audioSource = new QAudioCaptureSource;
- recorder = new QMediaRecorder(audioSource);
-
- QAudioEncoderSettings audioSettings;
- audioSettings.setCodec("audio/vorbis");
- audioSettings.setQuality(QtMultimedia::HighQuality);
-
- recorder->setEncodingSettings(audioSettings);
-
- recorder->setOutputLocation(QUrl::fromLocalFile(fileName));
- recorder->record();
- //! [Media recorder]
-}
-
-void MediaExample::RadioTuna()
-{
- //! [Radio tuner]
- radio = new QRadioTuner;
- connect(radio, SIGNAL(frequencyChanged(int)), this, SLOT(freqChanged(int)));
- if (radio->isBandSupported(QRadioTuner::FM)) {
- radio->setBand(QRadioTuner::FM);
- radio->setFrequency(yourRadioStationFrequency);
- radio->setVolume(100);
- radio->start();
- }
- //! [Radio tuner]
-}
-
-
diff --git a/doc/src/snippets/multimedia-snippets/multimedia-snippets.pro b/doc/src/snippets/multimedia-snippets/multimedia-snippets.pro
deleted file mode 100644
index bf5c094..0000000
--- a/doc/src/snippets/multimedia-snippets/multimedia-snippets.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-# Doc snippets - compiled for truthiness
-
-TEMPLATE = lib
-TARGET = qtmmksnippets
-
-INCLUDEPATH += ../../../../src/global \
- ../../../../src/multimedia \
- ../../../../src/multimedia/audio \
- ../../../../src/multimedia/video \
- ../../../../src/multimedia/effects
-
-CONFIG += console
-
-QT += multimedia
-
-SOURCES += \
- audio.cpp \
- video.cpp \
- camera.cpp \
- media.cpp
diff --git a/doc/src/snippets/multimedia-snippets/player.cpp b/doc/src/snippets/multimedia-snippets/player.cpp
deleted file mode 100644
index 1280bab..0000000
--- a/doc/src/snippets/multimedia-snippets/player.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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 "player.h"
-
-#include "playercontrols.h"
-#include "playlistmodel.h"
-#include "videowidget.h"
-
-#include <qmediaservice.h>
-#include <qmediaplaylist.h>
-
-#include <QtWidgets>
-
-Player::Player(QWidget *parent)
- : QWidget(parent)
- , videoWidget(0)
- , coverLabel(0)
- , slider(0)
- , colorDialog(0)
-{
-//! [create-objs]
- player = new QMediaPlayer;
- playlist = new QMediaPlaylist(player);
-//! [create-objs]
-
- connect(player, SIGNAL(durationChanged(qint64)), SLOT(durationChanged(qint64)));
- connect(player, SIGNAL(positionChanged(qint64)), SLOT(positionChanged(qint64)));
- connect(player, SIGNAL(metaDataChanged()), SLOT(metaDataChanged()));
- connect(playlist, SIGNAL(playlistPositionChanged(int)), SLOT(playlistPositionChanged(int)));
- connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
- this, SLOT(statusChanged(QMediaPlayer::MediaStatus)));
- connect(player, SIGNAL(bufferStatusChanged(int)), this, SLOT(bufferingProgress(int)));
-
- videoWidget = new VideoWidget(player);
-
- playlistModel = new PlaylistModel(this);
- playlistModel->setPlaylist(playlist);
-
- playlistView = new QListView;
- playlistView->setModel(playlistModel);
- playlistView->setCurrentIndex(playlistModel->index(playlist->currentPosition(), 0));
-
- connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex)));
-
- slider = new QSlider(Qt::Horizontal);
- slider->setRange(0, player->duration() / 1000);
-
- connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(seek(int)));
-
- QPushButton *openButton = new QPushButton(tr("Open"));
-
- connect(openButton, SIGNAL(clicked()), this, SLOT(open()));
-
- PlayerControls *controls = new PlayerControls;
- controls->setState(player->state());
- controls->setVolume(player->volume());
- controls->setMuted(controls->isMuted());
-
- connect(controls, SIGNAL(play()), player, SLOT(play()));
- connect(controls, SIGNAL(pause()), player, SLOT(pause()));
- connect(controls, SIGNAL(stop()), player, SLOT(stop()));
- connect(controls, SIGNAL(next()), playlist, SLOT(next()));
- connect(controls, SIGNAL(previous()), playlist, SLOT(previous()));
- connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int)));
- connect(controls, SIGNAL(changeMuting(bool)), player, SLOT(setMuted(bool)));
- connect(controls, SIGNAL(changeRate(qreal)), player, SLOT(setPlaybackRate(qreal)));
-
- connect(player, SIGNAL(stateChanged(QMediaPlayer::State)),
- controls, SLOT(setState(QMediaPlayer::State)));
- connect(player, SIGNAL(volumeChanged(int)), controls, SLOT(setVolume(int)));
- connect(player, SIGNAL(mutingChanged(bool)), controls, SLOT(setMuted(bool)));
-
- QPushButton *fullScreenButton = new QPushButton(tr("FullScreen"));
- fullScreenButton->setCheckable(true);
-
- if (videoWidget != 0) {
- connect(fullScreenButton, SIGNAL(clicked(bool)), videoWidget, SLOT(setFullScreen(bool)));
- connect(videoWidget, SIGNAL(fullScreenChanged(bool)),
- fullScreenButton, SLOT(setChecked(bool)));
- } else {
- fullScreenButton->setEnabled(false);
- }
-
- QPushButton *colorButton = new QPushButton(tr("Color Options..."));
- if (videoWidget)
- connect(colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog()));
- else
- colorButton->setEnabled(false);
-
- QBoxLayout *displayLayout = new QHBoxLayout;
- if (videoWidget)
- displayLayout->addWidget(videoWidget, 2);
- else
- displayLayout->addWidget(coverLabel, 2);
- displayLayout->addWidget(playlistView);
-
- QBoxLayout *controlLayout = new QHBoxLayout;
- controlLayout->setMargin(0);
- controlLayout->addWidget(openButton);
- controlLayout->addStretch(1);
- controlLayout->addWidget(controls);
- controlLayout->addStretch(1);
- controlLayout->addWidget(fullScreenButton);
- controlLayout->addWidget(colorButton);
-
- QBoxLayout *layout = new QVBoxLayout;
- layout->addLayout(displayLayout);
- layout->addWidget(slider);
- layout->addLayout(controlLayout);
-
- setLayout(layout);
-
- metaDataChanged();
-}
-
-Player::~Player()
-{
- delete playlist;
- delete player;
-}
-
-void Player::open()
-{
- QStringList fileNames = QFileDialog::getOpenFileNames();
- foreach (QString const &fileName, fileNames)
- playlist->appendItem(QUrl::fromLocalFile(fileName));
-}
-
-void Player::durationChanged(qint64 duration)
-{
- slider->setMaximum(duration / 1000);
-}
-
-void Player::positionChanged(qint64 progress)
-{
- slider->setValue(progress / 1000);
-}
-
-void Player::metaDataChanged()
-{
- //qDebug() << "update metadata" << player->metaData(QtMultimedia::Title).toString();
- if (player->isMetaDataAvailable()) {
- setTrackInfo(QString("%1 - %2")
- .arg(player->metaData(QtMultimedia::AlbumArtist).toString())
- .arg(player->metaData(QtMultimedia::Title).toString()));
-
- if (coverLabel) {
- QUrl url = player->metaData(QtMultimedia::CoverArtUrlLarge).value<QUrl>();
-
- coverLabel->setPixmap(!url.isEmpty()
- ? QPixmap(url.toString())
- : QPixmap());
- }
- }
-}
-
-void Player::jump(const QModelIndex &index)
-{
- if (index.isValid()) {
- playlist->setCurrentPosition(index.row());
- }
-}
-
-void Player::playlistPositionChanged(int currentItem)
-{
- playlistView->setCurrentIndex(playlistModel->index(currentItem, 0));
-}
-
-void Player::seek(int seconds)
-{
- player->setPosition(seconds * 1000);
-}
-
-void Player::statusChanged(QMediaPlayer::MediaStatus status)
-{
- switch (status) {
- case QMediaPlayer::UnknownMediaStatus:
- case QMediaPlayer::NoMedia:
- case QMediaPlayer::LoadedMedia:
- case QMediaPlayer::BufferingMedia:
- case QMediaPlayer::BufferedMedia:
-#ifndef QT_NO_CURSOR
- unsetCursor();
-#endif
- setStatusInfo(QString());
- break;
- case QMediaPlayer::LoadingMedia:
-#ifndef QT_NO_CURSOR
- setCursor(QCursor(Qt::BusyCursor));
-#endif
- setStatusInfo(tr("Loading..."));
- break;
- case QMediaPlayer::StalledMedia:
-#ifndef QT_NO_CURSOR
- setCursor(QCursor(Qt::BusyCursor));
-#endif
- break;
- case QMediaPlayer::EndOfMedia:
-#ifndef QT_NO_CURSOR
- unsetCursor();
-#endif
- setStatusInfo(QString());
- QApplication::alert(this);
- break;
- case QMediaPlayer::InvalidMedia:
-#ifndef QT_NO_CURSOR
- unsetCursor();
-#endif
- setStatusInfo(player->errorString());
- break;
- }
-}
-
-void Player::bufferingProgress(int progress)
-{
- setStatusInfo(tr("Buffering %4%%").arg(progress));
-}
-
-void Player::setTrackInfo(const QString &info)
-{
- trackInfo = info;
-
- if (!statusInfo.isEmpty())
- setWindowTitle(QString("%1 | %2").arg(trackInfo).arg(statusInfo));
- else
- setWindowTitle(trackInfo);
-
-}
-
-void Player::setStatusInfo(const QString &info)
-{
- statusInfo = info;
-
- if (!statusInfo.isEmpty())
- setWindowTitle(QString("%1 | %2").arg(trackInfo).arg(statusInfo));
- else
- setWindowTitle(trackInfo);
-}
-
-void Player::showColorDialog()
-{
- if (!colorDialog) {
- QSlider *brightnessSlider = new QSlider(Qt::Horizontal);
- brightnessSlider->setRange(-100, 100);
- brightnessSlider->setValue(videoWidget->brightness());
- connect(brightnessSlider, SIGNAL(sliderMoved(int)), videoWidget, SLOT(setBrightness(int)));
- connect(videoWidget, SIGNAL(brightnessChanged(int)), brightnessSlider, SLOT(setValue(int)));
-
- QSlider *contrastSlider = new QSlider(Qt::Horizontal);
- contrastSlider->setRange(-100, 100);
- contrastSlider->setValue(videoWidget->contrast());
- connect(contrastSlider, SIGNAL(sliderMoved(int)), videoWidget, SLOT(setContrast(int)));
- connect(videoWidget, SIGNAL(contrastChanged(int)), contrastSlider, SLOT(setValue(int)));
-
- QSlider *hueSlider = new QSlider(Qt::Horizontal);
- hueSlider->setRange(-100, 100);
- hueSlider->setValue(videoWidget->hue());
- connect(hueSlider, SIGNAL(sliderMoved(int)), videoWidget, SLOT(setHue(int)));
- connect(videoWidget, SIGNAL(hueChanged(int)), hueSlider, SLOT(setValue(int)));
-
- QSlider *saturationSlider = new QSlider(Qt::Horizontal);
- saturationSlider->setRange(-100, 100);
- saturationSlider->setValue(videoWidget->saturation());
- connect(saturationSlider, SIGNAL(sliderMoved(int)), videoWidget, SLOT(setSaturation(int)));
- connect(videoWidget, SIGNAL(saturationChanged(int)), saturationSlider, SLOT(setValue(int)));
-
- QFormLayout *layout = new QFormLayout;
- layout->addRow(tr("Brightness"), brightnessSlider);
- layout->addRow(tr("Contrast"), contrastSlider);
- layout->addRow(tr("Hue"), hueSlider);
- layout->addRow(tr("Saturation"), saturationSlider);
-
- colorDialog = new QDialog(this);
- colorDialog->setWindowTitle(tr("Color Options"));
- colorDialog->setLayout(layout);
- }
- colorDialog->show();
-}
diff --git a/doc/src/snippets/multimedia-snippets/soundeffect.qml b/doc/src/snippets/multimedia-snippets/soundeffect.qml
deleted file mode 100644
index 21e75f1..0000000
--- a/doc/src/snippets/multimedia-snippets/soundeffect.qml
+++ /dev/null
@@ -1,63 +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$
-**
-****************************************************************************/
-
-//! [complete snippet]
-import Qt 4.7
-import QtMultimedia 4.0
-
-Text {
- text: "Click Me!";
- font.pointSize: 24;
- width: 150; height: 50;
-
- //! [play sound on click]
- SoundEffect {
- id: playSound
- source: "soundeffect.wav"
- }
- MouseArea {
- id: playArea
- anchors.fill: parent
- onPressed: { playSound.play() }
- }
- //! [play sound on click]
-}
-//! [complete snippet]
diff --git a/doc/src/snippets/multimedia-snippets/video.cpp b/doc/src/snippets/multimedia-snippets/video.cpp
deleted file mode 100644
index bb89880..0000000
--- a/doc/src/snippets/multimedia-snippets/video.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 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$
-**
-****************************************************************************/
-
-/* Video related snippets */
-#include "qvideorenderercontrol.h"
-#include "qmediaservice.h"
-#include "qmediaplayer.h"
-#include "qabstractvideosurface.h"
-#include "qvideowidgetcontrol.h"
-#include "qvideowindowcontrol.h"
-#include "qgraphicsvideoitem.h"
-
-#include <QFormLayout>
-#include <QGraphicsView>
-
-class VideoExample : public QObject {
- Q_OBJECT
-public:
- void VideoGraphicsItem();
- void VideoRendererControl();
- void VideoWidget();
- void VideoWindowControl();
- void VideoWidgetControl();
-
-private:
- // Common naming
- QMediaService *mediaService;
- QVideoWidget *videoWidget;
- QWidget *widget;
- QFormLayout *layout;
- QAbstractVideoSurface *myVideoSurface;
- QMediaPlayer *player;
- QMediaContent video;
- QGraphicsView *graphicsView;
-};
-
-void VideoExample::VideoRendererControl()
-{
- //! [Video renderer control]
- QVideoRendererControl *rendererControl = mediaService->requestControl<QVideoRendererControl *>();
- rendererControl->setSurface(myVideoSurface);
- //! [Video renderer control]
-}
-
-void VideoExample::VideoWidget()
-{
- //! [Video widget]
- player = new QMediaPlayer;
-
- videoWidget = new QVideoWidget;
-
- player->setVideoOutput(videoWidget);
- player->setMedia(QUrl("http://example.com/movie.mp4"));
-
- videoWidget->show();
- player->play();
- //! [Video widget]
-}
-
-void VideoExample::VideoWidgetControl()
-{
- //! [Video widget control]
- QVideoWidgetControl *widgetControl = mediaService->requestControl<QVideoWidgetControl *>();
- layout->addWidget(widgetControl->videoWidget());
- //! [Video widget control]
-}
-
-void VideoExample::VideoWindowControl()
-{
- //! [Video window control]
- QVideoWindowControl *windowControl = mediaService->requestControl<QVideoWindowControl *>();
- windowControl->setWinId(widget->winId());
- windowControl->setDisplayRect(widget->rect());
- windowControl->setAspectRatioMode(Qt::KeepAspectRatio);
- //! [Video window control]
-}
-
-void VideoExample::VideoGraphicsItem()
-{
- //! [Video graphics item]
- player = new QMediaPlayer(this);
-
- QGraphicsVideoItem *item = new QGraphicsVideoItem;
- player->setVideoOutput(item);
- graphicsView->scene()->addItem(item);
- graphicsView->show();
-
- player->setMedia(video);
- player->play();
- //! [Video graphics item]
-}
diff --git a/doc/src/snippets/snippets.pro b/doc/src/snippets/snippets.pro
deleted file mode 100644
index 31a3a09..0000000
--- a/doc/src/snippets/snippets.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += multimedia-snippets
diff --git a/examples/audiodevices/audiodevices.cpp b/examples/audiodevices/audiodevices.cpp
deleted file mode 100644
index 61a6973..0000000
--- a/examples/audiodevices/audiodevices.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <qaudiodeviceinfo.h>
-
-#include "audiodevices.h"
-
-// Utility functions for converting QAudioFormat fields into text
-
-QString toString(QAudioFormat::SampleType sampleType)
-{
- QString result("Unknown");
- switch (sampleType) {
- case QAudioFormat::SignedInt:
- result = "SignedInt";
- break;
- case QAudioFormat::UnSignedInt:
- result = "UnSignedInt";
- break;
- case QAudioFormat::Float:
- result = "Float";
- break;
- }
- return result;
-}
-
-QString toString(QAudioFormat::Endian endian)
-{
- QString result("Unknown");
- switch (endian) {
- case QAudioFormat::LittleEndian:
- result = "LittleEndian";
- break;
- case QAudioFormat::BigEndian:
- result = "BigEndian";
- break;
- }
- return result;
-}
-
-
-AudioDevicesBase::AudioDevicesBase(QWidget *parent, Qt::WFlags f)
- : QMainWindow(parent, f)
-{
- setupUi(this);
-}
-
-AudioDevicesBase::~AudioDevicesBase() {}
-
-
-AudioTest::AudioTest(QWidget *parent, Qt::WFlags f)
- : AudioDevicesBase(parent, f)
-{
- mode = QAudio::AudioOutput;
-
- connect(testButton, SIGNAL(clicked()), SLOT(test()));
- connect(modeBox, SIGNAL(activated(int)), SLOT(modeChanged(int)));
- connect(deviceBox, SIGNAL(activated(int)), SLOT(deviceChanged(int)));
- connect(frequencyBox, SIGNAL(activated(int)), SLOT(freqChanged(int)));
- connect(channelsBox, SIGNAL(activated(int)), SLOT(channelChanged(int)));
- connect(codecsBox, SIGNAL(activated(int)), SLOT(codecChanged(int)));
- connect(sampleSizesBox, SIGNAL(activated(int)), SLOT(sampleSizeChanged(int)));
- connect(sampleTypesBox, SIGNAL(activated(int)), SLOT(sampleTypeChanged(int)));
- connect(endianBox, SIGNAL(activated(int)), SLOT(endianChanged(int)));
- connect(populateTableButton, SIGNAL(clicked()), SLOT(populateTable()));
-
- modeBox->setCurrentIndex(0);
- modeChanged(0);
- deviceBox->setCurrentIndex(0);
- deviceChanged(0);
-}
-
-AudioTest::~AudioTest()
-{
-}
-
-void AudioTest::test()
-{
- // tries to set all the settings picked.
- testResult->clear();
-
- if (!deviceInfo.isNull()) {
- if (deviceInfo.isFormatSupported(settings)) {
- testResult->setText(tr("Success"));
- nearestFreq->setText("");
- nearestChannel->setText("");
- nearestCodec->setText("");
- nearestSampleSize->setText("");
- nearestSampleType->setText("");
- nearestEndian->setText("");
- } else {
- QAudioFormat nearest = deviceInfo.nearestFormat(settings);
- testResult->setText(tr("Failed"));
- nearestFreq->setText(QString("%1").arg(nearest.frequency()));
- nearestChannel->setText(QString("%1").arg(nearest.channels()));
- nearestCodec->setText(nearest.codec());
- nearestSampleSize->setText(QString("%1").arg(nearest.sampleSize()));
- nearestSampleType->setText(toString(nearest.sampleType()));
- nearestEndian->setText(toString(nearest.byteOrder()));
- }
- }
- else
- testResult->setText(tr("No Device"));
-}
-
-void AudioTest::modeChanged(int idx)
-{
- testResult->clear();
-
- // mode has changed
- if (idx == 0)
- mode = QAudio::AudioInput;
- else
- mode = QAudio::AudioOutput;
-
- deviceBox->clear();
- foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(mode))
- deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
-
- deviceBox->setCurrentIndex(0);
- deviceChanged(0);
-}
-
-void AudioTest::deviceChanged(int idx)
-{
- testResult->clear();
-
- if (deviceBox->count() == 0)
- return;
-
- // device has changed
- deviceInfo = deviceBox->itemData(idx).value<QAudioDeviceInfo>();
-
- frequencyBox->clear();
- QList<int> freqz = deviceInfo.supportedFrequencies();
- for(int i = 0; i < freqz.size(); ++i)
- frequencyBox->addItem(QString("%1").arg(freqz.at(i)));
- if(freqz.size())
- settings.setFrequency(freqz.at(0));
-
- channelsBox->clear();
- QList<int> chz = deviceInfo.supportedChannels();
- for(int i = 0; i < chz.size(); ++i)
- channelsBox->addItem(QString("%1").arg(chz.at(i)));
- if(chz.size())
- settings.setChannels(chz.at(0));
-
- codecsBox->clear();
- QStringList codecz = deviceInfo.supportedCodecs();
- for (int i = 0; i < codecz.size(); ++i)
- codecsBox->addItem(QString("%1").arg(codecz.at(i)));
- if (codecz.size())
- settings.setCodec(codecz.at(0));
- // Add false to create failed condition!
- codecsBox->addItem("audio/test");
-
- sampleSizesBox->clear();
- QList<int> sampleSizez = deviceInfo.supportedSampleSizes();
- for (int i = 0; i < sampleSizez.size(); ++i)
- sampleSizesBox->addItem(QString("%1").arg(sampleSizez.at(i)));
- if (sampleSizez.size())
- settings.setSampleSize(sampleSizez.at(0));
-
- sampleTypesBox->clear();
- QList<QAudioFormat::SampleType> sampleTypez = deviceInfo.supportedSampleTypes();
-
- for (int i = 0; i < sampleTypez.size(); ++i)
- sampleTypesBox->addItem(toString(sampleTypez.at(i)));
- if (sampleTypez.size())
- settings.setSampleType(sampleTypez.at(0));
-
- endianBox->clear();
- QList<QAudioFormat::Endian> endianz = deviceInfo.supportedByteOrders();
- for (int i = 0; i < endianz.size(); ++i)
- endianBox->addItem(toString(endianz.at(i)));
- if (endianz.size())
- settings.setByteOrder(endianz.at(0));
-
- allFormatsTable->clearContents();
-}
-
-void AudioTest::populateTable()
-{
- int row = 0;
-
- QAudioFormat format;
- foreach (QString codec, deviceInfo.supportedCodecs()) {
- format.setCodec(codec);
- foreach (int frequency, deviceInfo.supportedFrequencies()) {
- format.setFrequency(frequency);
- foreach (int channels, deviceInfo.supportedChannels()) {
- format.setChannels(channels);
- foreach (QAudioFormat::SampleType sampleType, deviceInfo.supportedSampleTypes()) {
- format.setSampleType(sampleType);
- foreach (int sampleSize, deviceInfo.supportedSampleSizes()) {
- format.setSampleSize(sampleSize);
- foreach (QAudioFormat::Endian endian, deviceInfo.supportedByteOrders()) {
- format.setByteOrder(endian);
- if (deviceInfo.isFormatSupported(format)) {
- allFormatsTable->setRowCount(row + 1);
-
- QTableWidgetItem *codecItem = new QTableWidgetItem(format.codec());
- allFormatsTable->setItem(row, 0, codecItem);
-
- QTableWidgetItem *frequencyItem = new QTableWidgetItem(QString("%1").arg(format.frequency()));
- allFormatsTable->setItem(row, 1, frequencyItem);
-
- QTableWidgetItem *channelsItem = new QTableWidgetItem(QString("%1").arg(format.channels()));
- allFormatsTable->setItem(row, 2, channelsItem);
-
- QTableWidgetItem *sampleTypeItem = new QTableWidgetItem(toString(format.sampleType()));
- allFormatsTable->setItem(row, 3, sampleTypeItem);
-
- QTableWidgetItem *sampleSizeItem = new QTableWidgetItem(QString("%1").arg(format.sampleSize()));
- allFormatsTable->setItem(row, 4, sampleSizeItem);
-
- QTableWidgetItem *byteOrderItem = new QTableWidgetItem(toString(format.byteOrder()));
- allFormatsTable->setItem(row, 5, byteOrderItem);
-
- ++row;
- }
- }
- }
- }
- }
- }
- }
-}
-
-void AudioTest::freqChanged(int idx)
-{
- // freq has changed
- settings.setFrequency(frequencyBox->itemText(idx).toInt());
-}
-
-void AudioTest::channelChanged(int idx)
-{
- settings.setChannels(channelsBox->itemText(idx).toInt());
-}
-
-void AudioTest::codecChanged(int idx)
-{
- settings.setCodec(codecsBox->itemText(idx));
-}
-
-void AudioTest::sampleSizeChanged(int idx)
-{
- settings.setSampleSize(sampleSizesBox->itemText(idx).toInt());
-}
-
-void AudioTest::sampleTypeChanged(int idx)
-{
- switch (sampleTypesBox->itemText(idx).toInt()) {
- case QAudioFormat::SignedInt:
- settings.setSampleType(QAudioFormat::SignedInt);
- break;
- case QAudioFormat::UnSignedInt:
- settings.setSampleType(QAudioFormat::UnSignedInt);
- break;
- case QAudioFormat::Float:
- settings.setSampleType(QAudioFormat::Float);
- }
-}
-
-void AudioTest::endianChanged(int idx)
-{
- switch (endianBox->itemText(idx).toInt()) {
- case QAudioFormat::LittleEndian:
- settings.setByteOrder(QAudioFormat::LittleEndian);
- break;
- case QAudioFormat::BigEndian:
- settings.setByteOrder(QAudioFormat::BigEndian);
- }
-}
diff --git a/examples/audiodevices/audiodevices.h b/examples/audiodevices/audiodevices.h
deleted file mode 100644
index 015133f..0000000
--- a/examples/audiodevices/audiodevices.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef AUDIODEVICES_H
-#define AUDIODEVICES_H
-
-#include <QObject>
-#include <QMainWindow>
-#include <qaudiodeviceinfo.h>
-
-#include "ui_audiodevicesbase.h"
-
-class AudioDevicesBase : public QMainWindow, public Ui::AudioDevicesBase
-{
-public:
- AudioDevicesBase(QWidget *parent = 0, Qt::WFlags f = 0);
- virtual ~AudioDevicesBase();
-};
-
-class AudioTest : public AudioDevicesBase
-{
- Q_OBJECT
-public:
- AudioTest(QWidget *parent = 0, Qt::WFlags f = 0);
- virtual ~AudioTest();
-
- QAudioDeviceInfo deviceInfo;
- QAudioFormat settings;
- QAudio::Mode mode;
-
-private slots:
- void modeChanged(int idx);
- void deviceChanged(int idx);
- void freqChanged(int idx);
- void channelChanged(int idx);
- void codecChanged(int idx);
- void sampleSizeChanged(int idx);
- void sampleTypeChanged(int idx);
- void endianChanged(int idx);
- void test();
- void populateTable();
-
-};
-
-#endif
-
diff --git a/examples/audiodevices/audiodevices.pro b/examples/audiodevices/audiodevices.pro
deleted file mode 100644
index 7bd5987..0000000
--- a/examples/audiodevices/audiodevices.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-TARGET = audiodevices
-
-QT += multimedia
-
-HEADERS = audiodevices.h
-
-SOURCES = audiodevices.cpp \
- main.cpp
-
-FORMS += audiodevicesbase.ui
-
-target.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/audiodevices
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/audiodevices
-
-INSTALLS += target sources
-
-QT+=widgets
diff --git a/examples/audiodevices/audiodevicesbase.ui b/examples/audiodevices/audiodevicesbase.ui
deleted file mode 100644
index 23b45d7..0000000
--- a/examples/audiodevices/audiodevicesbase.ui
+++ /dev/null
@@ -1,399 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AudioDevicesBase</class>
- <widget class="QMainWindow" name="AudioDevicesBase">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>679</width>
- <height>598</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Audio Devices</string>
- </property>
- <widget class="QWidget" name="centralwidget">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QScrollArea" name="scrollArea">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="widgetResizable">
- <bool>true</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>659</width>
- <height>558</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="modeLabel">
- <property name="text">
- <string>Mode</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="deviceLabel">
- <property name="text">
- <string>Device</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QComboBox" name="modeBox">
- <item>
- <property name="text">
- <string>Input</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Output</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="deviceBox"/>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="testFormatTab">
- <attribute name="title">
- <string>Test format</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="1">
- <widget class="QLabel" name="actualLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <property name="text">
- <string>&lt;i&gt;Actual Settings&lt;/i&gt;</string>
- </property>
- <property name="textFormat">
- <enum>Qt::RichText</enum>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="nearestLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <property name="text">
- <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Nearest Settings&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="textFormat">
- <enum>Qt::RichText</enum>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QComboBox" name="frequencyBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QLineEdit" name="nearestFreq">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QComboBox" name="channelsBox"/>
- </item>
- <item row="5" column="2">
- <widget class="QLineEdit" name="nearestChannel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="9" column="1">
- <widget class="QComboBox" name="sampleSizesBox"/>
- </item>
- <item row="9" column="2">
- <widget class="QLineEdit" name="nearestSampleSize">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="14" column="1">
- <widget class="QComboBox" name="endianBox"/>
- </item>
- <item row="14" column="2">
- <widget class="QLineEdit" name="nearestEndian">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="15" column="1">
- <widget class="QPushButton" name="testButton">
- <property name="text">
- <string>Test</string>
- </property>
- </widget>
- </item>
- <item row="15" column="2">
- <widget class="QLabel" name="testResult">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="actualFreqLabel">
- <property name="text">
- <string>Frequency (Hz)</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="actualChannelLabel">
- <property name="text">
- <string>Channels</string>
- </property>
- </widget>
- </item>
- <item row="9" column="0">
- <widget class="QLabel" name="actualSampleSizeLabel">
- <property name="text">
- <string>Sample size (bits)</string>
- </property>
- </widget>
- </item>
- <item row="14" column="0">
- <widget class="QLabel" name="actualEndianLabel">
- <property name="text">
- <string>Endianess</string>
- </property>
- </widget>
- </item>
- <item row="16" column="0" colspan="3">
- <widget class="QLabel" name="label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Note: an invalid codec 'audio/test' exists in order to allow an invalid format to be constructed, and therefore to trigger a 'nearest format' calculation.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="actualCodecLabel">
- <property name="text">
- <string>Codec</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QLineEdit" name="nearestCodec">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QComboBox" name="codecsBox"/>
- </item>
- <item row="6" column="0">
- <widget class="QLabel" name="actualSampleTypeLabel">
- <property name="text">
- <string>SampleType</string>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="QComboBox" name="sampleTypesBox"/>
- </item>
- <item row="6" column="2">
- <widget class="QLineEdit" name="nearestSampleType">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>All formats</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QPushButton" name="populateTableButton">
- <property name="text">
- <string>Populate table</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTableWidget" name="allFormatsTable">
- <property name="editTriggers">
- <set>QAbstractItemView::NoEditTriggers</set>
- </property>
- <property name="dragDropOverwriteMode">
- <bool>false</bool>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::NoSelection</enum>
- </property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectItems</enum>
- </property>
- <property name="textElideMode">
- <enum>Qt::ElideNone</enum>
- </property>
- <property name="sortingEnabled">
- <bool>false</bool>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- <property name="cornerButtonEnabled">
- <bool>false</bool>
- </property>
- <attribute name="horizontalHeaderHighlightSections">
- <bool>false</bool>
- </attribute>
- <attribute name="verticalHeaderVisible">
- <bool>false</bool>
- </attribute>
- <attribute name="verticalHeaderHighlightSections">
- <bool>false</bool>
- </attribute>
- <attribute name="verticalHeaderVisible">
- <bool>false</bool>
- </attribute>
- <attribute name="horizontalHeaderHighlightSections">
- <bool>false</bool>
- </attribute>
- <attribute name="verticalHeaderHighlightSections">
- <bool>false</bool>
- </attribute>
- <column>
- <property name="text">
- <string>Codec</string>
- </property>
- <property name="textAlignment">
- <set>AlignHCenter|AlignVCenter|AlignCenter</set>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Frequency (Hz)</string>
- </property>
- <property name="textAlignment">
- <set>AlignHCenter|AlignVCenter|AlignCenter</set>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Channels</string>
- </property>
- <property name="textAlignment">
- <set>AlignHCenter|AlignVCenter|AlignCenter</set>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Sample type</string>
- </property>
- <property name="textAlignment">
- <set>AlignHCenter|AlignVCenter|AlignCenter</set>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Sample size (bits)</string>
- </property>
- <property name="textAlignment">
- <set>AlignHCenter|AlignVCenter|AlignCenter</set>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Endianness</string>
- </property>
- <property name="textAlignment">
- <set>AlignHCenter|AlignVCenter|AlignCenter</set>
- </property>
- </column>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QStatusBar" name="statusbar"/>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/examples/audiodevices/main.cpp b/examples/audiodevices/main.cpp
deleted file mode 100644
index e64f2c5..0000000
--- a/examples/audiodevices/main.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "audiodevices.h"
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
- app.setApplicationName("Audio Device Test");
-
- AudioTest audio;
- audio.show();
-
- return app.exec();
-}
diff --git a/examples/audioinput/audioinput.cpp b/examples/audioinput/audioinput.cpp
deleted file mode 100644
index bedbd63..0000000
--- a/examples/audioinput/audioinput.cpp
+++ /dev/null
@@ -1,366 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <stdlib.h>
-#include <math.h>
-
-#include <QDebug>
-#include <QPainter>
-#include <QVBoxLayout>
-
-#include <qaudiodeviceinfo.h>
-#include <qaudioinput.h>
-
-#include <QtCore/qendian.h>
-
-#include "audioinput.h"
-
-const QString InputTest::PushModeLabel(tr("Enable push mode"));
-const QString InputTest::PullModeLabel(tr("Enable pull mode"));
-const QString InputTest::SuspendLabel(tr("Suspend recording"));
-const QString InputTest::ResumeLabel(tr("Resume recording"));
-
-const int BufferSize = 4096;
-
-AudioInfo::AudioInfo(const QAudioFormat &format, QObject *parent)
- : QIODevice(parent)
- , m_format(format)
- , m_maxAmplitude(0)
- , m_level(0.0)
-
-{
- switch (m_format.sampleSize()) {
- case 8:
- switch (m_format.sampleType()) {
- case QAudioFormat::UnSignedInt:
- m_maxAmplitude = 255;
- break;
- case QAudioFormat::SignedInt:
- m_maxAmplitude = 127;
- break;
- default:
- break;
- }
- break;
- case 16:
- switch (m_format.sampleType()) {
- case QAudioFormat::UnSignedInt:
- m_maxAmplitude = 65535;
- break;
- case QAudioFormat::SignedInt:
- m_maxAmplitude = 32767;
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
-}
-
-AudioInfo::~AudioInfo()
-{
-}
-
-void AudioInfo::start()
-{
- open(QIODevice::WriteOnly);
-}
-
-void AudioInfo::stop()
-{
- close();
-}
-
-qint64 AudioInfo::readData(char *data, qint64 maxlen)
-{
- Q_UNUSED(data)
- Q_UNUSED(maxlen)
-
- return 0;
-}
-
-qint64 AudioInfo::writeData(const char *data, qint64 len)
-{
- if (m_maxAmplitude) {
- Q_ASSERT(m_format.sampleSize() % 8 == 0);
- const int channelBytes = m_format.sampleSize() / 8;
- const int sampleBytes = m_format.channels() * channelBytes;
- Q_ASSERT(len % sampleBytes == 0);
- const int numSamples = len / sampleBytes;
-
- quint16 maxValue = 0;
- const unsigned char *ptr = reinterpret_cast<const unsigned char *>(data);
-
- for (int i = 0; i < numSamples; ++i) {
- for(int j = 0; j < m_format.channels(); ++j) {
- quint16 value = 0;
-
- if (m_format.sampleSize() == 8 && m_format.sampleType() == QAudioFormat::UnSignedInt) {
- value = *reinterpret_cast<const quint8*>(ptr);
- } else if (m_format.sampleSize() == 8 && m_format.sampleType() == QAudioFormat::SignedInt) {
- value = qAbs(*reinterpret_cast<const qint8*>(ptr));
- } else if (m_format.sampleSize() == 16 && m_format.sampleType() == QAudioFormat::UnSignedInt) {
- if (m_format.byteOrder() == QAudioFormat::LittleEndian)
- value = qFromLittleEndian<quint16>(ptr);
- else
- value = qFromBigEndian<quint16>(ptr);
- } else if (m_format.sampleSize() == 16 && m_format.sampleType() == QAudioFormat::SignedInt) {
- if (m_format.byteOrder() == QAudioFormat::LittleEndian)
- value = qAbs(qFromLittleEndian<qint16>(ptr));
- else
- value = qAbs(qFromBigEndian<qint16>(ptr));
- }
-
- maxValue = qMax(value, maxValue);
- ptr += channelBytes;
- }
- }
-
- maxValue = qMin(maxValue, m_maxAmplitude);
- m_level = qreal(maxValue) / m_maxAmplitude;
- }
-
- emit update();
- return len;
-}
-
-RenderArea::RenderArea(QWidget *parent)
- : QWidget(parent)
-{
- setBackgroundRole(QPalette::Base);
- setAutoFillBackground(true);
-
- m_level = 0;
- setMinimumHeight(30);
- setMinimumWidth(200);
-}
-
-void RenderArea::paintEvent(QPaintEvent * /* event */)
-{
- QPainter painter(this);
-
- painter.setPen(Qt::black);
- painter.drawRect(QRect(painter.viewport().left()+10,
- painter.viewport().top()+10,
- painter.viewport().right()-20,
- painter.viewport().bottom()-20));
- if (m_level == 0.0)
- return;
-
- int pos = ((painter.viewport().right()-20)-(painter.viewport().left()+11))*m_level;
- painter.fillRect(painter.viewport().left()+11,
- painter.viewport().top()+10,
- pos,
- painter.viewport().height()-21,
- Qt::red);
-}
-
-void RenderArea::setLevel(qreal value)
-{
- m_level = value;
- update();
-}
-
-
-InputTest::InputTest()
- : m_canvas(0)
- , m_modeButton(0)
- , m_suspendResumeButton(0)
- , m_deviceBox(0)
- , m_device(QAudioDeviceInfo::defaultInputDevice())
- , m_audioInfo(0)
- , m_audioInput(0)
- , m_input(0)
- , m_pullMode(false)
- , m_buffer(BufferSize, 0)
-{
- initializeWindow();
- initializeAudio();
-}
-
-InputTest::~InputTest() {}
-
-void InputTest::initializeWindow()
-{
- QScopedPointer<QWidget> window(new QWidget);
- QScopedPointer<QVBoxLayout> layout(new QVBoxLayout);
-
- m_canvas = new RenderArea(this);
- layout->addWidget(m_canvas);
-
- m_deviceBox = new QComboBox(this);
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
- for(int i = 0; i < devices.size(); ++i)
- m_deviceBox->addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i)));
-
- connect(m_deviceBox, SIGNAL(activated(int)), SLOT(deviceChanged(int)));
- layout->addWidget(m_deviceBox);
-
- m_modeButton = new QPushButton(this);
- m_modeButton->setText(PushModeLabel);
- connect(m_modeButton, SIGNAL(clicked()), SLOT(toggleMode()));
- layout->addWidget(m_modeButton);
-
- m_suspendResumeButton = new QPushButton(this);
- m_suspendResumeButton->setText(SuspendLabel);
- connect(m_suspendResumeButton, SIGNAL(clicked()), SLOT(toggleSuspend()));
- layout->addWidget(m_suspendResumeButton);
-
- window->setLayout(layout.data());
- layout.take(); // ownership transferred
-
- setCentralWidget(window.data());
- QWidget *const windowPtr = window.take(); // ownership transferred
- windowPtr->show();
-}
-
-void InputTest::initializeAudio()
-{
- m_pullMode = true;
-
- m_format.setFrequency(8000);
- m_format.setChannels(1);
- m_format.setSampleSize(16);
- m_format.setSampleType(QAudioFormat::SignedInt);
- m_format.setByteOrder(QAudioFormat::LittleEndian);
- m_format.setCodec("audio/pcm");
-
- QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice());
- if (!info.isFormatSupported(m_format)) {
- qWarning() << "Default format not supported - trying to use nearest";
- m_format = info.nearestFormat(m_format);
- }
-
- m_audioInfo = new AudioInfo(m_format, this);
- connect(m_audioInfo, SIGNAL(update()), SLOT(refreshDisplay()));
-
- createAudioInput();
-}
-
-void InputTest::createAudioInput()
-{
- m_audioInput = new QAudioInput(m_device, m_format, this);
- connect(m_audioInput, SIGNAL(notify()), SLOT(notified()));
- connect(m_audioInput, SIGNAL(stateChanged(QAudio::State)), SLOT(stateChanged(QAudio::State)));
- m_audioInfo->start();
- m_audioInput->start(m_audioInfo);
-}
-
-void InputTest::notified()
-{
- qWarning() << "bytesReady = " << m_audioInput->bytesReady()
- << ", " << "elapsedUSecs = " <<m_audioInput->elapsedUSecs()
- << ", " << "processedUSecs = "<<m_audioInput->processedUSecs();
-}
-
-void InputTest::readMore()
-{
- if(!m_audioInput)
- return;
- qint64 len = m_audioInput->bytesReady();
- if(len > BufferSize)
- len = BufferSize;
- qint64 l = m_input->read(m_buffer.data(), len);
- if(l > 0) {
- m_audioInfo->write(m_buffer.constData(), l);
- }
-}
-
-void InputTest::toggleMode()
-{
- // Change bewteen pull and push modes
- m_audioInput->stop();
-
- if (m_pullMode) {
- m_modeButton->setText(PullModeLabel);
- m_input = m_audioInput->start();
- connect(m_input, SIGNAL(readyRead()), SLOT(readMore()));
- m_pullMode = false;
- } else {
- m_modeButton->setText(PushModeLabel);
- m_pullMode = true;
- m_audioInput->start(m_audioInfo);
- }
-
- m_suspendResumeButton->setText(SuspendLabel);
-}
-
-void InputTest::toggleSuspend()
-{
- // toggle suspend/resume
- if(m_audioInput->state() == QAudio::SuspendedState) {
- qWarning() << "status: Suspended, resume()";
- m_audioInput->resume();
- m_suspendResumeButton->setText(SuspendLabel);
- } else if (m_audioInput->state() == QAudio::ActiveState) {
- qWarning() << "status: Active, suspend()";
- m_audioInput->suspend();
- m_suspendResumeButton->setText(ResumeLabel);
- } else if (m_audioInput->state() == QAudio::StoppedState) {
- qWarning() << "status: Stopped, resume()";
- m_audioInput->resume();
- m_suspendResumeButton->setText(SuspendLabel);
- } else if (m_audioInput->state() == QAudio::IdleState) {
- qWarning() << "status: IdleState";
- }
-}
-
-void InputTest::stateChanged(QAudio::State state)
-{
- qWarning() << "state = " << state;
-}
-
-void InputTest::refreshDisplay()
-{
- m_canvas->setLevel(m_audioInfo->level());
-}
-
-void InputTest::deviceChanged(int index)
-{
- m_audioInfo->stop();
- m_audioInput->stop();
- m_audioInput->disconnect(this);
- delete m_audioInput;
-
- m_device = m_deviceBox->itemData(index).value<QAudioDeviceInfo>();
- createAudioInput();
-}
diff --git a/examples/audioinput/audioinput.h b/examples/audioinput/audioinput.h
deleted file mode 100644
index c198304..0000000
--- a/examples/audioinput/audioinput.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef AUDIOINPUT_H
-#define AUDIOINPUT_H
-
-#include <QPixmap>
-#include <QWidget>
-#include <QObject>
-#include <QMainWindow>
-#include <QPushButton>
-#include <QComboBox>
-#include <QByteArray>
-
-#include <qaudioinput.h>
-
-class AudioInfo : public QIODevice
-{
- Q_OBJECT
-public:
- AudioInfo(const QAudioFormat &format, QObject *parent);
- ~AudioInfo();
-
- void start();
- void stop();
-
- qreal level() const { return m_level; }
-
- qint64 readData(char *data, qint64 maxlen);
- qint64 writeData(const char *data, qint64 len);
-
-private:
- const QAudioFormat m_format;
- quint16 m_maxAmplitude;
- qreal m_level; // 0.0 <= m_level <= 1.0
-
-signals:
- void update();
-};
-
-
-class RenderArea : public QWidget
-{
- Q_OBJECT
-
-public:
- RenderArea(QWidget *parent = 0);
-
- void setLevel(qreal value);
-
-protected:
- void paintEvent(QPaintEvent *event);
-
-private:
- qreal m_level;
- QPixmap m_pixmap;
-};
-
-class InputTest : public QMainWindow
-{
- Q_OBJECT
-public:
- InputTest();
- ~InputTest();
-
-private:
- void initializeWindow();
- void initializeAudio();
- void createAudioInput();
-
-private slots:
- void refreshDisplay();
- void notified();
- void readMore();
- void toggleMode();
- void toggleSuspend();
- void stateChanged(QAudio::State state);
- void deviceChanged(int index);
-
-private:
- // Owned by layout
- RenderArea *m_canvas;
- QPushButton *m_modeButton;
- QPushButton *m_suspendResumeButton;
- QComboBox *m_deviceBox;
-
- QAudioDeviceInfo m_device;
- AudioInfo *m_audioInfo;
- QAudioFormat m_format;
- QAudioInput *m_audioInput;
- QIODevice *m_input;
- bool m_pullMode;
- QByteArray m_buffer;
-
- static const QString PushModeLabel;
- static const QString PullModeLabel;
- static const QString SuspendLabel;
- static const QString ResumeLabel;
-};
-
-#endif
-
diff --git a/examples/audioinput/audioinput.pro b/examples/audioinput/audioinput.pro
deleted file mode 100644
index f4cdc31..0000000
--- a/examples/audioinput/audioinput.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TEMPLATE = app
-TARGET = audioinput
-
-QT += multimedia
-
-HEADERS = audioinput.h
-
-SOURCES = audioinput.cpp \
- main.cpp
-
-target.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/audioinput
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/audioinput
-
-INSTALLS += target sources
-
-QT+=widgets
diff --git a/examples/audioinput/main.cpp b/examples/audioinput/main.cpp
deleted file mode 100644
index a02c01e..0000000
--- a/examples/audioinput/main.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "audioinput.h"
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
- app.setApplicationName("Audio Input Test");
-
- InputTest input;
- input.show();
-
- return app.exec();
-}
diff --git a/examples/audiooutput/audiooutput.cpp b/examples/audiooutput/audiooutput.cpp
deleted file mode 100644
index b8193fb..0000000
--- a/examples/audiooutput/audiooutput.cpp
+++ /dev/null
@@ -1,334 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDebug>
-#include <QVBoxLayout>
-
-#include <qaudiooutput.h>
-#include <qaudiodeviceinfo.h>
-#include <QtCore/qmath.h>
-#include <QtCore/qendian.h>
-#include "audiooutput.h"
-
-const QString AudioTest::PushModeLabel(tr("Enable push mode"));
-const QString AudioTest::PullModeLabel(tr("Enable pull mode"));
-const QString AudioTest::SuspendLabel(tr("Suspend playback"));
-const QString AudioTest::ResumeLabel(tr("Resume playback"));
-const QString AudioTest::VolumeLabel(tr("Volume:"));
-
-const int DurationSeconds = 1;
-const int ToneFrequencyHz = 600;
-const int DataFrequencyHz = 44100;
-const int BufferSize = 32768;
-
-
-Generator::Generator(const QAudioFormat &format,
- qint64 durationUs,
- int frequency,
- QObject *parent)
- : QIODevice(parent)
- , m_pos(0)
-{
- generateData(format, durationUs, frequency);
-}
-
-Generator::~Generator()
-{
-
-}
-
-void Generator::start()
-{
- open(QIODevice::ReadOnly);
-}
-
-void Generator::stop()
-{
- m_pos = 0;
- close();
-}
-
-void Generator::generateData(const QAudioFormat &format, qint64 durationUs, int frequency)
-{
- const int channelBytes = format.sampleSize() / 8;
- const int sampleBytes = format.channels() * channelBytes;
-
- qint64 length = (format.frequency() * format.channels() * (format.sampleSize() / 8))
- * durationUs / 100000;
-
- Q_ASSERT(length % sampleBytes == 0);
- Q_UNUSED(sampleBytes) // suppress warning in release builds
-
- m_buffer.resize(length);
- unsigned char *ptr = reinterpret_cast<unsigned char *>(m_buffer.data());
- int sampleIndex = 0;
-
- while (length) {
- const qreal x = qSin(2 * M_PI * frequency * qreal(sampleIndex % format.frequency()) / format.frequency());
- for (int i=0; i<format.channels(); ++i) {
- if (format.sampleSize() == 8 && format.sampleType() == QAudioFormat::UnSignedInt) {
- const quint8 value = static_cast<quint8>((1.0 + x) / 2 * 255);
- *reinterpret_cast<quint8*>(ptr) = value;
- } else if (format.sampleSize() == 8 && format.sampleType() == QAudioFormat::SignedInt) {
- const qint8 value = static_cast<qint8>(x * 127);
- *reinterpret_cast<quint8*>(ptr) = value;
- } else if (format.sampleSize() == 16 && format.sampleType() == QAudioFormat::UnSignedInt) {
- quint16 value = static_cast<quint16>((1.0 + x) / 2 * 65535);
- if (format.byteOrder() == QAudioFormat::LittleEndian)
- qToLittleEndian<quint16>(value, ptr);
- else
- qToBigEndian<quint16>(value, ptr);
- } else if (format.sampleSize() == 16 && format.sampleType() == QAudioFormat::SignedInt) {
- qint16 value = static_cast<qint16>(x * 32767);
- if (format.byteOrder() == QAudioFormat::LittleEndian)
- qToLittleEndian<qint16>(value, ptr);
- else
- qToBigEndian<qint16>(value, ptr);
- }
-
- ptr += channelBytes;
- length -= channelBytes;
- }
- ++sampleIndex;
- }
-}
-
-qint64 Generator::readData(char *data, qint64 len)
-{
- qint64 total = 0;
- while (len - total > 0) {
- const qint64 chunk = qMin((m_buffer.size() - m_pos), len - total);
- memcpy(data + total, m_buffer.constData() + m_pos, chunk);
- m_pos = (m_pos + chunk) % m_buffer.size();
- total += chunk;
- }
- return total;
-}
-
-qint64 Generator::writeData(const char *data, qint64 len)
-{
- Q_UNUSED(data);
- Q_UNUSED(len);
-
- return 0;
-}
-
-qint64 Generator::bytesAvailable() const
-{
- return m_buffer.size() + QIODevice::bytesAvailable();
-}
-
-AudioTest::AudioTest()
- : m_pullTimer(new QTimer(this))
- , m_modeButton(0)
- , m_suspendResumeButton(0)
- , m_deviceBox(0)
- , m_device(QAudioDeviceInfo::defaultOutputDevice())
- , m_generator(0)
- , m_audioOutput(0)
- , m_output(0)
- , m_buffer(BufferSize, 0)
-{
- initializeWindow();
- initializeAudio();
-}
-
-void AudioTest::initializeWindow()
-{
- QScopedPointer<QWidget> window(new QWidget);
- QScopedPointer<QVBoxLayout> layout(new QVBoxLayout);
-
- m_deviceBox = new QComboBox(this);
- foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
- m_deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
- connect(m_deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int)));
- layout->addWidget(m_deviceBox);
-
- m_modeButton = new QPushButton(this);
- m_modeButton->setText(PushModeLabel);
- connect(m_modeButton, SIGNAL(clicked()), SLOT(toggleMode()));
- layout->addWidget(m_modeButton);
-
- m_suspendResumeButton = new QPushButton(this);
- m_suspendResumeButton->setText(SuspendLabel);
- connect(m_suspendResumeButton, SIGNAL(clicked()), SLOT(toggleSuspendResume()));
- layout->addWidget(m_suspendResumeButton);
-
- QHBoxLayout *volumeBox = new QHBoxLayout;
- m_volumeLabel = new QLabel;
- m_volumeLabel->setText(VolumeLabel);
- m_volumeSlider = new QSlider(Qt::Horizontal);
- m_volumeSlider->setMinimum(0);
- m_volumeSlider->setMaximum(100);
- m_volumeSlider->setSingleStep(10);
- connect(m_volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
- volumeBox->addWidget(m_volumeLabel);
- volumeBox->addWidget(m_volumeSlider);
- layout->addLayout(volumeBox);
-
- window->setLayout(layout.data());
- layout.take(); // ownership transferred
-
- setCentralWidget(window.data());
- QWidget *const windowPtr = window.take(); // ownership transferred
- windowPtr->show();
-}
-
-void AudioTest::initializeAudio()
-{
- connect(m_pullTimer, SIGNAL(timeout()), SLOT(pullTimerExpired()));
-
- m_pullMode = true;
-
- m_format.setFrequency(DataFrequencyHz);
- m_format.setChannels(1);
- m_format.setSampleSize(16);
- m_format.setCodec("audio/pcm");
- m_format.setByteOrder(QAudioFormat::LittleEndian);
- m_format.setSampleType(QAudioFormat::SignedInt);
-
- QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
- if (!info.isFormatSupported(m_format)) {
- qWarning() << "Default format not supported - trying to use nearest";
- m_format = info.nearestFormat(m_format);
- }
-
- m_generator = new Generator(m_format, DurationSeconds*1000000, ToneFrequencyHz, this);
-
- createAudioOutput();
-}
-
-void AudioTest::createAudioOutput()
-{
- delete m_audioOutput;
- m_audioOutput = 0;
- m_audioOutput = new QAudioOutput(m_device, m_format, this);
- connect(m_audioOutput, SIGNAL(notify()), SLOT(notified()));
- connect(m_audioOutput, SIGNAL(stateChanged(QAudio::State)), SLOT(stateChanged(QAudio::State)));
- m_generator->start();
- m_audioOutput->start(m_generator);
- m_volumeSlider->setValue(int(m_audioOutput->volume()*100.0f));
-}
-
-AudioTest::~AudioTest()
-{
-
-}
-
-void AudioTest::deviceChanged(int index)
-{
- m_pullTimer->stop();
- m_generator->stop();
- m_audioOutput->stop();
- m_audioOutput->disconnect(this);
- m_device = m_deviceBox->itemData(index).value<QAudioDeviceInfo>();
- createAudioOutput();
-}
-
-void AudioTest::volumeChanged(int value)
-{
- if (m_audioOutput)
- m_audioOutput->setVolume(qreal(value/100.0f));
-}
-
-void AudioTest::notified()
-{
- qWarning() << "bytesFree = " << m_audioOutput->bytesFree()
- << ", " << "elapsedUSecs = " << m_audioOutput->elapsedUSecs()
- << ", " << "processedUSecs = " << m_audioOutput->processedUSecs();
-}
-
-void AudioTest::pullTimerExpired()
-{
- if (m_audioOutput && m_audioOutput->state() != QAudio::StoppedState) {
- int chunks = m_audioOutput->bytesFree()/m_audioOutput->periodSize();
- while (chunks) {
- const qint64 len = m_generator->read(m_buffer.data(), m_audioOutput->periodSize());
- if (len)
- m_output->write(m_buffer.data(), len);
- if (len != m_audioOutput->periodSize())
- break;
- --chunks;
- }
- }
-}
-
-void AudioTest::toggleMode()
-{
- m_pullTimer->stop();
- m_audioOutput->stop();
-
- if (m_pullMode) {
- m_modeButton->setText(PullModeLabel);
- m_output = m_audioOutput->start();
- m_pullMode = false;
- m_pullTimer->start(20);
- } else {
- m_modeButton->setText(PushModeLabel);
- m_pullMode = true;
- m_audioOutput->start(m_generator);
- }
-
- m_suspendResumeButton->setText(SuspendLabel);
-}
-
-void AudioTest::toggleSuspendResume()
-{
- if (m_audioOutput->state() == QAudio::SuspendedState) {
- qWarning() << "status: Suspended, resume()";
- m_audioOutput->resume();
- m_suspendResumeButton->setText(SuspendLabel);
- } else if (m_audioOutput->state() == QAudio::ActiveState) {
- qWarning() << "status: Active, suspend()";
- m_audioOutput->suspend();
- m_suspendResumeButton->setText(ResumeLabel);
- } else if (m_audioOutput->state() == QAudio::StoppedState) {
- qWarning() << "status: Stopped, resume()";
- m_audioOutput->resume();
- m_suspendResumeButton->setText(SuspendLabel);
- } else if (m_audioOutput->state() == QAudio::IdleState) {
- qWarning() << "status: IdleState";
- }
-}
-
-void AudioTest::stateChanged(QAudio::State state)
-{
- qWarning() << "state = " << state;
-}
diff --git a/examples/audiooutput/audiooutput.h b/examples/audiooutput/audiooutput.h
deleted file mode 100644
index 3a07039..0000000
--- a/examples/audiooutput/audiooutput.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef AUDIOOUTPUT_H
-#define AUDIOOUTPUT_H
-
-#include <math.h>
-
-#include <QObject>
-#include <QMainWindow>
-#include <QLabel>
-#include <QSlider>
-#include <QIODevice>
-#include <QTimer>
-#include <QPushButton>
-#include <QComboBox>
-#include <QByteArray>
-
-#include <qaudiooutput.h>
-
-class Generator : public QIODevice
-{
- Q_OBJECT
-public:
- Generator(const QAudioFormat &format, qint64 durationUs, int frequency, QObject *parent);
- ~Generator();
-
- void start();
- void stop();
-
- qint64 readData(char *data, qint64 maxlen);
- qint64 writeData(const char *data, qint64 len);
- qint64 bytesAvailable() const;
-
-private:
- void generateData(const QAudioFormat &format, qint64 durationUs, int frequency);
-
-private:
- qint64 m_pos;
- QByteArray m_buffer;
-};
-
-class AudioTest : public QMainWindow
-{
- Q_OBJECT
-public:
- AudioTest();
- ~AudioTest();
-
-private:
- void initializeWindow();
- void initializeAudio();
- void createAudioOutput();
-
-private:
- QTimer* m_pullTimer;
-
- // Owned by layout
- QPushButton* m_modeButton;
- QPushButton* m_suspendResumeButton;
- QComboBox* m_deviceBox;
- QLabel* m_volumeLabel;
- QSlider* m_volumeSlider;
-
- QAudioDeviceInfo m_device;
- Generator* m_generator;
- QAudioOutput* m_audioOutput;
- QIODevice* m_output; // not owned
- QAudioFormat m_format;
-
- bool m_pullMode;
- QByteArray m_buffer;
-
- static const QString PushModeLabel;
- static const QString PullModeLabel;
- static const QString SuspendLabel;
- static const QString ResumeLabel;
- static const QString VolumeLabel;
-
-private slots:
- void notified();
- void pullTimerExpired();
- void toggleMode();
- void toggleSuspendResume();
- void stateChanged(QAudio::State state);
- void deviceChanged(int index);
- void volumeChanged(int);
-};
-
-#endif
-
diff --git a/examples/audiooutput/audiooutput.pro b/examples/audiooutput/audiooutput.pro
deleted file mode 100644
index f2a2244..0000000
--- a/examples/audiooutput/audiooutput.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TEMPLATE = app
-TARGET += audiooutput
-
-QT += multimedia
-
-HEADERS = audiooutput.h
-
-SOURCES = audiooutput.cpp \
- main.cpp
-
-target.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/audiooutput
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/audiooutput
-
-INSTALLS += target sources
-
-QT+=widgets
diff --git a/examples/audiooutput/main.cpp b/examples/audiooutput/main.cpp
deleted file mode 100644
index 0c18715..0000000
--- a/examples/audiooutput/main.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtWidgets>
-
-#include "audiooutput.h"
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
- app.setApplicationName("Audio Output Test");
-
- AudioTest audio;
- audio.show();
-
- return app.exec();
-}
diff --git a/examples/audiorecorder/audiorecorder.cpp b/examples/audiorecorder/audiorecorder.cpp
deleted file mode 100644
index ad4dc35..0000000
--- a/examples/audiorecorder/audiorecorder.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qdir.h>
-#include <QtWidgets/qfiledialog.h>
-
-#include <qaudiocapturesource.h>
-#include <qmediarecorder.h>
-
-#include "audiorecorder.h"
-
-#if defined(Q_WS_MAEMO_6)
-#include "ui_audiorecorder_small.h"
-#else
-#include "ui_audiorecorder.h"
-#endif
-
-AudioRecorder::AudioRecorder(QWidget *parent)
- :
- QMainWindow(parent),
- ui(new Ui::AudioRecorder),
- outputLocationSet(false)
-{
- ui->setupUi(this);
-
- audiosource = new QAudioCaptureSource(this);
- capture = new QMediaRecorder(audiosource, this);
-
- //audio devices
- ui->audioDeviceBox->addItem(tr("Default"), QVariant(QString()));
- foreach(const QString &device, audiosource->audioInputs()) {
- ui->audioDeviceBox->addItem(device, QVariant(device));
- }
-
- //audio codecs
- ui->audioCodecBox->addItem(tr("Default"), QVariant(QString()));
- foreach(const QString &codecName, capture->supportedAudioCodecs()) {
- ui->audioCodecBox->addItem(codecName, QVariant(codecName));
- }
-
- //containers
- ui->containerBox->addItem(tr("Default"), QVariant(QString()));
- foreach(const QString &containerName, capture->supportedContainers()) {
- ui->containerBox->addItem(containerName, QVariant(containerName));
- }
-
- //sample rate:
- ui->sampleRateBox->addItem(tr("Default"), QVariant(0));
- foreach(int sampleRate, capture->supportedAudioSampleRates()) {
- ui->sampleRateBox->addItem(QString::number(sampleRate), QVariant(
- sampleRate));
- }
-
- ui->qualitySlider->setRange(0, int(QtMultimedia::VeryHighQuality));
- ui->qualitySlider->setValue(int(QtMultimedia::NormalQuality));
-
- //bitrates:
- ui->bitrateBox->addItem(QString("Default"), QVariant(0));
- ui->bitrateBox->addItem(QString("32000"), QVariant(32000));
- ui->bitrateBox->addItem(QString("64000"), QVariant(64000));
- ui->bitrateBox->addItem(QString("96000"), QVariant(96000));
- ui->bitrateBox->addItem(QString("128000"), QVariant(128000));
-
- connect(capture, SIGNAL(durationChanged(qint64)), this,
- SLOT(updateProgress(qint64)));
- connect(capture, SIGNAL(stateChanged(QMediaRecorder::State)), this,
- SLOT(updateState(QMediaRecorder::State)));
- connect(capture, SIGNAL(error(QMediaRecorder::Error)), this,
- SLOT(displayErrorMessage()));
- }
-
-AudioRecorder::~AudioRecorder()
-{
- delete capture;
- delete audiosource;
-}
-
-void AudioRecorder::updateProgress(qint64 duration)
-{
- if (capture->error() != QMediaRecorder::NoError || duration < 2000)
- return;
-
- ui->statusbar->showMessage(tr("Recorded %1 sec").arg(duration / 1000));
-}
-
-void AudioRecorder::updateState(QMediaRecorder::State state)
-{
- QString statusMessage;
-
- switch (state) {
- case QMediaRecorder::RecordingState:
- ui->recordButton->setText(tr("Stop"));
- ui->pauseButton->setText(tr("Pause"));
- if (capture->outputLocation().isEmpty())
- statusMessage = tr("Recording");
- else
- statusMessage = tr("Recording to %1").arg(
- capture->outputLocation().toString());
- break;
- case QMediaRecorder::PausedState:
- ui->recordButton->setText(tr("Stop"));
- ui->pauseButton->setText(tr("Resume"));
- statusMessage = tr("Paused");
- break;
- case QMediaRecorder::StoppedState:
- ui->recordButton->setText(tr("Record"));
- ui->pauseButton->setText(tr("Pause"));
- statusMessage = tr("Stopped");
- }
-
- ui->pauseButton->setEnabled(state != QMediaRecorder::StoppedState);
-
- if (capture->error() == QMediaRecorder::NoError)
- ui->statusbar->showMessage(statusMessage);
-}
-
-static QVariant boxValue(const QComboBox *box)
-{
- int idx = box->currentIndex();
- if (idx == -1)
- return QVariant();
-
- return box->itemData(idx);
-}
-
-void AudioRecorder::toggleRecord()
-{
- if (capture->state() == QMediaRecorder::StoppedState) {
- audiosource->setAudioInput(boxValue(ui->audioDeviceBox).toString());
-
- if (!outputLocationSet)
- capture->setOutputLocation(generateAudioFilePath());
-
- QAudioEncoderSettings settings;
- settings.setCodec(boxValue(ui->audioCodecBox).toString());
- settings.setSampleRate(boxValue(ui->sampleRateBox).toInt());
- settings.setBitRate(boxValue(ui->bitrateBox).toInt());
- settings.setQuality(QtMultimedia::EncodingQuality(ui->qualitySlider->value()));
- settings.setEncodingMode(ui->constantQualityRadioButton->isChecked() ?
- QtMultimedia::ConstantQualityEncoding :
- QtMultimedia::ConstantBitRateEncoding);
-
- QString container = boxValue(ui->containerBox).toString();
-
- capture->setEncodingSettings(settings, QVideoEncoderSettings(), container);
- capture->record();
- }
- else {
- capture->stop();
- }
-}
-
-void AudioRecorder::togglePause()
-{
- if (capture->state() != QMediaRecorder::PausedState)
- capture->pause();
- else
- capture->record();
-}
-
-void AudioRecorder::setOutputLocation()
-{
- QString fileName = QFileDialog::getSaveFileName();
- capture->setOutputLocation(QUrl(fileName));
- outputLocationSet = true;
-}
-
-void AudioRecorder::displayErrorMessage()
-{
- ui->statusbar->showMessage(capture->errorString());
-}
-
-QUrl AudioRecorder::generateAudioFilePath()
-{
- QDir outputDir(QDir::rootPath());
-
- int lastImage = 0;
- int fileCount = 0;
- foreach(QString fileName, outputDir.entryList(QStringList() << "testclip_*")) {
- int imgNumber = fileName.mid(5, fileName.size() - 9).toInt();
- lastImage = qMax(lastImage, imgNumber);
- if (outputDir.exists(fileName))
- fileCount += 1;
- }
- lastImage += fileCount;
- QUrl location(QDir::toNativeSeparators(outputDir.canonicalPath() + QString("/testclip_%1").arg(lastImage + 1, 4, 10, QLatin1Char('0'))));
- return location;
-}
diff --git a/examples/audiorecorder/audiorecorder.h b/examples/audiorecorder/audiorecorder.h
deleted file mode 100644
index 51a777c..0000000
--- a/examples/audiorecorder/audiorecorder.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef AUDIORECORDER_H
-#define AUDIORECORDER_H
-
-#include <QtCore/qurl.h>
-#include <QtWidgets/qmainwindow.h>
-
-#include <qmediarecorder.h>
-
-
-QT_BEGIN_NAMESPACE
-
-namespace Ui {
- class AudioRecorder;
-}
-
-class QAudioCaptureSource;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-class AudioRecorder : public QMainWindow
-{
- Q_OBJECT
-public:
- AudioRecorder(QWidget *parent = 0);
- ~AudioRecorder();
-
-private slots:
- void setOutputLocation();
- void togglePause();
- void toggleRecord();
-
- void updateState(QMediaRecorder::State);
- void updateProgress(qint64 pos);
- void displayErrorMessage();
- QUrl generateAudioFilePath();
-
-private:
- Ui::AudioRecorder *ui;
-
- QAudioCaptureSource* audiosource;
- QMediaRecorder* capture;
- QAudioEncoderSettings audioSettings;
- bool outputLocationSet;
-
-};
-
-#endif
diff --git a/examples/audiorecorder/audiorecorder.pro b/examples/audiorecorder/audiorecorder.pro
deleted file mode 100644
index f2af638..0000000
--- a/examples/audiorecorder/audiorecorder.pro
+++ /dev/null
@@ -1,25 +0,0 @@
-TEMPLATE = app
-TARGET = audiorecorder
-
-QT += multimedia
-
-HEADERS = \
- audiorecorder.h
-
-SOURCES = \
- main.cpp \
- audiorecorder.cpp
-
-maemo*: {
- FORMS += audiorecorder_small.ui
-}else {
- FORMS += audiorecorder.ui
-}
-
-target.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/audiorecorder
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/audiorecorder
-
-INSTALLS += target sources
-
-QT+=widgets
diff --git a/examples/audiorecorder/audiorecorder.ui b/examples/audiorecorder/audiorecorder.ui
deleted file mode 100644
index 8ade5ce..0000000
--- a/examples/audiorecorder/audiorecorder.ui
+++ /dev/null
@@ -1,250 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AudioRecorder</class>
- <widget class="QMainWindow" name="AudioRecorder">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>297</width>
- <height>374</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>MainWindow</string>
- </property>
- <widget class="QWidget" name="centralwidget">
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0" colspan="3">
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Input Device:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="audioDeviceBox"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Audio Codec:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="audioCodecBox"/>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>File Container:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QComboBox" name="containerBox"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Sample rate:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QComboBox" name="sampleRateBox"/>
- </item>
- </layout>
- </item>
- <item row="1" column="0" colspan="3">
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Encoding Mode:</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="2">
- <widget class="QRadioButton" name="constantQualityRadioButton">
- <property name="text">
- <string>Constant Quality:</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="1">
- <widget class="QSlider" name="qualitySlider">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QRadioButton" name="constantBitrateRadioButton">
- <property name="text">
- <string>Constant Bitrate:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="3" column="1">
- <widget class="QComboBox" name="bitrateBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QPushButton" name="outputButton">
- <property name="text">
- <string>Output...</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QPushButton" name="recordButton">
- <property name="text">
- <string>Record</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QPushButton" name="pauseButton">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Pause</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QStatusBar" name="statusbar"/>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>constantQualityRadioButton</sender>
- <signal>toggled(bool)</signal>
- <receiver>qualitySlider</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>113</x>
- <y>197</y>
- </hint>
- <hint type="destinationlabel">
- <x>115</x>
- <y>223</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>constantBitrateRadioButton</sender>
- <signal>toggled(bool)</signal>
- <receiver>bitrateBox</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>173</x>
- <y>259</y>
- </hint>
- <hint type="destinationlabel">
- <x>190</x>
- <y>291</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>outputButton</sender>
- <signal>clicked()</signal>
- <receiver>AudioRecorder</receiver>
- <slot>setOutputLocation()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>46</x>
- <y>340</y>
- </hint>
- <hint type="destinationlabel">
- <x>6</x>
- <y>302</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>recordButton</sender>
- <signal>clicked()</signal>
- <receiver>AudioRecorder</receiver>
- <slot>toggleRecord()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>191</x>
- <y>340</y>
- </hint>
- <hint type="destinationlabel">
- <x>113</x>
- <y>317</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>pauseButton</sender>
- <signal>clicked()</signal>
- <receiver>AudioRecorder</receiver>
- <slot>togglePause()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>252</x>
- <y>334</y>
- </hint>
- <hint type="destinationlabel">
- <x>258</x>
- <y>346</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>setOutputLocation()</slot>
- <slot>toggleRecord()</slot>
- <slot>togglePause()</slot>
- </slots>
-</ui>
diff --git a/examples/audiorecorder/audiorecorder_small.ui b/examples/audiorecorder/audiorecorder_small.ui
deleted file mode 100644
index 9d23c42..0000000
--- a/examples/audiorecorder/audiorecorder_small.ui
+++ /dev/null
@@ -1,266 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AudioRecorder</class>
- <widget class="QMainWindow" name="AudioRecorder">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>420</width>
- <height>346</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>MainWindow</string>
- </property>
- <widget class="QWidget" name="centralwidget">
- <layout class="QGridLayout" name="gridLayout_5">
- <item row="0" column="0" colspan="3">
- <widget class="QScrollArea" name="scrollArea">
- <property name="focusPolicy">
- <enum>Qt::ClickFocus</enum>
- </property>
- <property name="widgetResizable">
- <bool>true</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>398</width>
- <height>275</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <widget class="QWidget" name="widget" native="true">
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Input Device:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="audioDeviceBox"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Audio Codec:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="audioCodecBox"/>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>File Container:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QComboBox" name="containerBox"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Sample rate:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QComboBox" name="sampleRateBox"/>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QRadioButton" name="constantQualityRadioButton">
- <property name="text">
- <string>Quality:</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QRadioButton" name="constantBitrateRadioButton">
- <property name="text">
- <string>Bitrate:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QSlider" name="qualitySlider">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="bitrateBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="0">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>29</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QPushButton" name="outputButton">
- <property name="text">
- <string>Output...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QPushButton" name="recordButton">
- <property name="text">
- <string>Record</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QPushButton" name="pauseButton">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Pause</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QStatusBar" name="statusbar"/>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>constantQualityRadioButton</sender>
- <signal>toggled(bool)</signal>
- <receiver>qualitySlider</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>113</x>
- <y>197</y>
- </hint>
- <hint type="destinationlabel">
- <x>115</x>
- <y>223</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>constantBitrateRadioButton</sender>
- <signal>toggled(bool)</signal>
- <receiver>bitrateBox</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>173</x>
- <y>259</y>
- </hint>
- <hint type="destinationlabel">
- <x>190</x>
- <y>291</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>outputButton</sender>
- <signal>clicked()</signal>
- <receiver>AudioRecorder</receiver>
- <slot>setOutputLocation()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>46</x>
- <y>340</y>
- </hint>
- <hint type="destinationlabel">
- <x>6</x>
- <y>302</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>recordButton</sender>
- <signal>clicked()</signal>
- <receiver>AudioRecorder</receiver>
- <slot>toggleRecord()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>191</x>
- <y>340</y>
- </hint>
- <hint type="destinationlabel">
- <x>113</x>
- <y>317</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>pauseButton</sender>
- <signal>clicked()</signal>
- <receiver>AudioRecorder</receiver>
- <slot>togglePause()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>252</x>
- <y>334</y>
- </hint>
- <hint type="destinationlabel">
- <x>258</x>
- <y>346</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>setOutputLocation()</slot>
- <slot>toggleRecord()</slot>
- <slot>togglePause()</slot>
- </slots>
-</ui>
diff --git a/examples/audiorecorder/main.cpp b/examples/audiorecorder/main.cpp
deleted file mode 100644
index 12c5648..0000000
--- a/examples/audiorecorder/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "audiorecorder.h"
-
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- AudioRecorder recorder;
- recorder.show();
-
- return app.exec();
-};
diff --git a/examples/camera/camera.cpp b/examples/camera/camera.cpp
deleted file mode 100644
index d30d6c1..0000000
--- a/examples/camera/camera.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camera.h"
-#include "ui_camera.h"
-#include "videosettings.h"
-#include "imagesettings.h"
-
-#include <qmediaservice.h>
-#include <qmediarecorder.h>
-#include <qcamera.h>
-#include <qcameraviewfinder.h>
-
-#include <qmessagebox.h>
-#include <qpalette.h>
-
-#include <QtWidgets>
-
-#if (defined(Q_WS_MAEMO_6)) && QT_VERSION >= 0x040700
-#define HAVE_CAMERA_BUTTONS
-#endif
-
-Camera::Camera(QWidget *parent) :
- QMainWindow(parent),
- ui(new Ui::Camera),
- camera(0),
- imageCapture(0),
- mediaRecorder(0),
- isCapturingImage(false),
- applicationExiting(false)
-{
- ui->setupUi(this);
-
- //Camera devices:
- QByteArray cameraDevice;
-
- QActionGroup *videoDevicesGroup = new QActionGroup(this);
- videoDevicesGroup->setExclusive(true);
- foreach(const QByteArray &deviceName, QCamera::availableDevices()) {
- QString description = camera->deviceDescription(deviceName);
- QAction *videoDeviceAction = new QAction(description, videoDevicesGroup);
- videoDeviceAction->setCheckable(true);
- videoDeviceAction->setData(QVariant(deviceName));
- if (cameraDevice.isEmpty()) {
- cameraDevice = deviceName;
- videoDeviceAction->setChecked(true);
- }
- ui->menuDevices->addAction(videoDeviceAction);
- }
-
- connect(videoDevicesGroup, SIGNAL(triggered(QAction*)), this, SLOT(updateCameraDevice(QAction*)));
- connect(ui->captureWidget, SIGNAL(currentChanged(int)), SLOT(updateCaptureMode()));
-
-#ifdef HAVE_CAMERA_BUTTONS
- ui->lockButton->hide();
-#endif
-
- setCamera(cameraDevice);
-}
-
-Camera::~Camera()
-{
- delete mediaRecorder;
- delete imageCapture;
- delete camera;
-}
-
-void Camera::setCamera(const QByteArray &cameraDevice)
-{
- delete imageCapture;
- delete mediaRecorder;
- delete camera;
-
- if (cameraDevice.isEmpty())
- camera = new QCamera;
- else
- camera = new QCamera(cameraDevice);
-
- connect(camera, SIGNAL(stateChanged(QCamera::State)), this, SLOT(updateCameraState(QCamera::State)));
- connect(camera, SIGNAL(error(QCamera::Error)), this, SLOT(displayCameraError()));
-
- mediaRecorder = new QMediaRecorder(camera);
- connect(mediaRecorder, SIGNAL(stateChanged(QMediaRecorder::State)), this, SLOT(updateRecorderState(QMediaRecorder::State)));
-
- imageCapture = new QCameraImageCapture(camera);
-
- connect(mediaRecorder, SIGNAL(durationChanged(qint64)), this, SLOT(updateRecordTime()));
- connect(mediaRecorder, SIGNAL(error(QMediaRecorder::Error)), this, SLOT(displayRecorderError()));
-
- mediaRecorder->setMetaData(QtMultimedia::Title, QVariant(QLatin1String("Test Title")));
-
- connect(ui->exposureCompensation, SIGNAL(valueChanged(int)), SLOT(setExposureCompensation(int)));
-
- camera->setViewfinder(ui->viewfinder);
-
- updateCameraState(camera->state());
- updateLockStatus(camera->lockStatus(), QCamera::UserRequest);
- updateRecorderState(mediaRecorder->state());
-
- connect(imageCapture, SIGNAL(readyForCaptureChanged(bool)), this, SLOT(readyForCapture(bool)));
- connect(imageCapture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(processCapturedImage(int,QImage)));
- connect(imageCapture, SIGNAL(imageSaved(int,QString)), this, SLOT(imageSaved(int,QString)));
-
- connect(camera, SIGNAL(lockStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)),
- this, SLOT(updateLockStatus(QCamera::LockStatus, QCamera::LockChangeReason)));
-
- ui->captureWidget->setTabEnabled(0, (camera->isCaptureModeSupported(QCamera::CaptureStillImage)));
- ui->captureWidget->setTabEnabled(1, (camera->isCaptureModeSupported(QCamera::CaptureVideo)));
-
- updateCaptureMode();
- camera->start();
-}
-
-void Camera::keyPressEvent(QKeyEvent * event)
-{
- if (event->isAutoRepeat())
- return;
-
- switch (event->key()) {
-#if QT_VERSION >= 0x040700
- case Qt::Key_CameraFocus:
- displayViewfinder();
- camera->searchAndLock();
- event->accept();
- break;
- case Qt::Key_Camera:
- if (camera->captureMode() == QCamera::CaptureStillImage) {
- takeImage();
- } else {
- if (mediaRecorder->state() == QMediaRecorder::RecordingState)
- stop();
- else
- record();
- }
- event->accept();
- break;
-#endif
- default:
- QMainWindow::keyPressEvent(event);
- }
-}
-
-void Camera::keyReleaseEvent(QKeyEvent * event)
-{
- if (event->isAutoRepeat())
- return;
-
- switch (event->key()) {
-#if QT_VERSION >= 0x040700
- case Qt::Key_CameraFocus:
- camera->unlock();
- break;
-#endif
- default:
- QMainWindow::keyReleaseEvent(event);
- }
-}
-
-void Camera::updateRecordTime()
-{
- QString str = QString("Recorded %1 sec").arg(mediaRecorder->duration()/1000);
- ui->statusbar->showMessage(str);
-}
-
-void Camera::processCapturedImage(int requestId, const QImage& img)
-{
- Q_UNUSED(requestId);
- QImage scaledImage = img.scaled(ui->viewfinder->size(),
- Qt::KeepAspectRatio,
- Qt::SmoothTransformation);
-
- ui->lastImagePreviewLabel->setPixmap(QPixmap::fromImage(scaledImage));
- //display captured image for 4 seconds
- displayCapturedImage();
- QTimer::singleShot(4000, this, SLOT(displayViewfinder()));
-}
-
-void Camera::configureCaptureSettings()
-{
- switch (camera->captureMode()) {
- case QCamera::CaptureStillImage:
- configureImageSettings();
- break;
- case QCamera::CaptureVideo:
- configureVideoSettings();
- break;
- default:
- break;
- }
-}
-
-void Camera::configureVideoSettings()
-{
- VideoSettings settingsDialog(mediaRecorder);
-
- settingsDialog.setAudioSettings(audioSettings);
- settingsDialog.setVideoSettings(videoSettings);
- settingsDialog.setFormat(videoContainerFormat);
-
- if (settingsDialog.exec()) {
- audioSettings = settingsDialog.audioSettings();
- videoSettings = settingsDialog.videoSettings();
- videoContainerFormat = settingsDialog.format();
-
- mediaRecorder->setEncodingSettings(
- audioSettings,
- videoSettings,
- videoContainerFormat);
- }
-}
-
-void Camera::configureImageSettings()
-{
- ImageSettings settingsDialog(imageCapture);
-
- settingsDialog.setImageSettings(imageSettings);
-
- if (settingsDialog.exec()) {
- imageSettings = settingsDialog.imageSettings();
- imageCapture->setEncodingSettings(imageSettings);
- }
-}
-
-void Camera::record()
-{
- mediaRecorder->record();
- updateRecordTime();
-}
-
-void Camera::pause()
-{
- mediaRecorder->pause();
-}
-
-void Camera::stop()
-{
- mediaRecorder->stop();
-}
-
-void Camera::setMuted(bool muted)
-{
- mediaRecorder->setMuted(muted);
-}
-
-void Camera::toggleLock()
-{
- switch (camera->lockStatus()) {
- case QCamera::Searching:
- case QCamera::Locked:
- camera->unlock();
- break;
- case QCamera::Unlocked:
- camera->searchAndLock();
- }
-}
-
-void Camera::updateLockStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason)
-{
- QColor indicationColor = Qt::black;
-
- switch (status) {
- case QCamera::Searching:
- indicationColor = Qt::yellow;
- ui->statusbar->showMessage(tr("Focusing..."));
- ui->lockButton->setText(tr("Focusing..."));
- break;
- case QCamera::Locked:
- indicationColor = Qt::darkGreen;
- ui->lockButton->setText(tr("Unlock"));
- ui->statusbar->showMessage(tr("Focused"), 2000);
- break;
- case QCamera::Unlocked:
- indicationColor = reason == QCamera::LockFailed ? Qt::red : Qt::black;
- ui->lockButton->setText(tr("Focus"));
- if (reason == QCamera::LockFailed)
- ui->statusbar->showMessage(tr("Focus Failed"), 2000);
- }
-
- QPalette palette = ui->lockButton->palette();
- palette.setColor(QPalette::ButtonText, indicationColor);
- ui->lockButton->setPalette(palette);
-}
-
-void Camera::takeImage()
-
-{
- isCapturingImage = true;
- imageCapture->capture();
-}
-
-void Camera::startCamera()
-{
- camera->start();
-}
-
-void Camera::stopCamera()
-{
- camera->stop();
-}
-
-void Camera::updateCaptureMode()
-{
- int tabIndex = ui->captureWidget->currentIndex();
- QCamera::CaptureMode captureMode = tabIndex == 0 ? QCamera::CaptureStillImage : QCamera::CaptureVideo;
-
- if (camera->isCaptureModeSupported(captureMode))
- camera->setCaptureMode(captureMode);
-}
-
-void Camera::updateCameraState(QCamera::State state)
-{
- switch (state) {
- case QCamera::ActiveState:
- ui->actionStartCamera->setEnabled(false);
- ui->actionStopCamera->setEnabled(true);
- ui->captureWidget->setEnabled(true);
- ui->actionSettings->setEnabled(true);
- break;
- case QCamera::UnloadedState:
- case QCamera::LoadedState:
- ui->actionStartCamera->setEnabled(true);
- ui->actionStopCamera->setEnabled(false);
- ui->captureWidget->setEnabled(false);
- ui->actionSettings->setEnabled(false);
- }
-}
-
-void Camera::updateRecorderState(QMediaRecorder::State state)
-{
- switch (state) {
- case QMediaRecorder::StoppedState:
- ui->recordButton->setEnabled(true);
- ui->pauseButton->setEnabled(true);
- ui->stopButton->setEnabled(false);
- break;
- case QMediaRecorder::PausedState:
- ui->recordButton->setEnabled(true);
- ui->pauseButton->setEnabled(false);
- ui->stopButton->setEnabled(true);
- break;
- case QMediaRecorder::RecordingState:
- ui->recordButton->setEnabled(false);
- ui->pauseButton->setEnabled(true);
- ui->stopButton->setEnabled(true);
- break;
- }
-}
-
-void Camera::setExposureCompensation(int index)
-{
- camera->exposure()->setExposureCompensation(index*0.5);
-}
-
-void Camera::displayRecorderError()
-{
- QMessageBox::warning(this, tr("Capture error"), mediaRecorder->errorString());
-}
-
-void Camera::displayCameraError()
-{
- QMessageBox::warning(this, tr("Camera error"), camera->errorString());
-}
-
-void Camera::updateCameraDevice(QAction *action)
-{
- setCamera(action->data().toByteArray());
-}
-
-void Camera::displayViewfinder()
-{
- ui->stackedWidget->setCurrentIndex(0);
-}
-
-void Camera::displayCapturedImage()
-{
- ui->stackedWidget->setCurrentIndex(1);
-}
-
-void Camera::readyForCapture(bool ready)
-{
- ui->takeImageButton->setEnabled(ready);
-}
-
-void Camera::imageSaved(int id, const QString &fileName)
-{
- Q_UNUSED(id);
- Q_UNUSED(fileName);
-
- isCapturingImage = false;
- if (applicationExiting)
- close();
-}
-
-void Camera::closeEvent(QCloseEvent *event)
-{
- if (isCapturingImage) {
- setEnabled(false);
- applicationExiting = true;
- event->ignore();
- } else {
- event->accept();
- }
-}
diff --git a/examples/camera/camera.h b/examples/camera/camera.h
deleted file mode 100644
index ee54409..0000000
--- a/examples/camera/camera.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERA_H
-#define CAMERA_H
-
-#include <qcamera.h>
-#include <qmediarecorder.h>
-#include <qcameraimagecapture.h>
-
-QT_BEGIN_NAMESPACE
-namespace Ui {
- class Camera;
-}
-class QCameraViewfinder;
-QT_END_NAMESPACE
-
-#include <QMainWindow>
-#include <QDir>
-
-QT_USE_NAMESPACE
-
-class Camera : public QMainWindow
-{
- Q_OBJECT
-public:
- Camera(QWidget *parent = 0);
- ~Camera();
-
-private slots:
- void setCamera(const QByteArray &cameraDevice);
-
- void startCamera();
- void stopCamera();
-
- void record();
- void pause();
- void stop();
- void setMuted(bool);
-
- void toggleLock();
- void takeImage();
-
- void configureCaptureSettings();
- void configureVideoSettings();
- void configureImageSettings();
-
- void displayRecorderError();
- void displayCameraError();
-
- void updateCameraDevice(QAction*);
-
- void updateCameraState(QCamera::State);
- void updateCaptureMode();
- void updateRecorderState(QMediaRecorder::State state);
- void setExposureCompensation(int index);
-
- void updateRecordTime();
-
- void processCapturedImage(int requestId, const QImage& img);
- void updateLockStatus(QCamera::LockStatus, QCamera::LockChangeReason);
-
- void displayViewfinder();
- void displayCapturedImage();
-
- void readyForCapture(bool);
- void imageSaved(int, const QString&);
-
-protected:
- void keyPressEvent(QKeyEvent * event);
- void keyReleaseEvent(QKeyEvent * event);
- void closeEvent(QCloseEvent *event );
-
-private:
- Ui::Camera *ui;
-
- QCamera *camera;
- QCameraImageCapture *imageCapture;
- QMediaRecorder* mediaRecorder;
-
- QImageEncoderSettings imageSettings;
- QAudioEncoderSettings audioSettings;
- QVideoEncoderSettings videoSettings;
- QString videoContainerFormat;
- bool isCapturingImage;
- bool applicationExiting;
-};
-
-#endif
diff --git a/examples/camera/camera.pro b/examples/camera/camera.pro
deleted file mode 100644
index f7dd8b7..0000000
--- a/examples/camera/camera.pro
+++ /dev/null
@@ -1,28 +0,0 @@
-TEMPLATE = app
-TARGET = camera
-
-QT += multimedia multimediawidgets
-
-HEADERS = \
- camera.h \
- imagesettings.h \
- videosettings.h
-
-SOURCES = \
- main.cpp \
- camera.cpp \
- imagesettings.cpp \
- videosettings.cpp
-
-FORMS += \
- camera.ui \
- videosettings.ui \
- imagesettings.ui
-
-target.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/camera
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/camera
-
-INSTALLS += target sources
-
-QT+=widgets
diff --git a/examples/camera/camera.ui b/examples/camera/camera.ui
deleted file mode 100644
index ea790fa..0000000
--- a/examples/camera/camera.ui
+++ /dev/null
@@ -1,492 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Camera</class>
- <widget class="QMainWindow" name="Camera">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>668</width>
- <height>422</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Camera</string>
- </property>
- <widget class="QWidget" name="centralwidget">
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0" rowspan="3">
- <widget class="QStackedWidget" name="stackedWidget">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="palette">
- <palette>
- <active>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>145</red>
- <green>145</green>
- <blue>145</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>145</red>
- <green>145</green>
- <blue>145</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>145</red>
- <green>145</green>
- <blue>145</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>145</red>
- <green>145</green>
- <blue>145</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="viewfinderPage">
- <layout class="QGridLayout" name="gridLayout_5">
- <item row="0" column="0">
- <widget class="QCameraViewfinder" name="viewfinder" native="true"/>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="previewPage">
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <widget class="QLabel" name="lastImagePreviewLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="frameShape">
- <enum>QFrame::Box</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item row="1" column="1" colspan="2">
- <widget class="QPushButton" name="lockButton">
- <property name="text">
- <string>Focus</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="2">
- <widget class="QTabWidget" name="captureWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab_2">
- <attribute name="title">
- <string>Image</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QPushButton" name="takeImageButton">
- <property name="text">
- <string>Capture Photo</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>161</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Exposure Compensation:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QSlider" name="exposureCompensation">
- <property name="minimum">
- <number>-4</number>
- </property>
- <property name="maximum">
- <number>4</number>
- </property>
- <property name="pageStep">
- <number>2</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Video</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QPushButton" name="recordButton">
- <property name="text">
- <string>Record</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QPushButton" name="pauseButton">
- <property name="text">
- <string>Pause</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QPushButton" name="stopButton">
- <property name="text">
- <string>Stop</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>76</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="4" column="0">
- <widget class="QPushButton" name="muteButton">
- <property name="text">
- <string>Mute</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QMenuBar" name="menubar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>668</width>
- <height>29</height>
- </rect>
- </property>
- <widget class="QMenu" name="menuFile">
- <property name="title">
- <string>File</string>
- </property>
- <addaction name="actionStartCamera"/>
- <addaction name="actionStopCamera"/>
- <addaction name="separator"/>
- <addaction name="actionSettings"/>
- <addaction name="separator"/>
- <addaction name="actionExit"/>
- </widget>
- <widget class="QMenu" name="menuDevices">
- <property name="title">
- <string>Devices</string>
- </property>
- </widget>
- <addaction name="menuFile"/>
- <addaction name="menuDevices"/>
- </widget>
- <widget class="QStatusBar" name="statusbar"/>
- <action name="actionExit">
- <property name="text">
- <string>Exit</string>
- </property>
- </action>
- <action name="actionStartCamera">
- <property name="text">
- <string>Start Camera</string>
- </property>
- </action>
- <action name="actionStopCamera">
- <property name="text">
- <string>Stop Camera</string>
- </property>
- </action>
- <action name="actionSettings">
- <property name="text">
- <string>Settings</string>
- </property>
- </action>
- </widget>
- <customwidgets>
- <customwidget>
- <class>QCameraViewfinder</class>
- <extends>QWidget</extends>
- <header>qcameraviewfinder.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections>
- <connection>
- <sender>recordButton</sender>
- <signal>clicked()</signal>
- <receiver>Camera</receiver>
- <slot>record()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>647</x>
- <y>149</y>
- </hint>
- <hint type="destinationlabel">
- <x>61</x>
- <y>238</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>stopButton</sender>
- <signal>clicked()</signal>
- <receiver>Camera</receiver>
- <slot>stop()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>647</x>
- <y>225</y>
- </hint>
- <hint type="destinationlabel">
- <x>140</x>
- <y>236</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>pauseButton</sender>
- <signal>clicked()</signal>
- <receiver>Camera</receiver>
- <slot>pause()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>647</x>
- <y>187</y>
- </hint>
- <hint type="destinationlabel">
- <x>234</x>
- <y>237</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>actionExit</sender>
- <signal>triggered()</signal>
- <receiver>Camera</receiver>
- <slot>close()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>-1</x>
- <y>-1</y>
- </hint>
- <hint type="destinationlabel">
- <x>154</x>
- <y>130</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>takeImageButton</sender>
- <signal>clicked()</signal>
- <receiver>Camera</receiver>
- <slot>takeImage()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>625</x>
- <y>132</y>
- </hint>
- <hint type="destinationlabel">
- <x>603</x>
- <y>169</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>lockButton</sender>
- <signal>clicked()</signal>
- <receiver>Camera</receiver>
- <slot>toggleLock()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>658</x>
- <y>75</y>
- </hint>
- <hint type="destinationlabel">
- <x>453</x>
- <y>119</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>muteButton</sender>
- <signal>toggled(bool)</signal>
- <receiver>Camera</receiver>
- <slot>setMuted(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>647</x>
- <y>377</y>
- </hint>
- <hint type="destinationlabel">
- <x>5</x>
- <y>280</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>exposureCompensation</sender>
- <signal>valueChanged(int)</signal>
- <receiver>Camera</receiver>
- <slot>setExposureCompensation(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>559</x>
- <y>367</y>
- </hint>
- <hint type="destinationlabel">
- <x>665</x>
- <y>365</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>actionSettings</sender>
- <signal>triggered()</signal>
- <receiver>Camera</receiver>
- <slot>configureCaptureSettings()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>-1</x>
- <y>-1</y>
- </hint>
- <hint type="destinationlabel">
- <x>333</x>
- <y>210</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>actionStartCamera</sender>
- <signal>triggered()</signal>
- <receiver>Camera</receiver>
- <slot>startCamera()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>-1</x>
- <y>-1</y>
- </hint>
- <hint type="destinationlabel">
- <x>333</x>
- <y>210</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>actionStopCamera</sender>
- <signal>triggered()</signal>
- <receiver>Camera</receiver>
- <slot>stopCamera()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>-1</x>
- <y>-1</y>
- </hint>
- <hint type="destinationlabel">
- <x>333</x>
- <y>210</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>record()</slot>
- <slot>pause()</slot>
- <slot>stop()</slot>
- <slot>enablePreview(bool)</slot>
- <slot>configureCaptureSettings()</slot>
- <slot>takeImage()</slot>
- <slot>startCamera()</slot>
- <slot>toggleLock()</slot>
- <slot>setMuted(bool)</slot>
- <slot>stopCamera()</slot>
- <slot>setExposureCompensation(int)</slot>
- </slots>
-</ui>
diff --git a/examples/camera/imagesettings.cpp b/examples/camera/imagesettings.cpp
deleted file mode 100644
index bb73f3a..0000000
--- a/examples/camera/imagesettings.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "imagesettings.h"
-#include "ui_imagesettings.h"
-
-#include <QtWidgets/qcombobox.h>
-#include <QtCore/qdebug.h>
-#include <qcameraimagecapture.h>
-#include <qmediaservice.h>
-
-
-
-ImageSettings::ImageSettings(QCameraImageCapture *imageCapture, QWidget *parent) :
- QDialog(parent),
- ui(new Ui::ImageSettingsUi),
- imagecapture(imageCapture)
-{
- ui->setupUi(this);
-
- //image codecs
- ui->imageCodecBox->addItem(tr("Default image format"), QVariant(QString()));
- foreach(const QString &codecName, imagecapture->supportedImageCodecs()) {
- QString description = imagecapture->imageCodecDescription(codecName);
- ui->imageCodecBox->addItem(codecName+": "+description, QVariant(codecName));
- }
-
- ui->imageQualitySlider->setRange(0, int(QtMultimedia::VeryHighQuality));
-
- ui->imageResolutionBox->addItem(tr("Default Resolution"));
- QList<QSize> supportedResolutions = imagecapture->supportedResolutions();
- foreach(const QSize &resolution, supportedResolutions) {
- ui->imageResolutionBox->addItem(QString("%1x%2").arg(resolution.width()).arg(resolution.height()),
- QVariant(resolution));
- }
-}
-
-ImageSettings::~ImageSettings()
-{
- delete ui;
-}
-
-void ImageSettings::changeEvent(QEvent *e)
-{
- QDialog::changeEvent(e);
- switch (e->type()) {
- case QEvent::LanguageChange:
- ui->retranslateUi(this);
- break;
- default:
- break;
- }
-}
-
-QImageEncoderSettings ImageSettings::imageSettings() const
-{
- QImageEncoderSettings settings = imagecapture->encodingSettings();
- settings.setCodec(boxValue(ui->imageCodecBox).toString());
- settings.setQuality(QtMultimedia::EncodingQuality(ui->imageQualitySlider->value()));
- settings.setResolution(boxValue(ui->imageResolutionBox).toSize());
-
- return settings;
-}
-
-void ImageSettings::setImageSettings(const QImageEncoderSettings &imageSettings)
-{
- selectComboBoxItem(ui->imageCodecBox, QVariant(imageSettings.codec()));
- selectComboBoxItem(ui->imageResolutionBox, QVariant(imageSettings.resolution()));
- ui->imageQualitySlider->setValue(imageSettings.quality());
-}
-
-QVariant ImageSettings::boxValue(const QComboBox *box) const
-{
- int idx = box->currentIndex();
- if (idx == -1)
- return QVariant();
-
- return box->itemData(idx);
-}
-
-void ImageSettings::selectComboBoxItem(QComboBox *box, const QVariant &value)
-{
- for (int i=0; i<box->count(); i++) {
- if (box->itemData(i) == value) {
- box->setCurrentIndex(i);
- break;
- }
- }
-}
diff --git a/examples/camera/imagesettings.h b/examples/camera/imagesettings.h
deleted file mode 100644
index 74bca37..0000000
--- a/examples/camera/imagesettings.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef IMAGESETTINGS_H
-#define IMAGESETTINGS_H
-
-#include <QtWidgets/QDialog>
-#include <qmediaencodersettings.h>
-
-QT_BEGIN_NAMESPACE
-class QComboBox;
-namespace Ui {
- class ImageSettingsUi;
-}
-
-class QCameraImageCapture;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-class ImageSettings : public QDialog {
- Q_OBJECT
-public:
- ImageSettings(QCameraImageCapture *imageCapture, QWidget *parent = 0);
- ~ImageSettings();
-
- QAudioEncoderSettings audioSettings() const;
- void setAudioSettings(const QAudioEncoderSettings&);
-
- QImageEncoderSettings imageSettings() const;
- void setImageSettings(const QImageEncoderSettings&);
-
- QString format() const;
- void setFormat(const QString &format);
-
-protected:
- void changeEvent(QEvent *e);
-
-private:
- QVariant boxValue(const QComboBox*) const;
- void selectComboBoxItem(QComboBox *box, const QVariant &value);
-
- Ui::ImageSettingsUi *ui;
- QCameraImageCapture *imagecapture;
-};
-
-#endif // IMAGESETTINGS_H
diff --git a/examples/camera/imagesettings.ui b/examples/camera/imagesettings.ui
deleted file mode 100644
index f790c77..0000000
--- a/examples/camera/imagesettings.ui
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ImageSettingsUi</class>
- <widget class="QDialog" name="ImageSettingsUi">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>332</width>
- <height>270</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Dialog</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>Image</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0" colspan="2">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Resolution:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QComboBox" name="imageResolutionBox"/>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Image Format:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="2">
- <widget class="QComboBox" name="imageCodecBox"/>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>Quality:</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QSlider" name="imageQualitySlider">
- <property name="maximum">
- <number>4</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="0">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>14</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>ImageSettingsUi</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>322</x>
- <y>272</y>
- </hint>
- <hint type="destinationlabel">
- <x>44</x>
- <y>230</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>ImageSettingsUi</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>405</x>
- <y>262</y>
- </hint>
- <hint type="destinationlabel">
- <x>364</x>
- <y>227</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/camera/main.cpp b/examples/camera/main.cpp
deleted file mode 100644
index af2fa4c..0000000
--- a/examples/camera/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camera.h"
-
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- Camera camera;
- camera.show();
-
- return app.exec();
-};
diff --git a/examples/camera/videosettings.cpp b/examples/camera/videosettings.cpp
deleted file mode 100644
index f97f4ad..0000000
--- a/examples/camera/videosettings.cpp
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "videosettings.h"
-#include "ui_videosettings.h"
-
-#include <QtWidgets/qcombobox.h>
-#include <QtCore/qdebug.h>
-#include <qmediarecorder.h>
-#include <qmediaservice.h>
-
-
-VideoSettings::VideoSettings(QMediaRecorder *mediaRecorder, QWidget *parent) :
- QDialog(parent),
- ui(new Ui::VideoSettingsUi),
- mediaRecorder(mediaRecorder)
-{
- ui->setupUi(this);
-
- //audio codecs
- ui->audioCodecBox->addItem(tr("Default audio codec"), QVariant(QString()));
- foreach(const QString &codecName, mediaRecorder->supportedAudioCodecs()) {
- QString description = mediaRecorder->audioCodecDescription(codecName);
- ui->audioCodecBox->addItem(codecName+": "+description, QVariant(codecName));
- }
-
- //sample rate:
- foreach(int sampleRate, mediaRecorder->supportedAudioSampleRates()) {
- ui->audioSampleRateBox->addItem(QString::number(sampleRate), QVariant(sampleRate));
- }
-
- ui->audioQualitySlider->setRange(0, int(QtMultimedia::VeryHighQuality));
-
- //video codecs
- ui->videoCodecBox->addItem(tr("Default video codec"), QVariant(QString()));
- foreach(const QString &codecName, mediaRecorder->supportedVideoCodecs()) {
- QString description = mediaRecorder->videoCodecDescription(codecName);
- ui->videoCodecBox->addItem(codecName+": "+description, QVariant(codecName));
- }
-
- ui->videoQualitySlider->setRange(0, int(QtMultimedia::VeryHighQuality));
-
-
- ui->videoResolutionBox->addItem(tr("Default"));
- QList<QSize> supportedResolutions = mediaRecorder->supportedResolutions();
- foreach(const QSize &resolution, supportedResolutions) {
- ui->videoResolutionBox->addItem(QString("%1x%2").arg(resolution.width()).arg(resolution.height()),
- QVariant(resolution));
- }
-
- ui->videoFramerateBox->addItem(tr("Default"));
- QList<qreal> supportedFrameRates = mediaRecorder->supportedFrameRates();
- qreal rate;
- foreach(rate, supportedFrameRates) {
- QString rateString = QString("%1").arg(rate, 0, 'f', 2);
- ui->videoFramerateBox->addItem(rateString, QVariant(rate));
- }
-
- //containers
- ui->containerFormatBox->addItem(tr("Default container"), QVariant(QString()));
- foreach(const QString &format, mediaRecorder->supportedContainers()) {
- ui->containerFormatBox->addItem(format+":"+mediaRecorder->containerDescription(format),
- QVariant(format));
- }
-}
-
-VideoSettings::~VideoSettings()
-{
- delete ui;
-}
-
-void VideoSettings::changeEvent(QEvent *e)
-{
- QDialog::changeEvent(e);
- switch (e->type()) {
- case QEvent::LanguageChange:
- ui->retranslateUi(this);
- break;
- default:
- break;
- }
-}
-
-QAudioEncoderSettings VideoSettings::audioSettings() const
-{
- QAudioEncoderSettings settings = mediaRecorder->audioSettings();
- settings.setCodec(boxValue(ui->audioCodecBox).toString());
- settings.setQuality(QtMultimedia::EncodingQuality(ui->audioQualitySlider->value()));
- settings.setSampleRate(boxValue(ui->audioSampleRateBox).toInt());
- return settings;
-}
-
-void VideoSettings::setAudioSettings(const QAudioEncoderSettings &audioSettings)
-{
- selectComboBoxItem(ui->audioCodecBox, QVariant(audioSettings.codec()));
- selectComboBoxItem(ui->audioSampleRateBox, QVariant(audioSettings.sampleRate()));
- ui->audioQualitySlider->setValue(audioSettings.quality());
-}
-
-QVideoEncoderSettings VideoSettings::videoSettings() const
-{
- QVideoEncoderSettings settings = mediaRecorder->videoSettings();
- settings.setCodec(boxValue(ui->videoCodecBox).toString());
- settings.setQuality(QtMultimedia::EncodingQuality(ui->videoQualitySlider->value()));
- settings.setResolution(boxValue(ui->videoResolutionBox).toSize());
- settings.setFrameRate(boxValue(ui->videoFramerateBox).value<qreal>());
-
- return settings;
-}
-
-void VideoSettings::setVideoSettings(const QVideoEncoderSettings &videoSettings)
-{
- selectComboBoxItem(ui->videoCodecBox, QVariant(videoSettings.codec()));
- selectComboBoxItem(ui->videoResolutionBox, QVariant(videoSettings.resolution()));
- ui->videoQualitySlider->setValue(videoSettings.quality());
-
- //special case for frame rate
- for (int i=0; i<ui->videoFramerateBox->count(); i++) {
- qreal itemRate = ui->videoFramerateBox->itemData(i).value<qreal>();
- if (qFuzzyCompare(itemRate, videoSettings.frameRate())) {
- ui->videoFramerateBox->setCurrentIndex(i);
- break;
- }
- }
-}
-
-QString VideoSettings::format() const
-{
- return boxValue(ui->containerFormatBox).toString();
-}
-
-void VideoSettings::setFormat(const QString &format)
-{
- selectComboBoxItem(ui->containerFormatBox, QVariant(format));
-}
-
-QVariant VideoSettings::boxValue(const QComboBox *box) const
-{
- int idx = box->currentIndex();
- if (idx == -1)
- return QVariant();
-
- return box->itemData(idx);
-}
-
-void VideoSettings::selectComboBoxItem(QComboBox *box, const QVariant &value)
-{
- for (int i=0; i<box->count(); i++) {
- if (box->itemData(i) == value) {
- box->setCurrentIndex(i);
- break;
- }
- }
-}
diff --git a/examples/camera/videosettings.h b/examples/camera/videosettings.h
deleted file mode 100644
index 6cce31d..0000000
--- a/examples/camera/videosettings.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VIDEOSETTINGS_H
-#define VIDEOSETTINGS_H
-
-#include <QtWidgets/QDialog>
-#include <qmediaencodersettings.h>
-
-QT_BEGIN_NAMESPACE
-class QComboBox;
-namespace Ui {
- class VideoSettingsUi;
-}
-
-class QMediaRecorder;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-class VideoSettings : public QDialog {
- Q_OBJECT
-public:
- VideoSettings(QMediaRecorder *mediaRecorder, QWidget *parent = 0);
- ~VideoSettings();
-
- QAudioEncoderSettings audioSettings() const;
- void setAudioSettings(const QAudioEncoderSettings&);
-
- QVideoEncoderSettings videoSettings() const;
- void setVideoSettings(const QVideoEncoderSettings&);
-
- QString format() const;
- void setFormat(const QString &format);
-
-protected:
- void changeEvent(QEvent *e);
-
-private:
- QVariant boxValue(const QComboBox*) const;
- void selectComboBoxItem(QComboBox *box, const QVariant &value);
-
- Ui::VideoSettingsUi *ui;
- QMediaRecorder *mediaRecorder;
-};
-
-#endif // VIDEOSETTINGS_H
diff --git a/examples/camera/videosettings.ui b/examples/camera/videosettings.ui
deleted file mode 100644
index f6aa004..0000000
--- a/examples/camera/videosettings.ui
+++ /dev/null
@@ -1,211 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>VideoSettingsUi</class>
- <widget class="QDialog" name="VideoSettingsUi">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>561</width>
- <height>369</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Dialog</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <widget class="QScrollArea" name="scrollArea">
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="widgetResizable">
- <bool>true</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>543</width>
- <height>250</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Audio</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="2">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Audio Codec:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QComboBox" name="audioCodecBox"/>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Sample Rate:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="2">
- <widget class="QComboBox" name="audioSampleRateBox"/>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Quality:</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QSlider" name="audioQualitySlider">
- <property name="maximum">
- <number>4</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="1" rowspan="3">
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>Video</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0" colspan="2">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Resolution:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QComboBox" name="videoResolutionBox"/>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Framerate:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="2">
- <widget class="QComboBox" name="videoFramerateBox"/>
- </item>
- <item row="4" column="0" colspan="2">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Video Codec:</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0" colspan="2">
- <widget class="QComboBox" name="videoCodecBox"/>
- </item>
- <item row="6" column="0">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>Quality:</string>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="QSlider" name="videoQualitySlider">
- <property name="maximum">
- <number>4</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Container Format:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QComboBox" name="containerFormatBox"/>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item row="1" column="0">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>14</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>VideoSettingsUi</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>322</x>
- <y>272</y>
- </hint>
- <hint type="destinationlabel">
- <x>44</x>
- <y>230</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>VideoSettingsUi</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>405</x>
- <y>262</y>
- </hint>
- <hint type="destinationlabel">
- <x>364</x>
- <y>227</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/declarative-camera/CameraButton.qml b/examples/declarative-camera/CameraButton.qml
deleted file mode 100644
index 4b2c663..0000000
--- a/examples/declarative-camera/CameraButton.qml
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-
-Item {
- id: button
-
- signal clicked
-
- property string text
- property color color: "white"
-
- width : 144
- height: 70
-
- BorderImage {
- id: buttonImage
- source: "images/toolbutton.sci"
- width: button.width; height: button.height
- }
- MouseArea {
- id: mouseRegion
- anchors.fill: buttonImage
- onClicked: { button.clicked(); }
- }
- Text {
- id: btnText
- color: button.color
- anchors.centerIn: buttonImage; font.bold: true
- text: button.text; style: Text.Raised; styleColor: "black"
- font.pixelSize: 14
- }
-}
diff --git a/examples/declarative-camera/CameraPropertyButton.qml b/examples/declarative-camera/CameraPropertyButton.qml
deleted file mode 100644
index 152bb93..0000000
--- a/examples/declarative-camera/CameraPropertyButton.qml
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-import QtMultimedia 4.0
-
-Item {
- id: propertyButton
- property alias value : popup.currentValue
- property alias model : popup.model
-
- width : 144
- height: 70
-
- BorderImage {
- id: buttonImage
- source: "images/toolbutton.sci"
- width: propertyButton.width; height: propertyButton.height
- }
-
- CameraButton {
- anchors.fill: parent
- Image {
- anchors.centerIn: parent
- source: popup.currentItem.icon
- }
-
- onClicked: popup.toggle()
- }
-
- CameraPropertyPopup {
- id: popup
- anchors.right: parent.left
- anchors.rightMargin: 16
- anchors.top: parent.top
- state: "invisible"
- visible: opacity > 0
-
- currentValue: propertyButton.value
-
- states: [
- State {
- name: "invisible"
- PropertyChanges { target: popup; opacity: 0 }
- PropertyChanges { target: camera; focus: true }
- },
-
- State {
- name: "visible"
- PropertyChanges { target: popup; opacity: 1.0 }
- }
- ]
-
- transitions: Transition {
- NumberAnimation { properties: "opacity"; duration: 100 }
- }
-
- function toggle() {
- if (state == "visible")
- state = "invisible";
- else
- state = "visible";
- }
-
- onSelected: {
- popup.state = "invisible"
- }
- }
-}
-
diff --git a/examples/declarative-camera/CameraPropertyPopup.qml b/examples/declarative-camera/CameraPropertyPopup.qml
deleted file mode 100644
index f101b69..0000000
--- a/examples/declarative-camera/CameraPropertyPopup.qml
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-
-Rectangle {
- id: propertyPopup
-
- property alias model : view.model
- property variant currentValue
- property variant currentItem : model.get(view.currentIndex)
-
- property int itemWidth : 100
- property int itemHeight : 70
- property int columns : 2
-
- width: columns*itemWidth + view.anchors.margins*2
- height: Math.ceil(model.count/columns)*itemHeight + view.anchors.margins*2 + 25
-
- radius: 5
- border.color: "#000000"
- border.width: 2
- smooth: true
- color: "#5e5e5e"
-
- signal selected
-
- function indexForValue(value) {
- for (var i = 0; i < view.count; i++) {
- if (model.get(i).value == value) {
- return i;
- }
- }
-
- return 0;
- }
-
- GridView {
- id: view
- anchors.fill: parent
- anchors.margins: 5
- cellWidth: propertyPopup.itemWidth
- cellHeight: propertyPopup.itemHeight
- snapMode: ListView.SnapOneItem
- highlightFollowsCurrentItem: true
- highlight: Rectangle { color: "gray"; radius: 5 }
- currentIndex: indexForValue(propertyPopup.currentValue)
-
- onCurrentIndexChanged: {
- propertyPopup.currentValue = model.get(view.currentIndex).value
- }
-
- delegate: Item {
- width: propertyPopup.itemWidth
- height: 70
-
- Image {
- anchors.centerIn: parent
- source: icon
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- propertyPopup.currentValue = value
- propertyPopup.selected(value)
- }
- }
- }
- }
-
- Text {
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 8
- anchors.left: parent.left
- anchors.leftMargin: 16
-
- color: "#ffffff"
- font.bold: true
- style: Text.Raised;
- styleColor: "black"
- font.pixelSize: 14
-
- text: view.model.get(view.currentIndex).text
- }
-}
diff --git a/examples/declarative-camera/CaptureControls.qml b/examples/declarative-camera/CaptureControls.qml
deleted file mode 100644
index 6120dad..0000000
--- a/examples/declarative-camera/CaptureControls.qml
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-import QtMultimedia 4.0
-
-FocusScope {
- property Camera camera
- property bool previewAvailable : false
-
- property alias whiteBalance : wbModesButton.value
- property alias flashMode : flashModesButton.value
- property alias exposureCompensation : exposureCompensationButton.value
-
- property int buttonsPanelWidth: buttonPaneShadow.width
-
- signal previewSelected
- id : captureControls
-
- Rectangle {
- id: buttonPaneShadow
- width: buttonPanningPane.width + 16
- height: parent.height
- anchors.top: parent.top
- anchors.right: parent.right
- color: Qt.rgba(0.08, 0.08, 0.08, 1)
-
- Flickable {
- id: buttonPanningPane
- anchors {
- right: parent.right
- top: parent.top
- bottom: parent.bottom
- margins: 8
- }
- width: buttonsColumn.width
-
- contentWidth: buttonsColumn.width
- contentHeight: buttonsColumn.height
-
- Column {
- id: buttonsColumn
- spacing: 8
-
- FocusButton {
- camera: captureControls.camera
- }
-
- CameraButton {
- text: "Capture"
- onClicked: camera.captureImage()
- }
-
- CameraPropertyButton {
- id : flashModesButton
- value: Camera.FlashOff
- model: ListModel {
- ListElement {
- icon: "images/camera_flash_auto.png"
- value: Camera.FlashAuto
- text: "Auto"
- }
- ListElement {
- icon: "images/camera_flash_off.png"
- value: Camera.FlashOff
- text: "Off"
- }
- ListElement {
- icon: "images/camera_flash_fill.png"
- value: Camera.FlashOn
- text: "On"
- }
- ListElement {
- icon: "images/camera_flash_redeye.png"
- value: Camera.FlashRedEyeReduction
- text: "Red Eye Reduction"
- }
- }
- }
-
- CameraPropertyButton {
- id : wbModesButton
- value: Camera.WhiteBalanceAuto
- model: ListModel {
- ListElement {
- icon: "images/camera_auto_mode.png"
- value: Camera.WhiteBalanceAuto
- text: "Auto"
- }
- ListElement {
- icon: "images/camera_white_balance_sunny.png"
- value: Camera.WhiteBalanceSunlight
- text: "Sunlight"
- }
- ListElement {
- icon: "images/camera_white_balance_cloudy.png"
- value: Camera.WhiteBalanceCloudy
- text: "Cloudy"
- }
- ListElement {
- icon: "images/camera_white_balance_incandescent.png"
- value: Camera.WhiteBalanceTungsten
- text: "Tungsten"
- }
- ListElement {
- icon: "images/camera_white_balance_flourescent.png"
- value: Camera.WhiteBalanceFluorescent
- text: "Fluorescent"
- }
- }
- }
-
- ExposureCompensationButton {
- id : exposureCompensationButton
- }
-
- CameraButton {
- text: "View"
- onClicked: captureControls.previewSelected()
- visible: captureControls.previewAvailable
- }
-
- CameraButton {
- id: quitButton
- text: "Quit"
- onClicked: Qt.quit()
- }
-
- }
- }
- }
-
-
- Item {
- id: exposureDetails
- anchors.bottom : parent.bottom
- anchors.left : parent.left
- anchors.bottomMargin: 16
- anchors.leftMargin: 16
- height: childrenRect.height
- width: childrenRect.width
-
- visible : camera.lockStatus == Camera.Locked
-
- Rectangle {
- opacity: 0.4
- color: "black"
- anchors.fill: parent
- }
-
- Row {
- spacing : 16
-
- Text {
- text: "Av: "+camera.aperture.toFixed(1)
- font.pixelSize: 18
- color: "white"
- visible: camera.aperture > 0
- }
-
- Text {
- font.pixelSize: 18
- color: "white"
- visible: camera.shutterSpped > 0
- text: "Tv: "+printableExposureTime(camera.shutterSpeed)
-
- function printableExposureTime(t) {
- if (t > 3.9)
- return "Tv: "+t.toFixed() + "\"";
-
- if (t > 0.24 )
- return "Tv: "+t.toFixed(1) + "\"";
-
- if (t > 0)
- return "Tv: 1/"+(1/t).toFixed();
-
- return "";
- }
- }
-
- Text {
- text: "ISO: "+camera.iso.toFixed()
- font.pixelSize: 18
- color: "white"
- visible: camera.iso > 0
- }
- }
- }
-
- ZoomControl {
- x : 0
- y : 0
- width : 100
- height: parent.height
-
- currentZoom: camera.digitalZoom
- maximumZoom: Math.min(4.0, camera.maximumDigitalZoom)
- onZoomTo: camera.setDigitalZoom(value)
- }
-}
diff --git a/examples/declarative-camera/ExposureCompensationButton.qml b/examples/declarative-camera/ExposureCompensationButton.qml
deleted file mode 100644
index cf6fc5d..0000000
--- a/examples/declarative-camera/ExposureCompensationButton.qml
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-
-Item {
- id: exposureCompensation
- property real value : flickableList.items[flickableList.index]
- signal clicked
-
- width : 144
- height: 70
-
- BorderImage {
- id: buttonImage
- source: "images/toolbutton.sci"
- width: exposureCompensation.width; height: exposureCompensation.height
- }
-
- Text {
- text: "Ev:"
- x: 8
- y: 8
- font.pixelSize: 18
- color: "white"
- }
-
- FlickableList {
- anchors.fill: buttonImage
- id: flickableList
- items: ["-2", "-1.5", "-1", "-0.5", "0", "+0.5", "+1", "+1.5", "+2"]
- index: 4
-
- onClicked: exposureCompensation.clicked()
-
- delegate: Text {
- font.pixelSize: 22
- color: "white"
- styleColor: "black"
- width: flickableList.width
- height: flickableList.height
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- text: flickableList.items[index]
- }
- }
-}
-
diff --git a/examples/declarative-camera/FlickableList.qml b/examples/declarative-camera/FlickableList.qml
deleted file mode 100644
index d39519e..0000000
--- a/examples/declarative-camera/FlickableList.qml
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-
-Item {
- id: flickableList
- clip: true
-
- signal clicked
-
- property alias delegate : repeater.delegate
-
- property variant items: []
- property int index: 0
- property int itemWidth : flickableList.width
-
- function scrollTo(id) {
- var x = id*flickableList.itemWidth
- if (flickArea.contentX != x) {
- centeringAnimation.stop();
- flickArea.newX = id*flickableList.itemWidth
- centeringAnimation.start();
- }
- }
-
- onIndexChanged: scrollTo(index)
- onWidthChanged: scrollTo(index)
-
- Flickable {
- id: flickArea
- property int newX: 0
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- var x = mapToItem(flickableList, mouseX, mouseY).x
-
- if (x < flickableList.width/3) {
- if (flickableList.index > 0)
- flickableList.scrollTo(flickableList.index-1);
- } else if (x > flickableList.width*2/3) {
- if (flickableList.index < flickableList.items.length-1)
- flickableList.scrollTo(flickableList.index+1);
- } else {
- flickableList.clicked()
- }
-
- }
- }
-
- PropertyAnimation {
- id: centeringAnimation
- target: flickArea
- properties: "contentX"
- easing.type: Easing.OutQuad
- from: flickArea.contentX
- to: flickArea.newX
-
- onCompleted: {
- flickableList.index = flickArea.newX / flickableList.itemWidth
- }
- }
-
- onMovementStarted: {
- centeringAnimation.stop();
- }
-
- onMovementEnded: {
- var modulo = flickArea.contentX % flickableList.itemWidth;
- var offset = flickableList.itemWidth / 2;
- flickArea.newX = modulo < offset ? flickArea.contentX - modulo : flickArea.contentX + (flickableList.itemWidth - modulo);
- centeringAnimation.start();
- }
-
-
- width: flickableList.width
- height: flickableList.height
- contentWidth: items.width
- contentHeight: items.height
- flickDeceleration: 4000
-
- Row {
- id: items
- Repeater {
- id: repeater
- model: flickableList.items.length
- }
- }
- }
-}
diff --git a/examples/declarative-camera/FocusButton.qml b/examples/declarative-camera/FocusButton.qml
deleted file mode 100644
index 6a54c8d..0000000
--- a/examples/declarative-camera/FocusButton.qml
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-import QtMultimedia 4.0
-
-CameraButton {
- property Camera camera
-
- onClicked: {
- if (camera.lockStatus == Camera.Unlocked)
- camera.searchAndLock();
- else
- camera.unlock();
- }
-
- text: {
- if (camera.lockStatus == Camera.Unlocked)
- "Focus";
- else if (camera.lockStatus == Camera.Searching)
- "Focusing"
- else
- "Unlock"
- }
-}
diff --git a/examples/declarative-camera/PhotoPreview.qml b/examples/declarative-camera/PhotoPreview.qml
deleted file mode 100644
index 6cd7f35..0000000
--- a/examples/declarative-camera/PhotoPreview.qml
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-import QtMultimedia 4.0
-
-Item {
- property alias source : preview.source
- signal closed
-
- Image {
- id: preview
- anchors.fill : parent
- fillMode: Image.PreserveAspectFit
- smooth: true
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- parent.closed();
- }
- }
-}
-
diff --git a/examples/declarative-camera/ZoomControl.qml b/examples/declarative-camera/ZoomControl.qml
deleted file mode 100644
index b141523..0000000
--- a/examples/declarative-camera/ZoomControl.qml
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-import QtMultimedia 4.0
-
-Item {
- id : zoomControl
- property real currentZoom : 1
- property real maximumZoom : 1
- signal zoomTo(real value)
-
- MouseArea {
- id : mouseArea
- anchors.fill: parent
-
- property real initialZoom : 0
- property real initialPos : 0
-
- onPressed: {
- initialPos = mouseY
- initialZoom = zoomControl.currentZoom
- }
-
- onMousePositionChanged: {
- if (pressed) {
- var target = initialZoom * Math.pow(2, (initialPos-mouseY)/zoomControl.height);
- target = Math.max(1, Math.min(target, zoomControl.maximumZoom))
- zoomControl.zoomTo(target)
- }
- }
- }
-
- Item {
- id : bar
- x : 16
- y : parent.height/4
- width : 24
- height : parent.height/2
- opacity : 0
-
- Rectangle {
- anchors.fill: parent
-
- smooth: true
- radius: 8
- border.color: "black"
- border.width: 2
- color: "white"
- opacity: 0.3
- }
-
- Rectangle {
- x : 0
- y : parent.height * (1.0 - (zoomControl.currentZoom-1.0) / (zoomControl.maximumZoom-1.0))
- width: parent.width
- height: parent.height - y
- smooth: true
- radius: 8
- color: "black"
- opacity: 0.5
- }
-
- states: State {
- name: "ShowBar"
- when: mouseArea.pressed || zoomControl.currentZoom > 1.0
- PropertyChanges { target: bar; opacity: 1 }
- }
-
- transitions: [
- Transition {
- to : "ShowBar"
- NumberAnimation { properties: "opacity"; duration: 100 }
- },
- Transition {
- from : "ShowBar"
- NumberAnimation { properties: "opacity"; duration: 500 }
- }
- ]
- }
-}
diff --git a/examples/declarative-camera/declarative-camera.pro b/examples/declarative-camera/declarative-camera.pro
deleted file mode 100644
index f159974..0000000
--- a/examples/declarative-camera/declarative-camera.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-
-TEMPLATE=app
-
-QT += declarative qtquick1 network multimedia
-
-contains(QT_CONFIG, opengl) {
- QT += opengl
-}
-
-SOURCES += $$PWD/qmlcamera.cpp
-!mac:TARGET = qml_camera
-else:TARGET = QmlCamera
-
-RESOURCES += declarative-camera.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/qml_camera
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/qml_camera
-
-INSTALLS += target sources
-
-QT+=widgets
diff --git a/examples/declarative-camera/declarative-camera.qml b/examples/declarative-camera/declarative-camera.qml
deleted file mode 100644
index fdc210d..0000000
--- a/examples/declarative-camera/declarative-camera.qml
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-import QtMultimedia 4.0
-
-Rectangle {
- id : cameraUI
- color: "black"
- state: "PhotoCapture"
-
- states: [
- State {
- name: "PhotoCapture"
- StateChangeScript {
- script: {
- camera.visible = true
- camera.focus = true
- stillControls.visible = true
- photoPreview.visible = false
- }
- }
- },
- State {
- name: "PhotoPreview"
- StateChangeScript {
- script: {
- camera.visible = false
- stillControls.visible = false
- photoPreview.visible = true
- photoPreview.focus = true
- }
- }
- }
- ]
-
- PhotoPreview {
- id : photoPreview
- anchors.fill : parent
- onClosed: cameraUI.state = "PhotoCapture"
- focus: visible
-
- Keys.onPressed : {
- //return to capture mode if the shutter button is touched
- if (event.key == Qt.Key_CameraFocus && !event.isAutoRepeat) {
- cameraUI.state = "PhotoCapture"
- event.accepted = true;
- }
- }
- }
-
- Camera {
- id: camera
- x: 0
- y: 0
- width: parent.width - stillControls.buttonsPanelWidth
- height: parent.height
- focus: visible //to receive focus and capture key events
- //captureResolution : "640x480"
-
- flashMode: stillControls.flashMode
- whiteBalanceMode: stillControls.whiteBalance
- exposureCompensation: stillControls.exposureCompensation
-
- onImageCaptured : {
- photoPreview.source = preview
- stillControls.previewAvailable = true
- cameraUI.state = "PhotoPreview"
- }
- }
-
- CaptureControls {
- id: stillControls
- anchors.fill: parent
- camera: camera
- onPreviewSelected: cameraUI.state = "PhotoPreview"
- }
-
-}
diff --git a/examples/declarative-camera/declarative-camera.qmlproject b/examples/declarative-camera/declarative-camera.qmlproject
deleted file mode 100644
index 53f5ecb..0000000
--- a/examples/declarative-camera/declarative-camera.qmlproject
+++ /dev/null
@@ -1,18 +0,0 @@
-/* File generated by QtCreator */
-
-import QmlProject 1.0
-
-Project {
- /* Include .qml, .js, and image files from current directory and subdirectories */
- QmlFiles {
- directory: "."
- }
- JavaScriptFiles {
- directory: "."
- }
- ImageFiles {
- directory: "."
- }
- /* List of plugin directories passed to QML runtime */
- // importPaths: [ "../exampleplugin" ]
-}
diff --git a/examples/declarative-camera/declarative-camera.qrc b/examples/declarative-camera/declarative-camera.qrc
deleted file mode 100644
index f8ce527..0000000
--- a/examples/declarative-camera/declarative-camera.qrc
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE RCC>
- <RCC version="1.0">
-
- <qresource prefix="/">
- <file>declarative-camera.qml</file>
- <file>CameraButton.qml</file>
- <file>CameraPropertyPopup.qml</file>
- <file>CameraPropertyButton.qml</file>
- <file>CaptureControls.qml</file>
- <file>ExposureCompensationButton.qml</file>
- <file>FlickableList.qml</file>
- <file>FocusButton.qml</file>
- <file>PhotoPreview.qml</file>
- <file>ZoomControl.qml</file>
- <file>images/camera_auto_mode.png</file>
- <file>images/camera_camera_setting.png</file>
- <file>images/camera_flash_auto.png</file>
- <file>images/camera_flash_fill.png</file>
- <file>images/camera_flash_off.png</file>
- <file>images/camera_flash_redeye.png</file>
- <file>images/camera_white_balance_cloudy.png</file>
- <file>images/camera_white_balance_flourescent.png</file>
- <file>images/camera_white_balance_incandescent.png</file>
- <file>images/camera_white_balance_sunny.png</file>
- <file>images/toolbutton.png</file>
- <file>images/toolbutton.sci</file>
- </qresource>
- </RCC>
diff --git a/examples/declarative-camera/images/camera_auto_mode.png b/examples/declarative-camera/images/camera_auto_mode.png
deleted file mode 100644
index f168296..0000000
--- a/examples/declarative-camera/images/camera_auto_mode.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative-camera/images/camera_camera_setting.png b/examples/declarative-camera/images/camera_camera_setting.png
deleted file mode 100644
index 7b993ee..0000000
--- a/examples/declarative-camera/images/camera_camera_setting.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative-camera/images/camera_flash_auto.png b/examples/declarative-camera/images/camera_flash_auto.png
deleted file mode 100644
index fb5cc40..0000000
--- a/examples/declarative-camera/images/camera_flash_auto.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative-camera/images/camera_flash_fill.png b/examples/declarative-camera/images/camera_flash_fill.png
deleted file mode 100644
index 7bc5949..0000000
--- a/examples/declarative-camera/images/camera_flash_fill.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative-camera/images/camera_flash_off.png b/examples/declarative-camera/images/camera_flash_off.png
deleted file mode 100644
index 3c5db10..0000000
--- a/examples/declarative-camera/images/camera_flash_off.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative-camera/images/camera_flash_redeye.png b/examples/declarative-camera/images/camera_flash_redeye.png
deleted file mode 100644
index 534a087..0000000
--- a/examples/declarative-camera/images/camera_flash_redeye.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative-camera/images/camera_white_balance_cloudy.png b/examples/declarative-camera/images/camera_white_balance_cloudy.png
deleted file mode 100644
index 243b699..0000000
--- a/examples/declarative-camera/images/camera_white_balance_cloudy.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative-camera/images/camera_white_balance_flourescent.png b/examples/declarative-camera/images/camera_white_balance_flourescent.png
deleted file mode 100644
index 032efe1..0000000
--- a/examples/declarative-camera/images/camera_white_balance_flourescent.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative-camera/images/camera_white_balance_incandescent.png b/examples/declarative-camera/images/camera_white_balance_incandescent.png
deleted file mode 100644
index 98f9067..0000000
--- a/examples/declarative-camera/images/camera_white_balance_incandescent.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative-camera/images/camera_white_balance_sunny.png b/examples/declarative-camera/images/camera_white_balance_sunny.png
deleted file mode 100644
index d7d5c9a..0000000
--- a/examples/declarative-camera/images/camera_white_balance_sunny.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative-camera/images/toolbutton.png b/examples/declarative-camera/images/toolbutton.png
deleted file mode 100644
index 1131001..0000000
--- a/examples/declarative-camera/images/toolbutton.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative-camera/images/toolbutton.sci b/examples/declarative-camera/images/toolbutton.sci
deleted file mode 100644
index 9e4f965..0000000
--- a/examples/declarative-camera/images/toolbutton.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 15
-border.top: 4
-border.bottom: 4
-border.right: 15
-source: toolbutton.png
diff --git a/examples/declarative-camera/qmlcamera.cpp b/examples/declarative-camera/qmlcamera.cpp
deleted file mode 100644
index 697f797..0000000
--- a/examples/declarative-camera/qmlcamera.cpp
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QDesktopWidget>
-#include <QtQuick1/qdeclarativeview.h>
-#include <QtDeclarative/QDeclarativeEngine>
-
-#if !defined(QT_NO_OPENGL)
-#include <QtOpenGL/QGLWidget>
-#endif
-
-int main(int argc, char *argv[])
-{
-
-#if defined (Q_WS_X11) || defined (Q_WS_MAC)
- //### default to using raster graphics backend for now
- bool gsSpecified = false;
- for (int i = 0; i < argc; ++i) {
- QString arg = argv[i];
- if (arg == "-graphicssystem") {
- gsSpecified = true;
- break;
- }
- }
-
- if (!gsSpecified)
- QApplication::setGraphicsSystem("raster");
-#endif
-
- QApplication application(argc, argv);
- const QString mainQmlApp = QLatin1String("qrc:/declarative-camera.qml");
- QDeclarativeView view;
-#if !defined(QT_NO_OPENGL)
- view.setViewport(new QGLWidget);
-#endif
- view.setSource(QUrl(mainQmlApp));
- view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
- // Qt.quit() called in embedded .qml by default only emits
- // quit() signal, so do this (optionally use Qt.exit()).
- QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
-#if defined(Q_WS_MAEMO_6)
- view.setGeometry(application.desktop()->screenGeometry());
- view.showFullScreen();
-#else
- view.setGeometry(QRect(100, 100, 800, 480));
- view.show();
-#endif
- return application.exec();
-}
-
diff --git a/examples/declarative-radio/declarative-radio.pro b/examples/declarative-radio/declarative-radio.pro
deleted file mode 100644
index 4ade742..0000000
--- a/examples/declarative-radio/declarative-radio.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = app
-TARGET = declarative-radio
-DEPENDPATH += .
-INCLUDEPATH += .
-QT += declarative multimedia
-
-# Input
-SOURCES += main.cpp
-RESOURCES += declarative-radio.qrc
-
diff --git a/examples/declarative-radio/declarative-radio.qrc b/examples/declarative-radio/declarative-radio.qrc
deleted file mode 100644
index ed01a64..0000000
--- a/examples/declarative-radio/declarative-radio.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
-<file>view.qml</file>
-</qresource>
-</RCC>
-
diff --git a/examples/declarative-radio/main.cpp b/examples/declarative-radio/main.cpp
deleted file mode 100644
index c8cba7b..0000000
--- a/examples/declarative-radio/main.cpp
+++ /dev/null
@@ -1,58 +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 demonstration applications of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:BSD$
- ** You may use this file under the terms of the BSD license as follows:
- **
- ** "Redistribution and use in source and binary forms, with or without
- ** modification, are permitted provided that the following conditions are
- ** met:
- ** * Redistributions of source code must retain the above copyright
- ** notice, this list of conditions and the following disclaimer.
- ** * Redistributions in binary form must reproduce the above copyright
- ** notice, this list of conditions and the following disclaimer in
- ** the documentation and/or other materials provided with the
- ** distribution.
- ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
- ** the names of its contributors may be used to endorse or promote
- ** products derived from this software without specific prior written
- ** permission.
- **
- ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include <QGuiApplication>
-
-#include <qdeclarative.h>
-#include <qquickview.h>
-
-
-int main(int argc, char ** argv)
-{
- QGuiApplication app(argc, argv);
-
- QQuickView view;
-
- view.setSource(QUrl("qrc:view.qml"));
- view.show();
-
- return app.exec();
-}
-
diff --git a/examples/declarative-radio/view.qml b/examples/declarative-radio/view.qml
deleted file mode 100644
index 71cca9d..0000000
--- a/examples/declarative-radio/view.qml
+++ /dev/null
@@ -1,191 +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 examples of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:BSD$
- ** You may use this file under the terms of the BSD license as follows:
- **
- ** "Redistribution and use in source and binary forms, with or without
- ** modification, are permitted provided that the following conditions are
- ** met:
- ** * Redistributions of source code must retain the above copyright
- ** notice, this list of conditions and the following disclaimer.
- ** * Redistributions in binary form must reproduce the above copyright
- ** notice, this list of conditions and the following disclaimer in
- ** the documentation and/or other materials provided with the
- ** distribution.
- ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
- ** the names of its contributors may be used to endorse or promote
- ** products derived from this software without specific prior written
- ** permission.
- **
- ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-import QtQuick 2.0
-import Qt.multimedia 4.0
-
-Rectangle {
- width: 400; height: 300;
-
- Radio {
- id: radio
- band: Radio.FM
- }
-
- Column {
- anchors.fill: parent
- anchors.margins: 5
- spacing: 5
-
- Row {
-
- Text {
- id: freq
-
- width: 150
- height: 200
-
- verticalAlignment: Text.AlignVCenter
- text: "" + radio.frequency / 1000 + " kHz"
- }
- Text {
- id: sig
-
- width: 200
- height: 200
-
- verticalAlignment: Text.AlignVCenter
- text: (radio.isAvailable() ? "No Signal " : "No Radio Found")
- }
- }
-
- Row {
- spacing: 5
-
- Rectangle {
- width: 350
- height: 10
-
- color: "black"
-
- Rectangle {
- width: 5
- height: 10
- color: "red"
-
- y: 0
- x: (parent.width - 5) * ((radio.frequency - radio.minimumFrequency) / (radio.maximumFrequency -
- radio.minimumFrequency))
-
- }
- }
- }
-
-
- Row {
- spacing: 5
-
- Rectangle {
- id: scanDownButton
- border.color: "black"
- border.width: 1
- radius: 2
-
- width: 90
- height: 40
-
- Text {
- anchors.fill: parent
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignHCenter
- text: "Scan Down"
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: radio.scanDown();
- }
- }
- Rectangle {
- id: freqDownButton
- border.color: "black"
- border.width: 1
- radius: 2
-
- width: 90
- height: 40
-
- Text {
- anchors.fill: parent
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignHCenter
- text: "Freq Down"
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: radio.tuneDown();
- }
- }
- Rectangle {
- id: freqUpButton
- border.color: "black"
- border.width: 1
- radius: 2
-
- width: 90
- height: 40
-
- Text {
- anchors.fill: parent
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignHCenter
- text: "Freq Up"
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: radio.tuneUp();
- }
- }
- Rectangle {
- id: scanUpButton
- border.color: "black"
- border.width: 1
- radius: 2
-
- width: 90
- height: 40
-
- Text {
- anchors.fill: parent
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignHCenter
- text: "Scan Up"
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: radio.scanUp();
- }
- }
- }
- }
-}
diff --git a/examples/examples.pro b/examples/examples.pro
deleted file mode 100644
index e26fab0..0000000
--- a/examples/examples.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- radio \
- camera \
- slideshow \
- spectrum \
- audiorecorder \
- audiodevices \
- audioinput \
- audiooutput \
- videographicsitem \
- videowidget \
- player \
-
-contains(QT_CONFIG, declarative) {
- disabled:SUBDIRS += declarative-camera
- SUBDIRS += declarative-radio
-}
-
-QT+=widgets
diff --git a/examples/player/main.cpp b/examples/player/main.cpp
deleted file mode 100644
index b995658..0000000
--- a/examples/player/main.cpp
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "player.h"
-
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
-#ifdef Q_WS_MAEMO_6
- //Meego graphics system conflicts with xvideo during fullscreen transition
- QApplication::setGraphicsSystem("raster");
-#endif
- QApplication app(argc, argv);
-
- Player player;
-
-#if defined(Q_WS_SIMULATOR)
-# if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 2))
- player.setAttribute(Qt::WA_LockLandscapeOrientation);
-# else
- // lock screen orientation
- CAknAppUi* appUi = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
- if(appUi){
- QT_TRAP_THROWING(appUi ->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape));
- }
-# endif
- player.showMaximized();
-#else
- player.show();
-#endif
- return app.exec();
-};
diff --git a/examples/player/player.cpp b/examples/player/player.cpp
deleted file mode 100644
index 8b822e1..0000000
--- a/examples/player/player.cpp
+++ /dev/null
@@ -1,418 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "player.h"
-
-#include "playercontrols.h"
-#include "playlistmodel.h"
-
-#include <qmediaservice.h>
-#include <qmediaplaylist.h>
-
-#include <QtWidgets>
-
-
-Player::Player(QWidget *parent)
- : QWidget(parent)
- , videoWidget(0)
- , coverLabel(0)
- , slider(0)
-#ifndef PLAYER_NO_COLOROPTIONS
- , colorDialog(0)
-#endif
-{
-//! [create-objs]
- player = new QMediaPlayer(this);
- // owned by PlaylistModel
- playlist = new QMediaPlaylist();
- player->setPlaylist(playlist);
-//! [create-objs]
-
- connect(player, SIGNAL(durationChanged(qint64)), SLOT(durationChanged(qint64)));
- connect(player, SIGNAL(positionChanged(qint64)), SLOT(positionChanged(qint64)));
- connect(player, SIGNAL(metaDataChanged()), SLOT(metaDataChanged()));
- connect(playlist, SIGNAL(currentIndexChanged(int)), SLOT(playlistPositionChanged(int)));
- connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
- this, SLOT(statusChanged(QMediaPlayer::MediaStatus)));
- connect(player, SIGNAL(bufferStatusChanged(int)), this, SLOT(bufferingProgress(int)));
- connect(player, SIGNAL(videoAvailableChanged(bool)), this, SLOT(videoAvailableChanged(bool)));
- connect(player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(displayErrorMessage()));
-
-//! [2]
- videoWidget = new VideoWidget(this);
- player->setVideoOutput(videoWidget);
-
- playlistModel = new PlaylistModel(this);
- playlistModel->setPlaylist(playlist);
-//! [2]
-
- playlistView = new QListView(this);
- playlistView->setModel(playlistModel);
- playlistView->setCurrentIndex(playlistModel->index(playlist->currentIndex(), 0));
-
- connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex)));
-
- slider = new QSlider(Qt::Horizontal, this);
- slider->setRange(0, player->duration() / 1000);
-
- labelDuration = new QLabel(this);
- connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(seek(int)));
-
-
- QPushButton *openButton = new QPushButton(tr("Open"), this);
-
- connect(openButton, SIGNAL(clicked()), this, SLOT(open()));
-
- PlayerControls *controls = new PlayerControls(this);
- controls->setState(player->state());
- controls->setVolume(player->volume());
- controls->setMuted(controls->isMuted());
-
- connect(controls, SIGNAL(play()), player, SLOT(play()));
- connect(controls, SIGNAL(pause()), player, SLOT(pause()));
- connect(controls, SIGNAL(stop()), player, SLOT(stop()));
- connect(controls, SIGNAL(next()), playlist, SLOT(next()));
- connect(controls, SIGNAL(previous()), this, SLOT(previousClicked()));
- connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int)));
- connect(controls, SIGNAL(changeMuting(bool)), player, SLOT(setMuted(bool)));
- connect(controls, SIGNAL(changeRate(qreal)), player, SLOT(setPlaybackRate(qreal)));
-
- connect(controls, SIGNAL(stop()), videoWidget, SLOT(update()));
-
- connect(player, SIGNAL(stateChanged(QMediaPlayer::State)),
- controls, SLOT(setState(QMediaPlayer::State)));
- connect(player, SIGNAL(volumeChanged(int)), controls, SLOT(setVolume(int)));
- connect(player, SIGNAL(mutedChanged(bool)), controls, SLOT(setMuted(bool)));
-
- fullScreenButton = new QPushButton(tr("FullScreen"), this);
- fullScreenButton->setCheckable(true);
-
-#ifndef PLAYER_NO_COLOROPTIONS
- colorButton = new QPushButton(tr("Color Options..."), this);
- colorButton->setEnabled(false);
- connect(colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog()));
-#endif
-
- QBoxLayout *displayLayout = new QHBoxLayout;
- displayLayout->addWidget(videoWidget, 2);
- displayLayout->addWidget(playlistView);
-
- QBoxLayout *controlLayout = new QHBoxLayout;
- controlLayout->setMargin(0);
- controlLayout->addWidget(openButton);
- controlLayout->addStretch(1);
- controlLayout->addWidget(controls);
- controlLayout->addStretch(1);
- controlLayout->addWidget(fullScreenButton);
-#ifndef PLAYER_NO_COLOROPTIONS
- controlLayout->addWidget(colorButton);
-#endif
-
- QBoxLayout *layout = new QVBoxLayout;
- layout->addLayout(displayLayout);
- QHBoxLayout *hLayout = new QHBoxLayout;
- hLayout->addWidget(slider);
- hLayout->addWidget(labelDuration);
- layout->addLayout(hLayout);
- layout->addLayout(controlLayout);
-
- setLayout(layout);
-
- if (!player->isAvailable()) {
- QMessageBox::warning(this, tr("Service not available"),
- tr("The QMediaPlayer object does not have a valid service.\n"\
- "Please check the media service plugins are installed."));
-
- controls->setEnabled(false);
- playlistView->setEnabled(false);
- openButton->setEnabled(false);
-#ifndef PLAYER_NO_COLOROPTIONS
- colorButton->setEnabled(false);
-#endif
- fullScreenButton->setEnabled(false);
- }
-
- metaDataChanged();
-
- QStringList arguments = qApp->arguments();
- arguments.removeAt(0);
- addToPlaylist(arguments);
-}
-
-Player::~Player()
-{
-}
-
-void Player::open()
-{
- QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open Files"));
- addToPlaylist(fileNames);
-}
-
-void Player::addToPlaylist(const QStringList& fileNames)
-{
- foreach (QString const &argument, fileNames) {
- QFileInfo fileInfo(argument);
- if (fileInfo.exists()) {
- QUrl url = QUrl::fromLocalFile(fileInfo.absoluteFilePath());
- if (fileInfo.suffix().toLower() == QLatin1String("m3u")) {
- playlist->load(url);
- } else
- playlist->addMedia(url);
- } else {
- QUrl url(argument);
- if (url.isValid()) {
- playlist->addMedia(url);
- }
- }
- }
-}
-
-void Player::durationChanged(qint64 duration)
-{
- this->duration = duration/1000;
- slider->setMaximum(duration / 1000);
-}
-
-void Player::positionChanged(qint64 progress)
-{
- if (!slider->isSliderDown()) {
- slider->setValue(progress / 1000);
- }
- updateDurationInfo(progress / 1000);
-}
-
-void Player::metaDataChanged()
-{
- //qDebug() << "update metadata" << player->metaData(QtMultimedia::Title).toString();
- if (player->isMetaDataAvailable()) {
- setTrackInfo(QString("%1 - %2")
- .arg(player->metaData(QtMultimedia::AlbumArtist).toString())
- .arg(player->metaData(QtMultimedia::Title).toString()));
-
- if (coverLabel) {
- QUrl url = player->metaData(QtMultimedia::CoverArtUrlLarge).value<QUrl>();
-
- coverLabel->setPixmap(!url.isEmpty()
- ? QPixmap(url.toString())
- : QPixmap());
- }
- }
-}
-
-void Player::previousClicked()
-{
- // Go to previous track if we are within the first 5 seconds of playback
- // Otherwise, seek to the beginning.
- if(player->position() <= 5000)
- playlist->previous();
- else
- player->setPosition(0);
-}
-
-void Player::jump(const QModelIndex &index)
-{
- if (index.isValid()) {
- playlist->setCurrentIndex(index.row());
- player->play();
- }
-}
-
-void Player::playlistPositionChanged(int currentItem)
-{
- playlistView->setCurrentIndex(playlistModel->index(currentItem, 0));
-}
-
-void Player::seek(int seconds)
-{
- player->setPosition(seconds * 1000);
-}
-
-void Player::statusChanged(QMediaPlayer::MediaStatus status)
-{
- handleCursor(status);
-
- // handle status message
- switch (status) {
- case QMediaPlayer::UnknownMediaStatus:
- case QMediaPlayer::NoMedia:
- case QMediaPlayer::LoadedMedia:
- case QMediaPlayer::BufferingMedia:
- case QMediaPlayer::BufferedMedia:
- setStatusInfo(QString());
- break;
- case QMediaPlayer::LoadingMedia:
- setStatusInfo(tr("Loading..."));
- break;
- case QMediaPlayer::StalledMedia:
- setStatusInfo(tr("Media Stalled"));
- break;
- case QMediaPlayer::EndOfMedia:
- QApplication::alert(this);
- break;
- case QMediaPlayer::InvalidMedia:
- displayErrorMessage();
- break;
- }
-}
-
-void Player::handleCursor(QMediaPlayer::MediaStatus status)
-{
-#ifndef QT_NO_CURSOR
- if( status == QMediaPlayer::LoadingMedia ||
- status == QMediaPlayer::BufferingMedia ||
- status == QMediaPlayer::StalledMedia)
- setCursor(QCursor(Qt::BusyCursor));
- else
- unsetCursor();
-#endif
-}
-
-void Player::bufferingProgress(int progress)
-{
- setStatusInfo(tr("Buffering %4%").arg(progress));
-}
-
-void Player::videoAvailableChanged(bool available)
-{
- if (!available) {
- disconnect(fullScreenButton, SIGNAL(clicked(bool)),
- videoWidget, SLOT(setFullScreen(bool)));
- disconnect(videoWidget, SIGNAL(fullScreenChanged(bool)),
- fullScreenButton, SLOT(setChecked(bool)));
- videoWidget->setFullScreen(false);
- } else {
- connect(fullScreenButton, SIGNAL(clicked(bool)),
- videoWidget, SLOT(setFullScreen(bool)));
- connect(videoWidget, SIGNAL(fullScreenChanged(bool)),
- fullScreenButton, SLOT(setChecked(bool)));
-
- if (fullScreenButton->isChecked())
- videoWidget->setFullScreen(true);
- }
-#ifndef PLAYER_NO_COLOROPTIONS
- colorButton->setEnabled(available);
-#endif
-}
-
-void Player::setTrackInfo(const QString &info)
-{
- trackInfo = info;
- if (!statusInfo.isEmpty())
- setWindowTitle(QString("%1 | %2").arg(trackInfo).arg(statusInfo));
- else
- setWindowTitle(trackInfo);
-}
-
-void Player::setStatusInfo(const QString &info)
-{
- statusInfo = info;
- if (!statusInfo.isEmpty())
- setWindowTitle(QString("%1 | %2").arg(trackInfo).arg(statusInfo));
- else
- setWindowTitle(trackInfo);
-}
-
-void Player::displayErrorMessage()
-{
- setStatusInfo(player->errorString());
-}
-
-void Player::updateDurationInfo(qint64 currentInfo)
-{
- QString tStr;
- if (currentInfo || duration) {
- QTime currentTime((currentInfo/3600)%60, (currentInfo/60)%60, currentInfo%60, (currentInfo*1000)%1000);
- QTime totalTime((duration/3600)%60, (duration/60)%60, duration%60, (duration*1000)%1000);
- QString format = "mm:ss";
- if (duration > 3600)
- format = "hh:mm:ss";
- tStr = currentTime.toString(format) + " / " + totalTime.toString(format);
- }
- labelDuration->setText(tStr);
-}
-
-
-#ifndef PLAYER_NO_COLOROPTIONS
-void Player::showColorDialog()
-{
- if (!colorDialog) {
- QSlider *brightnessSlider = new QSlider(Qt::Horizontal);
- brightnessSlider->setRange(-100, 100);
- brightnessSlider->setValue(videoWidget->brightness());
- connect(brightnessSlider, SIGNAL(sliderMoved(int)), videoWidget, SLOT(setBrightness(int)));
- connect(videoWidget, SIGNAL(brightnessChanged(int)), brightnessSlider, SLOT(setValue(int)));
-
- QSlider *contrastSlider = new QSlider(Qt::Horizontal);
- contrastSlider->setRange(-100, 100);
- contrastSlider->setValue(videoWidget->contrast());
- connect(contrastSlider, SIGNAL(sliderMoved(int)), videoWidget, SLOT(setContrast(int)));
- connect(videoWidget, SIGNAL(contrastChanged(int)), contrastSlider, SLOT(setValue(int)));
-
- QSlider *hueSlider = new QSlider(Qt::Horizontal);
- hueSlider->setRange(-100, 100);
- hueSlider->setValue(videoWidget->hue());
- connect(hueSlider, SIGNAL(sliderMoved(int)), videoWidget, SLOT(setHue(int)));
- connect(videoWidget, SIGNAL(hueChanged(int)), hueSlider, SLOT(setValue(int)));
-
- QSlider *saturationSlider = new QSlider(Qt::Horizontal);
- saturationSlider->setRange(-100, 100);
- saturationSlider->setValue(videoWidget->saturation());
- connect(saturationSlider, SIGNAL(sliderMoved(int)), videoWidget, SLOT(setSaturation(int)));
- connect(videoWidget, SIGNAL(saturationChanged(int)), saturationSlider, SLOT(setValue(int)));
-
- QFormLayout *layout = new QFormLayout;
- layout->addRow(tr("Brightness"), brightnessSlider);
- layout->addRow(tr("Contrast"), contrastSlider);
- layout->addRow(tr("Hue"), hueSlider);
- layout->addRow(tr("Saturation"), saturationSlider);
-
- QPushButton *button = new QPushButton(tr("Close"));
- layout->addRow(button);
-
- colorDialog = new QDialog(this);
- colorDialog->setWindowTitle(tr("Color Options"));
- colorDialog->setLayout(layout);
-
- connect(button, SIGNAL(clicked()), colorDialog, SLOT(close()));
- }
- colorDialog->show();
-}
-#endif
diff --git a/examples/player/player.h b/examples/player/player.h
deleted file mode 100644
index eddf5f6..0000000
--- a/examples/player/player.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PLAYER_H
-#define PLAYER_H
-
-#include <QtWidgets/QWidget>
-
-#include <qmediaplayer.h>
-#include <qmediaplaylist.h>
-#include "videowidget.h"
-
-
-QT_BEGIN_NAMESPACE
-class QAbstractItemView;
-class QLabel;
-class QModelIndex;
-class QSlider;
-class QPushButton;
-
-class QMediaPlayer;
-class QVideoWidget;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-class PlaylistModel;
-
-class Player : public QWidget
-{
- Q_OBJECT
-public:
- Player(QWidget *parent = 0);
- ~Player();
-
-Q_SIGNALS:
- void fullScreenChanged(bool fullScreen);
-
-private slots:
- void open();
- void durationChanged(qint64 duration);
- void positionChanged(qint64 progress);
- void metaDataChanged();
-
- void previousClicked();
-
- void seek(int seconds);
- void jump(const QModelIndex &index);
- void playlistPositionChanged(int);
-
- void statusChanged(QMediaPlayer::MediaStatus status);
- void bufferingProgress(int progress);
- void videoAvailableChanged(bool available);
-
- void displayErrorMessage();
-
-#ifndef PLAYER_NO_COLOROPTIONS
- void showColorDialog();
-#endif
- void addToPlaylist(const QStringList& fileNames);
-
-private:
- void setTrackInfo(const QString &info);
- void setStatusInfo(const QString &info);
- void handleCursor(QMediaPlayer::MediaStatus status);
- void updateDurationInfo(qint64 currentInfo);
-
- QMediaPlayer *player;
- QMediaPlaylist *playlist;
- VideoWidget *videoWidget;
- QLabel *coverLabel;
- QSlider *slider;
- QLabel *labelDuration;
- QPushButton *fullScreenButton;
-#ifndef PLAYER_NO_COLOROPTIONS
- QPushButton *colorButton;
- QDialog *colorDialog;
-#endif
- PlaylistModel *playlistModel;
- QAbstractItemView *playlistView;
- QString trackInfo;
- QString statusInfo;
- qint64 duration;
-};
-
-#endif
diff --git a/examples/player/player.pro b/examples/player/player.pro
deleted file mode 100644
index 3bc6c65..0000000
--- a/examples/player/player.pro
+++ /dev/null
@@ -1,32 +0,0 @@
-TEMPLATE = app
-TARGET = player
-
-CONFIG += qt warn_on
-
-QT += network \
- xml \
- multimedia \
- multimediawidgets
-
-HEADERS = \
- player.h \
- playercontrols.h \
- playlistmodel.h \
- videowidget.h
-SOURCES = main.cpp \
- player.cpp \
- playercontrols.cpp \
- playlistmodel.cpp \
- videowidget.cpp
-
-maemo* {
- DEFINES += PLAYER_NO_COLOROPTIONS
-}
-
-#install
-target.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/player
-sources.files = $$SOURCES $HEADERS $$RESOURCES $$FORMS *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/player
-INSTALLS += target sources
-
-QT+=widgets
diff --git a/examples/player/playercontrols.cpp b/examples/player/playercontrols.cpp
deleted file mode 100644
index d6239fd..0000000
--- a/examples/player/playercontrols.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "playercontrols.h"
-
-#include <QtWidgets/qboxlayout.h>
-#include <QtWidgets/qslider.h>
-#include <QtWidgets/qstyle.h>
-#include <QtWidgets/qtoolbutton.h>
-#include <QtWidgets/qcombobox.h>
-
-PlayerControls::PlayerControls(QWidget *parent)
- : QWidget(parent)
- , playerState(QMediaPlayer::StoppedState)
- , playerMuted(false)
- , playButton(0)
- , stopButton(0)
- , nextButton(0)
- , previousButton(0)
- , muteButton(0)
- , volumeSlider(0)
- , rateBox(0)
-{
- playButton = new QToolButton(this);
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
-
- connect(playButton, SIGNAL(clicked()), this, SLOT(playClicked()));
-
- stopButton = new QToolButton(this);
- stopButton->setIcon(style()->standardIcon(QStyle::SP_MediaStop));
- stopButton->setEnabled(false);
-
- connect(stopButton, SIGNAL(clicked()), this, SIGNAL(stop()));
-
- nextButton = new QToolButton(this);
- nextButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipForward));
-
- connect(nextButton, SIGNAL(clicked()), this, SIGNAL(next()));
-
- previousButton = new QToolButton(this);
- previousButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipBackward));
-
- connect(previousButton, SIGNAL(clicked()), this, SIGNAL(previous()));
-
- muteButton = new QToolButton(this);
- muteButton->setIcon(style()->standardIcon(QStyle::SP_MediaVolume));
-
- connect(muteButton, SIGNAL(clicked()), this, SLOT(muteClicked()));
-
- volumeSlider = new QSlider(Qt::Horizontal, this);
- volumeSlider->setRange(0, 100);
-
- connect(volumeSlider, SIGNAL(sliderMoved(int)), this, SIGNAL(changeVolume(int)));
-
-
- rateBox = new QComboBox(this);
- rateBox->addItem("0.5x", QVariant(0.5));
- rateBox->addItem("1.0x", QVariant(1.0));
- rateBox->addItem("2.0x", QVariant(2.0));
- rateBox->setCurrentIndex(1);
-
- connect(rateBox, SIGNAL(activated(int)), SLOT(updateRate()));
-
- QBoxLayout *layout = new QHBoxLayout;
- layout->setMargin(0);
- layout->addWidget(stopButton);
- layout->addWidget(previousButton);
- layout->addWidget(playButton);
- layout->addWidget(nextButton);
- layout->addWidget(muteButton);
- if (volumeSlider)
- layout->addWidget(volumeSlider);
-
- if (rateBox)
- layout->addWidget(rateBox);
- setLayout(layout);
-}
-
-QMediaPlayer::State PlayerControls::state() const
-{
- return playerState;
-}
-
-void PlayerControls::setState(QMediaPlayer::State state)
-{
- if (state != playerState) {
- playerState = state;
-
- switch (state) {
- case QMediaPlayer::StoppedState:
- stopButton->setEnabled(false);
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
- break;
- case QMediaPlayer::PlayingState:
- stopButton->setEnabled(true);
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
- break;
- case QMediaPlayer::PausedState:
- stopButton->setEnabled(true);
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
- break;
- }
- }
-}
-
-int PlayerControls::volume() const
-{
- return volumeSlider ? volumeSlider->value() : 0;
-}
-
-void PlayerControls::setVolume(int volume)
-{
- if (volumeSlider)
- volumeSlider->setValue(volume);
-}
-
-bool PlayerControls::isMuted() const
-{
- return playerMuted;
-}
-
-void PlayerControls::setMuted(bool muted)
-{
- if (muted != playerMuted) {
- playerMuted = muted;
-
- muteButton->setIcon(style()->standardIcon(muted
- ? QStyle::SP_MediaVolumeMuted
- : QStyle::SP_MediaVolume));
- }
-}
-
-void PlayerControls::playClicked()
-{
- switch (playerState) {
- case QMediaPlayer::StoppedState:
- case QMediaPlayer::PausedState:
- emit play();
- break;
- case QMediaPlayer::PlayingState:
- emit pause();
- break;
- }
-}
-
-void PlayerControls::muteClicked()
-{
- emit changeMuting(!playerMuted);
-}
-
-qreal PlayerControls::playbackRate() const
-{
- return rateBox->itemData(rateBox->currentIndex()).toDouble();
-}
-
-void PlayerControls::setPlaybackRate(float rate)
-{
- for (int i=0; i<rateBox->count(); i++) {
- if (qFuzzyCompare(rate, float(rateBox->itemData(i).toDouble()))) {
- rateBox->setCurrentIndex(i);
- return;
- }
- }
-
- rateBox->addItem( QString("%1x").arg(rate), QVariant(rate));
- rateBox->setCurrentIndex(rateBox->count()-1);
-}
-
-void PlayerControls::updateRate()
-{
- emit changeRate(playbackRate());
-}
diff --git a/examples/player/playercontrols.h b/examples/player/playercontrols.h
deleted file mode 100644
index dbcb263..0000000
--- a/examples/player/playercontrols.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PLAYERCONTROLS_H
-#define PLAYERCONTROLS_H
-
-#include <qmediaplayer.h>
-
-#include <QtWidgets/qwidget.h>
-
-QT_BEGIN_NAMESPACE
-class QAbstractButton;
-class QAbstractSlider;
-class QComboBox;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-class PlayerControls : public QWidget
-{
- Q_OBJECT
-public:
- PlayerControls(QWidget *parent = 0);
-
- QMediaPlayer::State state() const;
-
- int volume() const;
- bool isMuted() const;
- qreal playbackRate() const;
-
-public slots:
- void setState(QMediaPlayer::State state);
- void setVolume(int volume);
- void setMuted(bool muted);
- void setPlaybackRate(float rate);
-
-signals:
- void play();
- void pause();
- void stop();
- void next();
- void previous();
- void changeVolume(int volume);
- void changeMuting(bool muting);
- void changeRate(qreal rate);
-
-private slots:
- void playClicked();
- void muteClicked();
- void updateRate();
-
-private:
- QMediaPlayer::State playerState;
- bool playerMuted;
- QAbstractButton *playButton;
- QAbstractButton *stopButton;
- QAbstractButton *nextButton;
- QAbstractButton *previousButton;
- QAbstractButton *muteButton;
- QAbstractSlider *volumeSlider;
- QComboBox *rateBox;
-};
-
-#endif
diff --git a/examples/player/playlistmodel.cpp b/examples/player/playlistmodel.cpp
deleted file mode 100644
index 2bd9d2a..0000000
--- a/examples/player/playlistmodel.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "playlistmodel.h"
-
-#include <QtCore/qfileinfo.h>
-#include <QtCore/qurl.h>
-
-#include <qmediaplaylist.h>
-
-PlaylistModel::PlaylistModel(QObject *parent)
- : QAbstractItemModel(parent)
- , m_playlist(0)
-{
-}
-
-int PlaylistModel::rowCount(const QModelIndex &parent) const
-{
- return m_playlist && !parent.isValid() ? m_playlist->mediaCount() : 0;
-}
-
-int PlaylistModel::columnCount(const QModelIndex &parent) const
-{
- return !parent.isValid() ? ColumnCount : 0;
-}
-
-QModelIndex PlaylistModel::index(int row, int column, const QModelIndex &parent) const
-{
- return m_playlist && !parent.isValid()
- && row >= 0 && row < m_playlist->mediaCount()
- && column >= 0 && column < ColumnCount
- ? createIndex(row, column)
- : QModelIndex();
-}
-
-QModelIndex PlaylistModel::parent(const QModelIndex &child) const
-{
- Q_UNUSED(child);
-
- return QModelIndex();
-}
-
-QVariant PlaylistModel::data(const QModelIndex &index, int role) const
-{
- if (index.isValid() && role == Qt::DisplayRole) {
- QVariant value = m_data[index];
- if (!value.isValid() && index.column() == Title) {
- QUrl location = m_playlist->media(index.row()).canonicalUrl();
- return QFileInfo(location.path()).fileName();
- }
-
- return value;
- }
- return QVariant();
-}
-
-QMediaPlaylist *PlaylistModel::playlist() const
-{
- return m_playlist;
-}
-
-void PlaylistModel::setPlaylist(QMediaPlaylist *playlist)
-{
- if (m_playlist) {
- disconnect(m_playlist, SIGNAL(mediaAboutToBeInserted(int,int)), this, SLOT(beginInsertItems(int,int)));
- disconnect(m_playlist, SIGNAL(mediaInserted(int,int)), this, SLOT(endInsertItems()));
- disconnect(m_playlist, SIGNAL(mediaAboutToBeRemoved(int,int)), this, SLOT(beginRemoveItems(int,int)));
- disconnect(m_playlist, SIGNAL(mediaRemoved(int,int)), this, SLOT(endRemoveItems()));
- disconnect(m_playlist, SIGNAL(mediaChanged(int,int)), this, SLOT(changeItems(int,int)));
- }
-
- m_playlist = playlist;
-
- if (m_playlist) {
- connect(m_playlist, SIGNAL(mediaAboutToBeInserted(int,int)), this, SLOT(beginInsertItems(int,int)));
- connect(m_playlist, SIGNAL(mediaInserted(int,int)), this, SLOT(endInsertItems()));
- connect(m_playlist, SIGNAL(mediaAboutToBeRemoved(int,int)), this, SLOT(beginRemoveItems(int,int)));
- connect(m_playlist, SIGNAL(mediaRemoved(int,int)), this, SLOT(endRemoveItems()));
- connect(m_playlist, SIGNAL(mediaChanged(int,int)), this, SLOT(changeItems(int,int)));
- }
-
-
- reset();
-}
-
-bool PlaylistModel::setData(const QModelIndex &index, const QVariant &value, int role)
-{
- Q_UNUSED(role);
- m_data[index] = value;
- emit dataChanged(index, index);
- return true;
-}
-
-void PlaylistModel::beginInsertItems(int start, int end)
-{
- m_data.clear();
- beginInsertRows(QModelIndex(), start, end);
-}
-
-void PlaylistModel::endInsertItems()
-{
- endInsertRows();
-}
-
-void PlaylistModel::beginRemoveItems(int start, int end)
-{
- m_data.clear();
- beginRemoveRows(QModelIndex(), start, end);
-}
-
-void PlaylistModel::endRemoveItems()
-{
- endInsertRows();
-}
-
-void PlaylistModel::changeItems(int start, int end)
-{
- m_data.clear();
- emit dataChanged(index(start,0), index(end,ColumnCount));
-}
-
-
diff --git a/examples/player/playlistmodel.h b/examples/player/playlistmodel.h
deleted file mode 100644
index 247f4ce..0000000
--- a/examples/player/playlistmodel.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PLAYLISTMODEL_H
-#define PLAYLISTMODEL_H
-
-#include <qtmultimediadefs.h>
-#include <QtCore/qabstractitemmodel.h>
-
-QT_BEGIN_NAMESPACE
-class QMediaPlaylist;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-class PlaylistModel : public QAbstractItemModel
-{
- Q_OBJECT
-public:
- enum Column
- {
- Title = 0,
- ColumnCount
- };
-
- PlaylistModel(QObject *parent = 0);
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
-
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex &child) const;
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
- QMediaPlaylist *playlist() const;
- void setPlaylist(QMediaPlaylist *playlist);
-
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::DisplayRole);
-
-private slots:
- void beginInsertItems(int start, int end);
- void endInsertItems();
- void beginRemoveItems(int start, int end);
- void endRemoveItems();
- void changeItems(int start, int end);
-
-private:
- QMediaPlaylist *m_playlist;
- QMap<QModelIndex, QVariant> m_data;
-};
-
-#endif
diff --git a/examples/player/videowidget.cpp b/examples/player/videowidget.cpp
deleted file mode 100644
index b980967..0000000
--- a/examples/player/videowidget.cpp
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "videowidget.h"
-
-#include <QtWidgets>
-
-VideoWidget::VideoWidget(QWidget *parent)
- : QVideoWidget(parent)
-{
- setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
-
- QPalette p = palette();
- p.setColor(QPalette::Window, Qt::black);
- setPalette(p);
-
- setAttribute(Qt::WA_OpaquePaintEvent);
-}
-
-void VideoWidget::keyPressEvent(QKeyEvent *event)
-{
- if (event->key() == Qt::Key_Escape && isFullScreen()) {
- showNormal();
-
- event->accept();
- } else if (event->key() == Qt::Key_Enter && event->modifiers() & Qt::Key_Alt) {
- setFullScreen(!isFullScreen());
-
- event->accept();
- } else {
- QVideoWidget::keyPressEvent(event);
- }
-}
-
-void VideoWidget::mouseDoubleClickEvent(QMouseEvent *event)
-{
- setFullScreen(!isFullScreen());
-
- event->accept();
-}
-
-void VideoWidget::mousePressEvent(QMouseEvent *event)
-{
- QVideoWidget::mousePressEvent(event);
-}
-
diff --git a/examples/player/videowidget.h b/examples/player/videowidget.h
deleted file mode 100644
index b0ff014..0000000
--- a/examples/player/videowidget.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef VIDEOWIDGET_H
-#define VIDEOWIDGET_H
-
-#include <qvideowidget.h>
-
-QT_USE_NAMESPACE
-
-class VideoWidget : public QVideoWidget
-{
- Q_OBJECT
-public:
- VideoWidget(QWidget *parent = 0);
-
-protected:
- void keyPressEvent(QKeyEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
- void mousePressEvent(QMouseEvent *event);
-};
-
-#endif
diff --git a/examples/radio/main.cpp b/examples/radio/main.cpp
deleted file mode 100644
index 56947b1..0000000
--- a/examples/radio/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "radio.h"
-
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- Radio radio;
- radio.show();
-
- return app.exec();
-};
diff --git a/examples/radio/radio.cpp b/examples/radio/radio.cpp
deleted file mode 100644
index f5e6591..0000000
--- a/examples/radio/radio.cpp
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "radio.h"
-
-#include <QtWidgets>
-
-Radio::Radio()
-{
- radio = new QRadioTuner;
- connect(radio, SIGNAL(error(QRadioTuner::Error)), this, SLOT(error(QRadioTuner::Error)));
-
- if(radio->isBandSupported(QRadioTuner::FM))
- radio->setBand(QRadioTuner::FM);
-
- QWidget *window = new QWidget;
- QVBoxLayout* layout = new QVBoxLayout;
- QHBoxLayout* buttonBar = new QHBoxLayout;
- QHBoxLayout* topBar = new QHBoxLayout;
-
- layout->addLayout(topBar);
-
- freq = new QLabel;
- freq->setText(QString("%1 kHz").arg(radio->frequency()/1000));
- topBar->addWidget(freq);
- connect(radio,SIGNAL(frequencyChanged(int)),this,SLOT(freqChanged(int)));
-
- signal = new QLabel;
- if (radio->isAvailable())
- signal->setText(tr("No Signal"));
- else
- signal->setText(tr("No radio found"));
- topBar->addWidget(signal);
- connect(radio,SIGNAL(signalStrengthChanged(int)),this,SLOT(signalChanged(int)));
-
- volumeSlider = new QSlider(Qt::Vertical,this);
- volumeSlider->setRange(0,100);
- volumeSlider->setValue(50);
- connect(volumeSlider,SIGNAL(valueChanged(int)),this,SLOT(updateVolume(int)));
- topBar->addWidget(volumeSlider);
-
- layout->addLayout(buttonBar);
-
- searchLeft = new QPushButton;
- searchLeft->setText(tr("scan Down"));
- connect(searchLeft,SIGNAL(clicked()),SLOT(searchDown()));
- buttonBar->addWidget(searchLeft);
-
- left = new QPushButton;
- left->setText(tr("Freq Down"));
- connect(left,SIGNAL(clicked()),SLOT(freqDown()));
- buttonBar->addWidget(left);
-
- right = new QPushButton;
- connect(right,SIGNAL(clicked()),SLOT(freqUp()));
- right->setText(tr("Freq Up"));
- buttonBar->addWidget(right);
-
- searchRight = new QPushButton;
- searchRight->setText(tr("scan Up"));
- connect(searchRight,SIGNAL(clicked()),SLOT(searchUp()));
- buttonBar->addWidget(searchRight);
-
- window->setLayout(layout);
- setCentralWidget(window);
- window->show();
-
- radio->start();
-}
-
-Radio::~Radio()
-{
-}
-
-void Radio::freqUp()
-{
- int f = radio->frequency();
- f = f + radio->frequencyStep(QRadioTuner::FM);
- radio->setFrequency(f);
-}
-
-void Radio::freqDown()
-{
- int f = radio->frequency();
- f = f - radio->frequencyStep(QRadioTuner::FM);
- radio->setFrequency(f);
-}
-
-void Radio::searchUp()
-{
- radio->searchForward();
-}
-
-void Radio::searchDown()
-{
- radio->searchBackward();
-}
-
-void Radio::freqChanged(int)
-{
- freq->setText(QString("%1 kHz").arg(radio->frequency()/1000));
-}
-
-void Radio::signalChanged(int)
-{
- if(radio->signalStrength() > 25)
- signal->setText(tr("Got Signal"));
- else
- signal->setText(tr("No Signal"));
-}
-
-void Radio::updateVolume(int v)
-{
- radio->setVolume(v);
-}
-
-void Radio::error(QRadioTuner::Error error)
-{
- const QMetaObject* metaObj = radio->metaObject();
- QMetaEnum errorEnum = metaObj->enumerator(metaObj->indexOfEnumerator("Error"));
- qWarning().nospace() << "Warning: Example application received error QRadioTuner::" << errorEnum.valueToKey(error);
-}
-
diff --git a/examples/radio/radio.h b/examples/radio/radio.h
deleted file mode 100644
index bd30b3b..0000000
--- a/examples/radio/radio.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef RADIO_H
-#define RADIO_H
-
-#include <QtWidgets>
-
-#include <qradiotuner.h>
-
-QT_BEGIN_NAMESPACE
-class QLabel;
-class QPushButton;
-class QSlider;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-class Radio : public QMainWindow
-{
- Q_OBJECT
-public:
- Radio();
- ~Radio();
-
-public slots:
- void freqUp();
- void freqDown();
- void searchUp();
- void searchDown();
- void freqChanged(int f);
- void signalChanged(int s);
- void updateVolume(int v);
- void error(QRadioTuner::Error error);
-
-private:
- QLabel* freq;
- QLabel* signal;
- QPushButton* left;
- QPushButton* right;
- QPushButton* searchLeft;
- QPushButton* searchRight;
- QSlider* volumeSlider;
- QRadioTuner* radio;
-};
-
-#endif
diff --git a/examples/radio/radio.pro b/examples/radio/radio.pro
deleted file mode 100644
index 6931879..0000000
--- a/examples/radio/radio.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-TARGET = radio
-
-QT += multimedia
-
-HEADERS = \
- radio.h
-
-SOURCES = \
- main.cpp \
- radio.cpp
-
-target.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/radio
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/radio
-
-INSTALLS += target sources
-
-QT+=widgets
diff --git a/examples/slideshow/main.cpp b/examples/slideshow/main.cpp
deleted file mode 100644
index ffa493f..0000000
--- a/examples/slideshow/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "slideshow.h"
-
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- SlideShow slideShow;
- slideShow.show();
-
- return app.exec();
-}
diff --git a/examples/slideshow/slideshow.cpp b/examples/slideshow/slideshow.cpp
deleted file mode 100644
index fea2ee6..0000000
--- a/examples/slideshow/slideshow.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "slideshow.h"
-
-#include <qmediaservice.h>
-#include <qmediaplaylist.h>
-#include <qvideowidget.h>
-
-#include <QtWidgets>
-
-SlideShow::SlideShow(QWidget *parent)
- : QMainWindow(parent)
- , imageViewer(0)
- , playlist(0)
- , statusLabel(0)
- , countdownLabel(0)
- , playAction(0)
- , stopAction(0)
-{
- imageViewer = new QMediaImageViewer(this);
-
- connect(imageViewer, SIGNAL(stateChanged(QMediaImageViewer::State)),
- this, SLOT(stateChanged(QMediaImageViewer::State)));
- connect(imageViewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
- this, SLOT(statusChanged(QMediaImageViewer::MediaStatus)));
- connect(imageViewer, SIGNAL(elapsedTimeChanged(int)), this, SLOT(elapsedTimeChanged(int)));
-
- playlist = new QMediaPlaylist;
- imageViewer->bind(playlist);
-
- connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded()));
- connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed()));
-
- QVideoWidget *videoWidget = new QVideoWidget;
- imageViewer->setVideoOutput(videoWidget);
-
- menuBar()->addAction(tr("Open Directory..."), this, SLOT(openDirectory()));
- menuBar()->addAction(tr("Open Playlist..."), this, SLOT(openPlaylist()));
-
- toolBar = new QToolBar;
- toolBar->setMovable(false);
- toolBar->setFloatable(false);
- toolBar->setEnabled(false);
-
- toolBar->addAction(
- style()->standardIcon(QStyle::SP_MediaSkipBackward),
- tr("Previous"),
- playlist,
- SLOT(previous()));
- stopAction = toolBar->addAction(
- style()->standardIcon(QStyle::SP_MediaStop), tr("Stop"), imageViewer, SLOT(stop()));
- playAction = toolBar->addAction(
- style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this, SLOT(play()));
- toolBar->addAction(
- style()->standardIcon(QStyle::SP_MediaSkipForward), tr("Next"), playlist, SLOT(next()));
-
- addToolBar(Qt::BottomToolBarArea, toolBar);
-
- statusLabel = new QLabel(tr("%1 Images").arg(0));
- statusLabel->setAlignment(Qt::AlignCenter);
-
- countdownLabel = new QLabel;
- countdownLabel->setAlignment(Qt::AlignRight);
-
- statusBar()->addPermanentWidget(statusLabel, 1);
- statusBar()->addPermanentWidget(countdownLabel);
-
- setCentralWidget(videoWidget);
-}
-
-void SlideShow::openPlaylist()
-{
- QString path = QFileDialog::getOpenFileName(this);
-
- if (!path.isEmpty()) {
- playlist->clear();
- playlist->load(QUrl::fromLocalFile(path));
- }
-}
-
-void SlideShow::openDirectory()
-{
- QString path = QFileDialog::getExistingDirectory(this);
-
- if (!path.isEmpty()) {
- playlist->clear();
-
- QDir dir(path);
-
- foreach (const QString &fileName, dir.entryList(QDir::Files))
- playlist->addMedia(QUrl::fromLocalFile(dir.absoluteFilePath(fileName)));
-
- statusChanged(imageViewer->mediaStatus());
-
- toolBar->setEnabled(playlist->mediaCount() > 0);
- }
-}
-
-void SlideShow::play()
-{
- switch (imageViewer->state()) {
- case QMediaImageViewer::StoppedState:
- case QMediaImageViewer::PausedState:
- imageViewer->play();
- break;
- case QMediaImageViewer::PlayingState:
- imageViewer->pause();
- break;
- }
-}
-
-void SlideShow::stateChanged(QMediaImageViewer::State state)
-{
- switch (state) {
- case QMediaImageViewer::StoppedState:
- stopAction->setEnabled(false);
- playAction->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
- break;
- case QMediaImageViewer::PlayingState:
- stopAction->setEnabled(true);
- playAction->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
- break;
- case QMediaImageViewer::PausedState:
- stopAction->setEnabled(true);
- playAction->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
- break;
- }
-}
-
-void SlideShow::statusChanged(QMediaImageViewer::MediaStatus status)
-{
- switch (status) {
- case QMediaImageViewer::NoMedia:
- statusLabel->setText(tr("%1 Images").arg(playlist->mediaCount()));
- break;
- case QMediaImageViewer::LoadingMedia:
- statusLabel->setText(tr("Image %1 of %2\nLoading...")
- .arg(playlist->currentIndex())
- .arg(playlist->mediaCount()));
- break;
- case QMediaImageViewer::LoadedMedia:
- statusLabel->setText(tr("Image %1 of %2")
- .arg(playlist->currentIndex())
- .arg(playlist->mediaCount()));
- break;
- case QMediaImageViewer::InvalidMedia:
- statusLabel->setText(tr("Image %1 of %2\nInvalid")
- .arg(playlist->currentIndex())
- .arg(playlist->mediaCount()));
- break;
- default:
- break;
- }
-}
-
-void SlideShow::playlistLoaded()
-{
- statusChanged(imageViewer->mediaStatus());
-
- toolBar->setEnabled(playlist->mediaCount() > 0);
-}
-
-void SlideShow::playlistLoadFailed()
-{
- statusLabel->setText(playlist->errorString());
-
- toolBar->setEnabled(false);
-}
-
-void SlideShow::elapsedTimeChanged(int time)
-{
- const int remaining = (imageViewer->timeout() - time) / 1000;
-
- countdownLabel->setText(tr("%1:%2")
- .arg(remaining / 60, 2, 10, QLatin1Char('0'))
- .arg(remaining % 60, 2, 10, QLatin1Char('0')));
-}
diff --git a/examples/slideshow/slideshow.h b/examples/slideshow/slideshow.h
deleted file mode 100644
index 5bb283f..0000000
--- a/examples/slideshow/slideshow.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SLIDESHOW_H
-#define SLIDESHOW_H
-
-#include <QMainWindow>
-#include <qmediaimageviewer.h>
-
-QT_BEGIN_NAMESPACE
-class QAbstractButton;
-class QLabel;
-class QStackedLayout;
-
-class QMediaPlaylist;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-class SlideShow : public QMainWindow
-{
- Q_OBJECT
-public:
- SlideShow(QWidget *parent = 0);
-
-private slots:
- void openPlaylist();
- void openDirectory();
-
- void play();
-
- void stateChanged(QMediaImageViewer::State state);
- void statusChanged(QMediaImageViewer::MediaStatus status);
-
- void playlistLoaded();
- void playlistLoadFailed();
-
- void elapsedTimeChanged(int time);
-
-private:
- QMediaImageViewer *imageViewer;
- QMediaPlaylist *playlist;
- QLabel *statusLabel;
- QLabel *countdownLabel;
- QAction *playAction;
- QAction *stopAction;
- QToolBar *toolBar;
-};
-
-#endif
diff --git a/examples/slideshow/slideshow.pro b/examples/slideshow/slideshow.pro
deleted file mode 100644
index 133735d..0000000
--- a/examples/slideshow/slideshow.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-TARGET = slideshow
-
-QT += multimedia multimediawidgets
-
-HEADERS = \
- slideshow.h
-
-SOURCES = \
- main.cpp \
- slideshow.cpp
-
-target.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/slideshow
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/slideshow
-
-INSTALLS += target sources
-
-QT+=widgets
diff --git a/examples/spectrum/3rdparty/fftreal/Array.h b/examples/spectrum/3rdparty/fftreal/Array.h
deleted file mode 100644
index a08e3cf..0000000
--- a/examples/spectrum/3rdparty/fftreal/Array.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*****************************************************************************
-
- Array.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (Array_HEADER_INCLUDED)
-#define Array_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class T, long LEN>
-class Array
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- typedef T DataType;
-
- Array ();
-
- inline const DataType &
- operator [] (long pos) const;
- inline DataType &
- operator [] (long pos);
-
- static inline long
- size ();
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- DataType _data_arr [LEN];
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- Array (const Array &other);
- Array & operator = (const Array &other);
- bool operator == (const Array &other);
- bool operator != (const Array &other);
-
-}; // class Array
-
-
-
-#include "Array.hpp"
-
-
-
-#endif // Array_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/Array.hpp b/examples/spectrum/3rdparty/fftreal/Array.hpp
deleted file mode 100644
index 8300077..0000000
--- a/examples/spectrum/3rdparty/fftreal/Array.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*****************************************************************************
-
- Array.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (Array_CURRENT_CODEHEADER)
- #error Recursive inclusion of Array code header.
-#endif
-#define Array_CURRENT_CODEHEADER
-
-#if ! defined (Array_CODEHEADER_INCLUDED)
-#define Array_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include <cassert>
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class T, long LEN>
-Array <T, LEN>::Array ()
-{
- // Nothing
-}
-
-
-
-template <class T, long LEN>
-const typename Array <T, LEN>::DataType & Array <T, LEN>::operator [] (long pos) const
-{
- assert (pos >= 0);
- assert (pos < LEN);
-
- return (_data_arr [pos]);
-}
-
-
-
-template <class T, long LEN>
-typename Array <T, LEN>::DataType & Array <T, LEN>::operator [] (long pos)
-{
- assert (pos >= 0);
- assert (pos < LEN);
-
- return (_data_arr [pos]);
-}
-
-
-
-template <class T, long LEN>
-long Array <T, LEN>::size ()
-{
- return (LEN);
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-#endif // Array_CODEHEADER_INCLUDED
-
-#undef Array_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/DynArray.h b/examples/spectrum/3rdparty/fftreal/DynArray.h
deleted file mode 100644
index 8041a0c..0000000
--- a/examples/spectrum/3rdparty/fftreal/DynArray.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*****************************************************************************
-
- DynArray.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (DynArray_HEADER_INCLUDED)
-#define DynArray_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class T>
-class DynArray
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- typedef T DataType;
-
- DynArray ();
- explicit DynArray (long size);
- ~DynArray ();
-
- inline long size () const;
- inline void resize (long size);
-
- inline const DataType &
- operator [] (long pos) const;
- inline DataType &
- operator [] (long pos);
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- DataType * _data_ptr;
- long _len;
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- DynArray (const DynArray &other);
- DynArray & operator = (const DynArray &other);
- bool operator == (const DynArray &other);
- bool operator != (const DynArray &other);
-
-}; // class DynArray
-
-
-
-#include "DynArray.hpp"
-
-
-
-#endif // DynArray_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/DynArray.hpp b/examples/spectrum/3rdparty/fftreal/DynArray.hpp
deleted file mode 100644
index e62b10f..0000000
--- a/examples/spectrum/3rdparty/fftreal/DynArray.hpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/*****************************************************************************
-
- DynArray.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (DynArray_CURRENT_CODEHEADER)
- #error Recursive inclusion of DynArray code header.
-#endif
-#define DynArray_CURRENT_CODEHEADER
-
-#if ! defined (DynArray_CODEHEADER_INCLUDED)
-#define DynArray_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include <cassert>
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class T>
-DynArray <T>::DynArray ()
-: _data_ptr (0)
-, _len (0)
-{
- // Nothing
-}
-
-
-
-template <class T>
-DynArray <T>::DynArray (long size)
-: _data_ptr (0)
-, _len (0)
-{
- assert (size >= 0);
- if (size > 0)
- {
- _data_ptr = new DataType [size];
- _len = size;
- }
-}
-
-
-
-template <class T>
-DynArray <T>::~DynArray ()
-{
- delete [] _data_ptr;
- _data_ptr = 0;
- _len = 0;
-}
-
-
-
-template <class T>
-long DynArray <T>::size () const
-{
- return (_len);
-}
-
-
-
-template <class T>
-void DynArray <T>::resize (long size)
-{
- assert (size >= 0);
- if (size > 0)
- {
- DataType * old_data_ptr = _data_ptr;
- DataType * tmp_data_ptr = new DataType [size];
-
- _data_ptr = tmp_data_ptr;
- _len = size;
-
- delete [] old_data_ptr;
- }
-}
-
-
-
-template <class T>
-const typename DynArray <T>::DataType & DynArray <T>::operator [] (long pos) const
-{
- assert (pos >= 0);
- assert (pos < _len);
-
- return (_data_ptr [pos]);
-}
-
-
-
-template <class T>
-typename DynArray <T>::DataType & DynArray <T>::operator [] (long pos)
-{
- assert (pos >= 0);
- assert (pos < _len);
-
- return (_data_ptr [pos]);
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-#endif // DynArray_CODEHEADER_INCLUDED
-
-#undef DynArray_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTReal.dsp b/examples/spectrum/3rdparty/fftreal/FFTReal.dsp
deleted file mode 100644
index fe970db..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTReal.dsp
+++ /dev/null
@@ -1,273 +0,0 @@
-# Microsoft Developer Studio Project File - Name="FFTReal" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=FFTReal - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "FFTReal.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "FFTReal.mak" CFG="FFTReal - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "FFTReal - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "FFTReal - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "FFTReal - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GR /GX /O2 /Ob2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "FFTReal - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /GR /GX /Zi /Od /Gf /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "FFTReal - Win32 Release"
-# Name "FFTReal - Win32 Debug"
-# Begin Group "Library"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\Array.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\Array.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\def.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\DynArray.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\DynArray.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTReal.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTReal.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTRealFixLen.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTRealFixLen.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTRealFixLenParam.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTRealPassDirect.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTRealPassDirect.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTRealPassInverse.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTRealPassInverse.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTRealSelect.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTRealSelect.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTRealUseTrigo.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FFTRealUseTrigo.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\OscSinCos.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\OscSinCos.hpp
-# End Source File
-# End Group
-# Begin Group "Test"
-
-# PROP Default_Filter ""
-# Begin Group "stopwatch"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\stopwatch\ClockCycleCounter.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\stopwatch\ClockCycleCounter.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\stopwatch\ClockCycleCounter.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\stopwatch\def.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\stopwatch\fnc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\stopwatch\fnc.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\stopwatch\Int64.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\stopwatch\StopWatch.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\stopwatch\StopWatch.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\stopwatch\StopWatch.hpp
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\test.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\test_fnc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\test_fnc.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\test_settings.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TestAccuracy.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TestAccuracy.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\TestHelperFixLen.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TestHelperFixLen.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\TestHelperNormal.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TestHelperNormal.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\TestSpeed.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TestSpeed.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\TestWhiteNoiseGen.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TestWhiteNoiseGen.hpp
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/examples/spectrum/3rdparty/fftreal/FFTReal.dsw b/examples/spectrum/3rdparty/fftreal/FFTReal.dsw
deleted file mode 100644
index 076b0ae..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTReal.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "FFTReal"=.\FFTReal.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/examples/spectrum/3rdparty/fftreal/FFTReal.h b/examples/spectrum/3rdparty/fftreal/FFTReal.h
deleted file mode 100644
index 9fb2725..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTReal.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*****************************************************************************
-
- FFTReal.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (FFTReal_HEADER_INCLUDED)
-#define FFTReal_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "def.h"
-#include "DynArray.h"
-#include "OscSinCos.h"
-
-
-
-template <class DT>
-class FFTReal
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- enum { MAX_BIT_DEPTH = 30 }; // So length can be represented as long int
-
- typedef DT DataType;
-
- explicit FFTReal (long length);
- virtual ~FFTReal () {}
-
- long get_length () const;
- void do_fft (DataType f [], const DataType x []) const;
- void do_ifft (const DataType f [], DataType x []) const;
- void rescale (DataType x []) const;
- DataType * use_buffer () const;
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- // Over this bit depth, we use direct calculation for sin/cos
- enum { TRIGO_BD_LIMIT = 12 };
-
- typedef OscSinCos <DataType> OscType;
-
- void init_br_lut ();
- void init_trigo_lut ();
- void init_trigo_osc ();
-
- FORCEINLINE const long *
- get_br_ptr () const;
- FORCEINLINE const DataType *
- get_trigo_ptr (int level) const;
- FORCEINLINE long
- get_trigo_level_index (int level) const;
-
- inline void compute_fft_general (DataType f [], const DataType x []) const;
- inline void compute_direct_pass_1_2 (DataType df [], const DataType x []) const;
- inline void compute_direct_pass_3 (DataType df [], const DataType sf []) const;
- inline void compute_direct_pass_n (DataType df [], const DataType sf [], int pass) const;
- inline void compute_direct_pass_n_lut (DataType df [], const DataType sf [], int pass) const;
- inline void compute_direct_pass_n_osc (DataType df [], const DataType sf [], int pass) const;
-
- inline void compute_ifft_general (const DataType f [], DataType x []) const;
- inline void compute_inverse_pass_n (DataType df [], const DataType sf [], int pass) const;
- inline void compute_inverse_pass_n_osc (DataType df [], const DataType sf [], int pass) const;
- inline void compute_inverse_pass_n_lut (DataType df [], const DataType sf [], int pass) const;
- inline void compute_inverse_pass_3 (DataType df [], const DataType sf []) const;
- inline void compute_inverse_pass_1_2 (DataType x [], const DataType sf []) const;
-
- const long _length;
- const int _nbr_bits;
- DynArray <long>
- _br_lut;
- DynArray <DataType>
- _trigo_lut;
- mutable DynArray <DataType>
- _buffer;
- mutable DynArray <OscType>
- _trigo_osc;
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- FFTReal ();
- FFTReal (const FFTReal &other);
- FFTReal & operator = (const FFTReal &other);
- bool operator == (const FFTReal &other);
- bool operator != (const FFTReal &other);
-
-}; // class FFTReal
-
-
-
-#include "FFTReal.hpp"
-
-
-
-#endif // FFTReal_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTReal.hpp b/examples/spectrum/3rdparty/fftreal/FFTReal.hpp
deleted file mode 100644
index 335d771..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTReal.hpp
+++ /dev/null
@@ -1,916 +0,0 @@
-/*****************************************************************************
-
- FFTReal.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (FFTReal_CURRENT_CODEHEADER)
- #error Recursive inclusion of FFTReal code header.
-#endif
-#define FFTReal_CURRENT_CODEHEADER
-
-#if ! defined (FFTReal_CODEHEADER_INCLUDED)
-#define FFTReal_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include <cassert>
-#include <cmath>
-
-
-
-static inline bool FFTReal_is_pow2 (long x)
-{
- assert (x > 0);
-
- return ((x & -x) == x);
-}
-
-
-
-static inline int FFTReal_get_next_pow2 (long x)
-{
- --x;
-
- int p = 0;
- while ((x & ~0xFFFFL) != 0)
- {
- p += 16;
- x >>= 16;
- }
- while ((x & ~0xFL) != 0)
- {
- p += 4;
- x >>= 4;
- }
- while (x > 0)
- {
- ++p;
- x >>= 1;
- }
-
- return (p);
-}
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*
-==============================================================================
-Name: ctor
-Input parameters:
- - length: length of the array on which we want to do a FFT. Range: power of
- 2 only, > 0.
-Throws: std::bad_alloc
-==============================================================================
-*/
-
-template <class DT>
-FFTReal <DT>::FFTReal (long length)
-: _length (length)
-, _nbr_bits (FFTReal_get_next_pow2 (length))
-, _br_lut ()
-, _trigo_lut ()
-, _buffer (length)
-, _trigo_osc ()
-{
- assert (FFTReal_is_pow2 (length));
- assert (_nbr_bits <= MAX_BIT_DEPTH);
-
- init_br_lut ();
- init_trigo_lut ();
- init_trigo_osc ();
-}
-
-
-
-/*
-==============================================================================
-Name: get_length
-Description:
- Returns the number of points processed by this FFT object.
-Returns: The number of points, power of 2, > 0.
-Throws: Nothing
-==============================================================================
-*/
-
-template <class DT>
-long FFTReal <DT>::get_length () const
-{
- return (_length);
-}
-
-
-
-/*
-==============================================================================
-Name: do_fft
-Description:
- Compute the FFT of the array.
-Input parameters:
- - x: pointer on the source array (time).
-Output parameters:
- - f: pointer on the destination array (frequencies).
- f [0...length(x)/2] = real values,
- f [length(x)/2+1...length(x)-1] = negative imaginary values of
- coefficents 1...length(x)/2-1.
-Throws: Nothing
-==============================================================================
-*/
-
-template <class DT>
-void FFTReal <DT>::do_fft (DataType f [], const DataType x []) const
-{
- assert (f != 0);
- assert (f != use_buffer ());
- assert (x != 0);
- assert (x != use_buffer ());
- assert (x != f);
-
- // General case
- if (_nbr_bits > 2)
- {
- compute_fft_general (f, x);
- }
-
- // 4-point FFT
- else if (_nbr_bits == 2)
- {
- f [1] = x [0] - x [2];
- f [3] = x [1] - x [3];
-
- const DataType b_0 = x [0] + x [2];
- const DataType b_2 = x [1] + x [3];
-
- f [0] = b_0 + b_2;
- f [2] = b_0 - b_2;
- }
-
- // 2-point FFT
- else if (_nbr_bits == 1)
- {
- f [0] = x [0] + x [1];
- f [1] = x [0] - x [1];
- }
-
- // 1-point FFT
- else
- {
- f [0] = x [0];
- }
-}
-
-
-
-/*
-==============================================================================
-Name: do_ifft
-Description:
- Compute the inverse FFT of the array. Note that data must be post-scaled:
- IFFT (FFT (x)) = x * length (x).
-Input parameters:
- - f: pointer on the source array (frequencies).
- f [0...length(x)/2] = real values
- f [length(x)/2+1...length(x)-1] = negative imaginary values of
- coefficents 1...length(x)/2-1.
-Output parameters:
- - x: pointer on the destination array (time).
-Throws: Nothing
-==============================================================================
-*/
-
-template <class DT>
-void FFTReal <DT>::do_ifft (const DataType f [], DataType x []) const
-{
- assert (f != 0);
- assert (f != use_buffer ());
- assert (x != 0);
- assert (x != use_buffer ());
- assert (x != f);
-
- // General case
- if (_nbr_bits > 2)
- {
- compute_ifft_general (f, x);
- }
-
- // 4-point IFFT
- else if (_nbr_bits == 2)
- {
- const DataType b_0 = f [0] + f [2];
- const DataType b_2 = f [0] - f [2];
-
- x [0] = b_0 + f [1] * 2;
- x [2] = b_0 - f [1] * 2;
- x [1] = b_2 + f [3] * 2;
- x [3] = b_2 - f [3] * 2;
- }
-
- // 2-point IFFT
- else if (_nbr_bits == 1)
- {
- x [0] = f [0] + f [1];
- x [1] = f [0] - f [1];
- }
-
- // 1-point IFFT
- else
- {
- x [0] = f [0];
- }
-}
-
-
-
-/*
-==============================================================================
-Name: rescale
-Description:
- Scale an array by divide each element by its length. This function should
- be called after FFT + IFFT.
-Input parameters:
- - x: pointer on array to rescale (time or frequency).
-Throws: Nothing
-==============================================================================
-*/
-
-template <class DT>
-void FFTReal <DT>::rescale (DataType x []) const
-{
- const DataType mul = DataType (1.0 / _length);
-
- if (_length < 4)
- {
- long i = _length - 1;
- do
- {
- x [i] *= mul;
- --i;
- }
- while (i >= 0);
- }
-
- else
- {
- assert ((_length & 3) == 0);
-
- // Could be optimized with SIMD instruction sets (needs alignment check)
- long i = _length - 4;
- do
- {
- x [i + 0] *= mul;
- x [i + 1] *= mul;
- x [i + 2] *= mul;
- x [i + 3] *= mul;
- i -= 4;
- }
- while (i >= 0);
- }
-}
-
-
-
-/*
-==============================================================================
-Name: use_buffer
-Description:
- Access the internal buffer, whose length is the FFT one.
- Buffer content will be erased at each do_fft() / do_ifft() call!
- This buffer cannot be used as:
- - source for FFT or IFFT done with this object
- - destination for FFT or IFFT done with this object
-Returns:
- Buffer start address
-Throws: Nothing
-==============================================================================
-*/
-
-template <class DT>
-typename FFTReal <DT>::DataType * FFTReal <DT>::use_buffer () const
-{
- return (&_buffer [0]);
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class DT>
-void FFTReal <DT>::init_br_lut ()
-{
- const long length = 1L << _nbr_bits;
- _br_lut.resize (length);
-
- _br_lut [0] = 0;
- long br_index = 0;
- for (long cnt = 1; cnt < length; ++cnt)
- {
- // ++br_index (bit reversed)
- long bit = length >> 1;
- while (((br_index ^= bit) & bit) == 0)
- {
- bit >>= 1;
- }
-
- _br_lut [cnt] = br_index;
- }
-}
-
-
-
-template <class DT>
-void FFTReal <DT>::init_trigo_lut ()
-{
- using namespace std;
-
- if (_nbr_bits > 3)
- {
- const long total_len = (1L << (_nbr_bits - 1)) - 4;
- _trigo_lut.resize (total_len);
-
- for (int level = 3; level < _nbr_bits; ++level)
- {
- const long level_len = 1L << (level - 1);
- DataType * const level_ptr =
- &_trigo_lut [get_trigo_level_index (level)];
- const double mul = PI / (level_len << 1);
-
- for (long i = 0; i < level_len; ++ i)
- {
- level_ptr [i] = static_cast <DataType> (cos (i * mul));
- }
- }
- }
-}
-
-
-
-template <class DT>
-void FFTReal <DT>::init_trigo_osc ()
-{
- const int nbr_osc = _nbr_bits - TRIGO_BD_LIMIT;
- if (nbr_osc > 0)
- {
- _trigo_osc.resize (nbr_osc);
-
- for (int osc_cnt = 0; osc_cnt < nbr_osc; ++osc_cnt)
- {
- OscType & osc = _trigo_osc [osc_cnt];
-
- const long len = 1L << (TRIGO_BD_LIMIT + osc_cnt);
- const double mul = (0.5 * PI) / len;
- osc.set_step (mul);
- }
- }
-}
-
-
-
-template <class DT>
-const long * FFTReal <DT>::get_br_ptr () const
-{
- return (&_br_lut [0]);
-}
-
-
-
-template <class DT>
-const typename FFTReal <DT>::DataType * FFTReal <DT>::get_trigo_ptr (int level) const
-{
- assert (level >= 3);
-
- return (&_trigo_lut [get_trigo_level_index (level)]);
-}
-
-
-
-template <class DT>
-long FFTReal <DT>::get_trigo_level_index (int level) const
-{
- assert (level >= 3);
-
- return ((1L << (level - 1)) - 4);
-}
-
-
-
-// Transform in several passes
-template <class DT>
-void FFTReal <DT>::compute_fft_general (DataType f [], const DataType x []) const
-{
- assert (f != 0);
- assert (f != use_buffer ());
- assert (x != 0);
- assert (x != use_buffer ());
- assert (x != f);
-
- DataType * sf;
- DataType * df;
-
- if ((_nbr_bits & 1) != 0)
- {
- df = use_buffer ();
- sf = f;
- }
- else
- {
- df = f;
- sf = use_buffer ();
- }
-
- compute_direct_pass_1_2 (df, x);
- compute_direct_pass_3 (sf, df);
-
- for (int pass = 3; pass < _nbr_bits; ++ pass)
- {
- compute_direct_pass_n (df, sf, pass);
-
- DataType * const temp_ptr = df;
- df = sf;
- sf = temp_ptr;
- }
-}
-
-
-
-template <class DT>
-void FFTReal <DT>::compute_direct_pass_1_2 (DataType df [], const DataType x []) const
-{
- assert (df != 0);
- assert (x != 0);
- assert (df != x);
-
- const long * const bit_rev_lut_ptr = get_br_ptr ();
- long coef_index = 0;
- do
- {
- const long rev_index_0 = bit_rev_lut_ptr [coef_index];
- const long rev_index_1 = bit_rev_lut_ptr [coef_index + 1];
- const long rev_index_2 = bit_rev_lut_ptr [coef_index + 2];
- const long rev_index_3 = bit_rev_lut_ptr [coef_index + 3];
-
- DataType * const df2 = df + coef_index;
- df2 [1] = x [rev_index_0] - x [rev_index_1];
- df2 [3] = x [rev_index_2] - x [rev_index_3];
-
- const DataType sf_0 = x [rev_index_0] + x [rev_index_1];
- const DataType sf_2 = x [rev_index_2] + x [rev_index_3];
-
- df2 [0] = sf_0 + sf_2;
- df2 [2] = sf_0 - sf_2;
-
- coef_index += 4;
- }
- while (coef_index < _length);
-}
-
-
-
-template <class DT>
-void FFTReal <DT>::compute_direct_pass_3 (DataType df [], const DataType sf []) const
-{
- assert (df != 0);
- assert (sf != 0);
- assert (df != sf);
-
- const DataType sqrt2_2 = DataType (SQRT2 * 0.5);
- long coef_index = 0;
- do
- {
- DataType v;
-
- df [coef_index] = sf [coef_index] + sf [coef_index + 4];
- df [coef_index + 4] = sf [coef_index] - sf [coef_index + 4];
- df [coef_index + 2] = sf [coef_index + 2];
- df [coef_index + 6] = sf [coef_index + 6];
-
- v = (sf [coef_index + 5] - sf [coef_index + 7]) * sqrt2_2;
- df [coef_index + 1] = sf [coef_index + 1] + v;
- df [coef_index + 3] = sf [coef_index + 1] - v;
-
- v = (sf [coef_index + 5] + sf [coef_index + 7]) * sqrt2_2;
- df [coef_index + 5] = v + sf [coef_index + 3];
- df [coef_index + 7] = v - sf [coef_index + 3];
-
- coef_index += 8;
- }
- while (coef_index < _length);
-}
-
-
-
-template <class DT>
-void FFTReal <DT>::compute_direct_pass_n (DataType df [], const DataType sf [], int pass) const
-{
- assert (df != 0);
- assert (sf != 0);
- assert (df != sf);
- assert (pass >= 3);
- assert (pass < _nbr_bits);
-
- if (pass <= TRIGO_BD_LIMIT)
- {
- compute_direct_pass_n_lut (df, sf, pass);
- }
- else
- {
- compute_direct_pass_n_osc (df, sf, pass);
- }
-}
-
-
-
-template <class DT>
-void FFTReal <DT>::compute_direct_pass_n_lut (DataType df [], const DataType sf [], int pass) const
-{
- assert (df != 0);
- assert (sf != 0);
- assert (df != sf);
- assert (pass >= 3);
- assert (pass < _nbr_bits);
-
- const long nbr_coef = 1 << pass;
- const long h_nbr_coef = nbr_coef >> 1;
- const long d_nbr_coef = nbr_coef << 1;
- long coef_index = 0;
- const DataType * const cos_ptr = get_trigo_ptr (pass);
- do
- {
- const DataType * const sf1r = sf + coef_index;
- const DataType * const sf2r = sf1r + nbr_coef;
- DataType * const dfr = df + coef_index;
- DataType * const dfi = dfr + nbr_coef;
-
- // Extreme coefficients are always real
- dfr [0] = sf1r [0] + sf2r [0];
- dfi [0] = sf1r [0] - sf2r [0]; // dfr [nbr_coef] =
- dfr [h_nbr_coef] = sf1r [h_nbr_coef];
- dfi [h_nbr_coef] = sf2r [h_nbr_coef];
-
- // Others are conjugate complex numbers
- const DataType * const sf1i = sf1r + h_nbr_coef;
- const DataType * const sf2i = sf1i + nbr_coef;
- for (long i = 1; i < h_nbr_coef; ++ i)
- {
- const DataType c = cos_ptr [i]; // cos (i*PI/nbr_coef);
- const DataType s = cos_ptr [h_nbr_coef - i]; // sin (i*PI/nbr_coef);
- DataType v;
-
- v = sf2r [i] * c - sf2i [i] * s;
- dfr [i] = sf1r [i] + v;
- dfi [-i] = sf1r [i] - v; // dfr [nbr_coef - i] =
-
- v = sf2r [i] * s + sf2i [i] * c;
- dfi [i] = v + sf1i [i];
- dfi [nbr_coef - i] = v - sf1i [i];
- }
-
- coef_index += d_nbr_coef;
- }
- while (coef_index < _length);
-}
-
-
-
-template <class DT>
-void FFTReal <DT>::compute_direct_pass_n_osc (DataType df [], const DataType sf [], int pass) const
-{
- assert (df != 0);
- assert (sf != 0);
- assert (df != sf);
- assert (pass > TRIGO_BD_LIMIT);
- assert (pass < _nbr_bits);
-
- const long nbr_coef = 1 << pass;
- const long h_nbr_coef = nbr_coef >> 1;
- const long d_nbr_coef = nbr_coef << 1;
- long coef_index = 0;
- OscType & osc = _trigo_osc [pass - (TRIGO_BD_LIMIT + 1)];
- do
- {
- const DataType * const sf1r = sf + coef_index;
- const DataType * const sf2r = sf1r + nbr_coef;
- DataType * const dfr = df + coef_index;
- DataType * const dfi = dfr + nbr_coef;
-
- osc.clear_buffers ();
-
- // Extreme coefficients are always real
- dfr [0] = sf1r [0] + sf2r [0];
- dfi [0] = sf1r [0] - sf2r [0]; // dfr [nbr_coef] =
- dfr [h_nbr_coef] = sf1r [h_nbr_coef];
- dfi [h_nbr_coef] = sf2r [h_nbr_coef];
-
- // Others are conjugate complex numbers
- const DataType * const sf1i = sf1r + h_nbr_coef;
- const DataType * const sf2i = sf1i + nbr_coef;
- for (long i = 1; i < h_nbr_coef; ++ i)
- {
- osc.step ();
- const DataType c = osc.get_cos ();
- const DataType s = osc.get_sin ();
- DataType v;
-
- v = sf2r [i] * c - sf2i [i] * s;
- dfr [i] = sf1r [i] + v;
- dfi [-i] = sf1r [i] - v; // dfr [nbr_coef - i] =
-
- v = sf2r [i] * s + sf2i [i] * c;
- dfi [i] = v + sf1i [i];
- dfi [nbr_coef - i] = v - sf1i [i];
- }
-
- coef_index += d_nbr_coef;
- }
- while (coef_index < _length);
-}
-
-
-
-// Transform in several pass
-template <class DT>
-void FFTReal <DT>::compute_ifft_general (const DataType f [], DataType x []) const
-{
- assert (f != 0);
- assert (f != use_buffer ());
- assert (x != 0);
- assert (x != use_buffer ());
- assert (x != f);
-
- DataType * sf = const_cast <DataType *> (f);
- DataType * df;
- DataType * df_temp;
-
- if (_nbr_bits & 1)
- {
- df = use_buffer ();
- df_temp = x;
- }
- else
- {
- df = x;
- df_temp = use_buffer ();
- }
-
- for (int pass = _nbr_bits - 1; pass >= 3; -- pass)
- {
- compute_inverse_pass_n (df, sf, pass);
-
- if (pass < _nbr_bits - 1)
- {
- DataType * const temp_ptr = df;
- df = sf;
- sf = temp_ptr;
- }
- else
- {
- sf = df;
- df = df_temp;
- }
- }
-
- compute_inverse_pass_3 (df, sf);
- compute_inverse_pass_1_2 (x, df);
-}
-
-
-
-template <class DT>
-void FFTReal <DT>::compute_inverse_pass_n (DataType df [], const DataType sf [], int pass) const
-{
- assert (df != 0);
- assert (sf != 0);
- assert (df != sf);
- assert (pass >= 3);
- assert (pass < _nbr_bits);
-
- if (pass <= TRIGO_BD_LIMIT)
- {
- compute_inverse_pass_n_lut (df, sf, pass);
- }
- else
- {
- compute_inverse_pass_n_osc (df, sf, pass);
- }
-}
-
-
-
-template <class DT>
-void FFTReal <DT>::compute_inverse_pass_n_lut (DataType df [], const DataType sf [], int pass) const
-{
- assert (df != 0);
- assert (sf != 0);
- assert (df != sf);
- assert (pass >= 3);
- assert (pass < _nbr_bits);
-
- const long nbr_coef = 1 << pass;
- const long h_nbr_coef = nbr_coef >> 1;
- const long d_nbr_coef = nbr_coef << 1;
- long coef_index = 0;
- const DataType * const cos_ptr = get_trigo_ptr (pass);
- do
- {
- const DataType * const sfr = sf + coef_index;
- const DataType * const sfi = sfr + nbr_coef;
- DataType * const df1r = df + coef_index;
- DataType * const df2r = df1r + nbr_coef;
-
- // Extreme coefficients are always real
- df1r [0] = sfr [0] + sfi [0]; // + sfr [nbr_coef]
- df2r [0] = sfr [0] - sfi [0]; // - sfr [nbr_coef]
- df1r [h_nbr_coef] = sfr [h_nbr_coef] * 2;
- df2r [h_nbr_coef] = sfi [h_nbr_coef] * 2;
-
- // Others are conjugate complex numbers
- DataType * const df1i = df1r + h_nbr_coef;
- DataType * const df2i = df1i + nbr_coef;
- for (long i = 1; i < h_nbr_coef; ++ i)
- {
- df1r [i] = sfr [i] + sfi [-i]; // + sfr [nbr_coef - i]
- df1i [i] = sfi [i] - sfi [nbr_coef - i];
-
- const DataType c = cos_ptr [i]; // cos (i*PI/nbr_coef);
- const DataType s = cos_ptr [h_nbr_coef - i]; // sin (i*PI/nbr_coef);
- const DataType vr = sfr [i] - sfi [-i]; // - sfr [nbr_coef - i]
- const DataType vi = sfi [i] + sfi [nbr_coef - i];
-
- df2r [i] = vr * c + vi * s;
- df2i [i] = vi * c - vr * s;
- }
-
- coef_index += d_nbr_coef;
- }
- while (coef_index < _length);
-}
-
-
-
-template <class DT>
-void FFTReal <DT>::compute_inverse_pass_n_osc (DataType df [], const DataType sf [], int pass) const
-{
- assert (df != 0);
- assert (sf != 0);
- assert (df != sf);
- assert (pass > TRIGO_BD_LIMIT);
- assert (pass < _nbr_bits);
-
- const long nbr_coef = 1 << pass;
- const long h_nbr_coef = nbr_coef >> 1;
- const long d_nbr_coef = nbr_coef << 1;
- long coef_index = 0;
- OscType & osc = _trigo_osc [pass - (TRIGO_BD_LIMIT + 1)];
- do
- {
- const DataType * const sfr = sf + coef_index;
- const DataType * const sfi = sfr + nbr_coef;
- DataType * const df1r = df + coef_index;
- DataType * const df2r = df1r + nbr_coef;
-
- osc.clear_buffers ();
-
- // Extreme coefficients are always real
- df1r [0] = sfr [0] + sfi [0]; // + sfr [nbr_coef]
- df2r [0] = sfr [0] - sfi [0]; // - sfr [nbr_coef]
- df1r [h_nbr_coef] = sfr [h_nbr_coef] * 2;
- df2r [h_nbr_coef] = sfi [h_nbr_coef] * 2;
-
- // Others are conjugate complex numbers
- DataType * const df1i = df1r + h_nbr_coef;
- DataType * const df2i = df1i + nbr_coef;
- for (long i = 1; i < h_nbr_coef; ++ i)
- {
- df1r [i] = sfr [i] + sfi [-i]; // + sfr [nbr_coef - i]
- df1i [i] = sfi [i] - sfi [nbr_coef - i];
-
- osc.step ();
- const DataType c = osc.get_cos ();
- const DataType s = osc.get_sin ();
- const DataType vr = sfr [i] - sfi [-i]; // - sfr [nbr_coef - i]
- const DataType vi = sfi [i] + sfi [nbr_coef - i];
-
- df2r [i] = vr * c + vi * s;
- df2i [i] = vi * c - vr * s;
- }
-
- coef_index += d_nbr_coef;
- }
- while (coef_index < _length);
-}
-
-
-
-template <class DT>
-void FFTReal <DT>::compute_inverse_pass_3 (DataType df [], const DataType sf []) const
-{
- assert (df != 0);
- assert (sf != 0);
- assert (df != sf);
-
- const DataType sqrt2_2 = DataType (SQRT2 * 0.5);
- long coef_index = 0;
- do
- {
- df [coef_index] = sf [coef_index] + sf [coef_index + 4];
- df [coef_index + 4] = sf [coef_index] - sf [coef_index + 4];
- df [coef_index + 2] = sf [coef_index + 2] * 2;
- df [coef_index + 6] = sf [coef_index + 6] * 2;
-
- df [coef_index + 1] = sf [coef_index + 1] + sf [coef_index + 3];
- df [coef_index + 3] = sf [coef_index + 5] - sf [coef_index + 7];
-
- const DataType vr = sf [coef_index + 1] - sf [coef_index + 3];
- const DataType vi = sf [coef_index + 5] + sf [coef_index + 7];
-
- df [coef_index + 5] = (vr + vi) * sqrt2_2;
- df [coef_index + 7] = (vi - vr) * sqrt2_2;
-
- coef_index += 8;
- }
- while (coef_index < _length);
-}
-
-
-
-template <class DT>
-void FFTReal <DT>::compute_inverse_pass_1_2 (DataType x [], const DataType sf []) const
-{
- assert (x != 0);
- assert (sf != 0);
- assert (x != sf);
-
- const long * bit_rev_lut_ptr = get_br_ptr ();
- const DataType * sf2 = sf;
- long coef_index = 0;
- do
- {
- {
- const DataType b_0 = sf2 [0] + sf2 [2];
- const DataType b_2 = sf2 [0] - sf2 [2];
- const DataType b_1 = sf2 [1] * 2;
- const DataType b_3 = sf2 [3] * 2;
-
- x [bit_rev_lut_ptr [0]] = b_0 + b_1;
- x [bit_rev_lut_ptr [1]] = b_0 - b_1;
- x [bit_rev_lut_ptr [2]] = b_2 + b_3;
- x [bit_rev_lut_ptr [3]] = b_2 - b_3;
- }
- {
- const DataType b_0 = sf2 [4] + sf2 [6];
- const DataType b_2 = sf2 [4] - sf2 [6];
- const DataType b_1 = sf2 [5] * 2;
- const DataType b_3 = sf2 [7] * 2;
-
- x [bit_rev_lut_ptr [4]] = b_0 + b_1;
- x [bit_rev_lut_ptr [5]] = b_0 - b_1;
- x [bit_rev_lut_ptr [6]] = b_2 + b_3;
- x [bit_rev_lut_ptr [7]] = b_2 - b_3;
- }
-
- sf2 += 8;
- coef_index += 8;
- bit_rev_lut_ptr += 8;
- }
- while (coef_index < _length);
-}
-
-
-
-#endif // FFTReal_CODEHEADER_INCLUDED
-
-#undef FFTReal_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTRealFixLen.h b/examples/spectrum/3rdparty/fftreal/FFTRealFixLen.h
deleted file mode 100644
index 0b80266..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTRealFixLen.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*****************************************************************************
-
- FFTRealFixLen.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (FFTRealFixLen_HEADER_INCLUDED)
-#define FFTRealFixLen_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "Array.h"
-#include "DynArray.h"
-#include "FFTRealFixLenParam.h"
-#include "OscSinCos.h"
-
-
-
-template <int LL2>
-class FFTRealFixLen
-{
- typedef int CompileTimeCheck1 [(LL2 >= 0) ? 1 : -1];
- typedef int CompileTimeCheck2 [(LL2 <= 30) ? 1 : -1];
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- typedef FFTRealFixLenParam::DataType DataType;
- typedef OscSinCos <DataType> OscType;
-
- enum { FFT_LEN_L2 = LL2 };
- enum { FFT_LEN = 1 << FFT_LEN_L2 };
-
- FFTRealFixLen ();
-
- inline long get_length () const;
- void do_fft (DataType f [], const DataType x []);
- void do_ifft (const DataType f [], DataType x []);
- void rescale (DataType x []) const;
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- enum { TRIGO_BD_LIMIT = FFTRealFixLenParam::TRIGO_BD_LIMIT };
-
- enum { BR_ARR_SIZE_L2 = ((FFT_LEN_L2 - 3) < 0) ? 0 : (FFT_LEN_L2 - 2) };
- enum { BR_ARR_SIZE = 1 << BR_ARR_SIZE_L2 };
-
- enum { TRIGO_BD = ((FFT_LEN_L2 - TRIGO_BD_LIMIT) < 0)
- ? (int)FFT_LEN_L2
- : (int)TRIGO_BD_LIMIT };
- enum { TRIGO_TABLE_ARR_SIZE_L2 = (LL2 < 4) ? 0 : (TRIGO_BD - 2) };
- enum { TRIGO_TABLE_ARR_SIZE = 1 << TRIGO_TABLE_ARR_SIZE_L2 };
-
- enum { NBR_TRIGO_OSC = FFT_LEN_L2 - TRIGO_BD };
- enum { TRIGO_OSC_ARR_SIZE = (NBR_TRIGO_OSC > 0) ? NBR_TRIGO_OSC : 1 };
-
- void build_br_lut ();
- void build_trigo_lut ();
- void build_trigo_osc ();
-
- DynArray <DataType>
- _buffer;
- DynArray <long>
- _br_data;
- DynArray <DataType>
- _trigo_data;
- Array <OscType, TRIGO_OSC_ARR_SIZE>
- _trigo_osc;
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- FFTRealFixLen (const FFTRealFixLen &other);
- FFTRealFixLen& operator = (const FFTRealFixLen &other);
- bool operator == (const FFTRealFixLen &other);
- bool operator != (const FFTRealFixLen &other);
-
-}; // class FFTRealFixLen
-
-
-
-#include "FFTRealFixLen.hpp"
-
-
-
-#endif // FFTRealFixLen_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTRealFixLen.hpp b/examples/spectrum/3rdparty/fftreal/FFTRealFixLen.hpp
deleted file mode 100644
index 6defb00..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTRealFixLen.hpp
+++ /dev/null
@@ -1,322 +0,0 @@
-/*****************************************************************************
-
- FFTRealFixLen.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (FFTRealFixLen_CURRENT_CODEHEADER)
- #error Recursive inclusion of FFTRealFixLen code header.
-#endif
-#define FFTRealFixLen_CURRENT_CODEHEADER
-
-#if ! defined (FFTRealFixLen_CODEHEADER_INCLUDED)
-#define FFTRealFixLen_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "def.h"
-#include "FFTRealPassDirect.h"
-#include "FFTRealPassInverse.h"
-#include "FFTRealSelect.h"
-
-#include <cassert>
-#include <cmath>
-
-namespace std { }
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <int LL2>
-FFTRealFixLen <LL2>::FFTRealFixLen ()
-: _buffer (FFT_LEN)
-, _br_data (BR_ARR_SIZE)
-, _trigo_data (TRIGO_TABLE_ARR_SIZE)
-, _trigo_osc ()
-{
- build_br_lut ();
- build_trigo_lut ();
- build_trigo_osc ();
-}
-
-
-
-template <int LL2>
-long FFTRealFixLen <LL2>::get_length () const
-{
- return (FFT_LEN);
-}
-
-
-
-// General case
-template <int LL2>
-void FFTRealFixLen <LL2>::do_fft (DataType f [], const DataType x [])
-{
- assert (f != 0);
- assert (x != 0);
- assert (x != f);
- assert (FFT_LEN_L2 >= 3);
-
- // Do the transform in several passes
- const DataType * cos_ptr = &_trigo_data [0];
- const long * br_ptr = &_br_data [0];
-
- FFTRealPassDirect <FFT_LEN_L2 - 1>::process (
- FFT_LEN,
- f,
- &_buffer [0],
- x,
- cos_ptr,
- TRIGO_TABLE_ARR_SIZE,
- br_ptr,
- &_trigo_osc [0]
- );
-}
-
-// 4-point FFT
-template <>
-void FFTRealFixLen <2>::do_fft (DataType f [], const DataType x [])
-{
- assert (f != 0);
- assert (x != 0);
- assert (x != f);
-
- f [1] = x [0] - x [2];
- f [3] = x [1] - x [3];
-
- const DataType b_0 = x [0] + x [2];
- const DataType b_2 = x [1] + x [3];
-
- f [0] = b_0 + b_2;
- f [2] = b_0 - b_2;
-}
-
-// 2-point FFT
-template <>
-void FFTRealFixLen <1>::do_fft (DataType f [], const DataType x [])
-{
- assert (f != 0);
- assert (x != 0);
- assert (x != f);
-
- f [0] = x [0] + x [1];
- f [1] = x [0] - x [1];
-}
-
-// 1-point FFT
-template <>
-void FFTRealFixLen <0>::do_fft (DataType f [], const DataType x [])
-{
- assert (f != 0);
- assert (x != 0);
-
- f [0] = x [0];
-}
-
-
-
-// General case
-template <int LL2>
-void FFTRealFixLen <LL2>::do_ifft (const DataType f [], DataType x [])
-{
- assert (f != 0);
- assert (x != 0);
- assert (x != f);
- assert (FFT_LEN_L2 >= 3);
-
- // Do the transform in several passes
- DataType * s_ptr =
- FFTRealSelect <FFT_LEN_L2 & 1>::sel_bin (&_buffer [0], x);
- DataType * d_ptr =
- FFTRealSelect <FFT_LEN_L2 & 1>::sel_bin (x, &_buffer [0]);
- const DataType * cos_ptr = &_trigo_data [0];
- const long * br_ptr = &_br_data [0];
-
- FFTRealPassInverse <FFT_LEN_L2 - 1>::process (
- FFT_LEN,
- d_ptr,
- s_ptr,
- f,
- cos_ptr,
- TRIGO_TABLE_ARR_SIZE,
- br_ptr,
- &_trigo_osc [0]
- );
-}
-
-// 4-point IFFT
-template <>
-void FFTRealFixLen <2>::do_ifft (const DataType f [], DataType x [])
-{
- assert (f != 0);
- assert (x != 0);
- assert (x != f);
-
- const DataType b_0 = f [0] + f [2];
- const DataType b_2 = f [0] - f [2];
-
- x [0] = b_0 + f [1] * 2;
- x [2] = b_0 - f [1] * 2;
- x [1] = b_2 + f [3] * 2;
- x [3] = b_2 - f [3] * 2;
-}
-
-// 2-point IFFT
-template <>
-void FFTRealFixLen <1>::do_ifft (const DataType f [], DataType x [])
-{
- assert (f != 0);
- assert (x != 0);
- assert (x != f);
-
- x [0] = f [0] + f [1];
- x [1] = f [0] - f [1];
-}
-
-// 1-point IFFT
-template <>
-void FFTRealFixLen <0>::do_ifft (const DataType f [], DataType x [])
-{
- assert (f != 0);
- assert (x != 0);
- assert (x != f);
-
- x [0] = f [0];
-}
-
-
-
-
-template <int LL2>
-void FFTRealFixLen <LL2>::rescale (DataType x []) const
-{
- assert (x != 0);
-
- const DataType mul = DataType (1.0 / FFT_LEN);
-
- if (FFT_LEN < 4)
- {
- long i = FFT_LEN - 1;
- do
- {
- x [i] *= mul;
- --i;
- }
- while (i >= 0);
- }
-
- else
- {
- assert ((FFT_LEN & 3) == 0);
-
- // Could be optimized with SIMD instruction sets (needs alignment check)
- long i = FFT_LEN - 4;
- do
- {
- x [i + 0] *= mul;
- x [i + 1] *= mul;
- x [i + 2] *= mul;
- x [i + 3] *= mul;
- i -= 4;
- }
- while (i >= 0);
- }
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <int LL2>
-void FFTRealFixLen <LL2>::build_br_lut ()
-{
- _br_data [0] = 0;
- for (long cnt = 1; cnt < BR_ARR_SIZE; ++cnt)
- {
- long index = cnt << 2;
- long br_index = 0;
-
- int bit_cnt = FFT_LEN_L2;
- do
- {
- br_index <<= 1;
- br_index += (index & 1);
- index >>= 1;
-
- -- bit_cnt;
- }
- while (bit_cnt > 0);
-
- _br_data [cnt] = br_index;
- }
-}
-
-
-
-template <int LL2>
-void FFTRealFixLen <LL2>::build_trigo_lut ()
-{
- const double mul = (0.5 * PI) / TRIGO_TABLE_ARR_SIZE;
- for (long i = 0; i < TRIGO_TABLE_ARR_SIZE; ++ i)
- {
- using namespace std;
-
- _trigo_data [i] = DataType (cos (i * mul));
- }
-}
-
-
-
-template <int LL2>
-void FFTRealFixLen <LL2>::build_trigo_osc ()
-{
- for (int i = 0; i < NBR_TRIGO_OSC; ++i)
- {
- OscType & osc = _trigo_osc [i];
-
- const long len = static_cast <long> (TRIGO_TABLE_ARR_SIZE) << (i + 1);
- const double mul = (0.5 * PI) / len;
- osc.set_step (mul);
- }
-}
-
-
-
-#endif // FFTRealFixLen_CODEHEADER_INCLUDED
-
-#undef FFTRealFixLen_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTRealFixLenParam.h b/examples/spectrum/3rdparty/fftreal/FFTRealFixLenParam.h
deleted file mode 100644
index 163c083..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTRealFixLenParam.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*****************************************************************************
-
- FFTRealFixLenParam.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (FFTRealFixLenParam_HEADER_INCLUDED)
-#define FFTRealFixLenParam_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-class FFTRealFixLenParam
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- // Over this bit depth, we use direct calculation for sin/cos
- enum { TRIGO_BD_LIMIT = 12 };
-
- typedef float DataType;
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
-#if 0 // To avoid GCC warning:
- // All member functions in class 'FFTRealFixLenParam' are private
- FFTRealFixLenParam ();
- ~FFTRealFixLenParam ();
- FFTRealFixLenParam (const FFTRealFixLenParam &other);
- FFTRealFixLenParam &
- operator = (const FFTRealFixLenParam &other);
- bool operator == (const FFTRealFixLenParam &other);
- bool operator != (const FFTRealFixLenParam &other);
-#endif
-
-}; // class FFTRealFixLenParam
-
-
-
-//#include "FFTRealFixLenParam.hpp"
-
-
-
-#endif // FFTRealFixLenParam_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTRealPassDirect.h b/examples/spectrum/3rdparty/fftreal/FFTRealPassDirect.h
deleted file mode 100644
index 7d19c02..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTRealPassDirect.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*****************************************************************************
-
- FFTRealPassDirect.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (FFTRealPassDirect_HEADER_INCLUDED)
-#define FFTRealPassDirect_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "def.h"
-#include "FFTRealFixLenParam.h"
-#include "OscSinCos.h"
-
-
-
-template <int PASS>
-class FFTRealPassDirect
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- typedef FFTRealFixLenParam::DataType DataType;
- typedef OscSinCos <DataType> OscType;
-
- FORCEINLINE static void
- process (long len, DataType dest_ptr [], DataType src_ptr [], const DataType x_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list []);
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- FFTRealPassDirect ();
- ~FFTRealPassDirect ();
- FFTRealPassDirect (const FFTRealPassDirect &other);
- FFTRealPassDirect &
- operator = (const FFTRealPassDirect &other);
- bool operator == (const FFTRealPassDirect &other);
- bool operator != (const FFTRealPassDirect &other);
-
-}; // class FFTRealPassDirect
-
-
-
-#include "FFTRealPassDirect.hpp"
-
-
-
-#endif // FFTRealPassDirect_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTRealPassDirect.hpp b/examples/spectrum/3rdparty/fftreal/FFTRealPassDirect.hpp
deleted file mode 100644
index db9d568..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTRealPassDirect.hpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*****************************************************************************
-
- FFTRealPassDirect.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (FFTRealPassDirect_CURRENT_CODEHEADER)
- #error Recursive inclusion of FFTRealPassDirect code header.
-#endif
-#define FFTRealPassDirect_CURRENT_CODEHEADER
-
-#if ! defined (FFTRealPassDirect_CODEHEADER_INCLUDED)
-#define FFTRealPassDirect_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "FFTRealUseTrigo.h"
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <>
-void FFTRealPassDirect <1>::process (long len, DataType dest_ptr [], DataType src_ptr [], const DataType x_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list [])
-{
- // First and second pass at once
- const long qlen = len >> 2;
-
- long coef_index = 0;
- do
- {
- // To do: unroll the loop (2x).
- const long ri_0 = br_ptr [coef_index >> 2];
- const long ri_1 = ri_0 + 2 * qlen; // bit_rev_lut_ptr [coef_index + 1];
- const long ri_2 = ri_0 + 1 * qlen; // bit_rev_lut_ptr [coef_index + 2];
- const long ri_3 = ri_0 + 3 * qlen; // bit_rev_lut_ptr [coef_index + 3];
-
- DataType * const df2 = dest_ptr + coef_index;
- df2 [1] = x_ptr [ri_0] - x_ptr [ri_1];
- df2 [3] = x_ptr [ri_2] - x_ptr [ri_3];
-
- const DataType sf_0 = x_ptr [ri_0] + x_ptr [ri_1];
- const DataType sf_2 = x_ptr [ri_2] + x_ptr [ri_3];
-
- df2 [0] = sf_0 + sf_2;
- df2 [2] = sf_0 - sf_2;
-
- coef_index += 4;
- }
- while (coef_index < len);
-}
-
-template <>
-void FFTRealPassDirect <2>::process (long len, DataType dest_ptr [], DataType src_ptr [], const DataType x_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list [])
-{
- // Executes "previous" passes first. Inverts source and destination buffers
- FFTRealPassDirect <1>::process (
- len,
- src_ptr,
- dest_ptr,
- x_ptr,
- cos_ptr,
- cos_len,
- br_ptr,
- osc_list
- );
-
- // Third pass
- const DataType sqrt2_2 = DataType (SQRT2 * 0.5);
-
- long coef_index = 0;
- do
- {
- dest_ptr [coef_index ] = src_ptr [coef_index] + src_ptr [coef_index + 4];
- dest_ptr [coef_index + 4] = src_ptr [coef_index] - src_ptr [coef_index + 4];
- dest_ptr [coef_index + 2] = src_ptr [coef_index + 2];
- dest_ptr [coef_index + 6] = src_ptr [coef_index + 6];
-
- DataType v;
-
- v = (src_ptr [coef_index + 5] - src_ptr [coef_index + 7]) * sqrt2_2;
- dest_ptr [coef_index + 1] = src_ptr [coef_index + 1] + v;
- dest_ptr [coef_index + 3] = src_ptr [coef_index + 1] - v;
-
- v = (src_ptr [coef_index + 5] + src_ptr [coef_index + 7]) * sqrt2_2;
- dest_ptr [coef_index + 5] = v + src_ptr [coef_index + 3];
- dest_ptr [coef_index + 7] = v - src_ptr [coef_index + 3];
-
- coef_index += 8;
- }
- while (coef_index < len);
-}
-
-template <int PASS>
-void FFTRealPassDirect <PASS>::process (long len, DataType dest_ptr [], DataType src_ptr [], const DataType x_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list [])
-{
- // Executes "previous" passes first. Inverts source and destination buffers
- FFTRealPassDirect <PASS - 1>::process (
- len,
- src_ptr,
- dest_ptr,
- x_ptr,
- cos_ptr,
- cos_len,
- br_ptr,
- osc_list
- );
-
- const long dist = 1L << (PASS - 1);
- const long c1_r = 0;
- const long c1_i = dist;
- const long c2_r = dist * 2;
- const long c2_i = dist * 3;
- const long cend = dist * 4;
- const long table_step = cos_len >> (PASS - 1);
-
- enum { TRIGO_OSC = PASS - FFTRealFixLenParam::TRIGO_BD_LIMIT };
- enum { TRIGO_DIRECT = (TRIGO_OSC >= 0) ? 1 : 0 };
-
- long coef_index = 0;
- do
- {
- const DataType * const sf = src_ptr + coef_index;
- DataType * const df = dest_ptr + coef_index;
-
- // Extreme coefficients are always real
- df [c1_r] = sf [c1_r] + sf [c2_r];
- df [c2_r] = sf [c1_r] - sf [c2_r];
- df [c1_i] = sf [c1_i];
- df [c2_i] = sf [c2_i];
-
- FFTRealUseTrigo <TRIGO_DIRECT>::prepare (osc_list [TRIGO_OSC]);
-
- // Others are conjugate complex numbers
- for (long i = 1; i < dist; ++ i)
- {
- DataType c;
- DataType s;
- FFTRealUseTrigo <TRIGO_DIRECT>::iterate (
- osc_list [TRIGO_OSC],
- c,
- s,
- cos_ptr,
- i * table_step,
- (dist - i) * table_step
- );
-
- const DataType sf_r_i = sf [c1_r + i];
- const DataType sf_i_i = sf [c1_i + i];
-
- const DataType v1 = sf [c2_r + i] * c - sf [c2_i + i] * s;
- df [c1_r + i] = sf_r_i + v1;
- df [c2_r - i] = sf_r_i - v1;
-
- const DataType v2 = sf [c2_r + i] * s + sf [c2_i + i] * c;
- df [c2_r + i] = v2 + sf_i_i;
- df [cend - i] = v2 - sf_i_i;
- }
-
- coef_index += cend;
- }
- while (coef_index < len);
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-#endif // FFTRealPassDirect_CODEHEADER_INCLUDED
-
-#undef FFTRealPassDirect_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTRealPassInverse.h b/examples/spectrum/3rdparty/fftreal/FFTRealPassInverse.h
deleted file mode 100644
index 2de8952..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTRealPassInverse.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*****************************************************************************
-
- FFTRealPassInverse.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (FFTRealPassInverse_HEADER_INCLUDED)
-#define FFTRealPassInverse_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "def.h"
-#include "FFTRealFixLenParam.h"
-#include "OscSinCos.h"
-
-
-
-
-template <int PASS>
-class FFTRealPassInverse
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- typedef FFTRealFixLenParam::DataType DataType;
- typedef OscSinCos <DataType> OscType;
-
- FORCEINLINE static void
- process (long len, DataType dest_ptr [], DataType src_ptr [], const DataType f_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list []);
- FORCEINLINE static void
- process_rec (long len, DataType dest_ptr [], DataType src_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list []);
- FORCEINLINE static void
- process_internal (long len, DataType dest_ptr [], const DataType src_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list []);
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- FFTRealPassInverse ();
- ~FFTRealPassInverse ();
- FFTRealPassInverse (const FFTRealPassInverse &other);
- FFTRealPassInverse &
- operator = (const FFTRealPassInverse &other);
- bool operator == (const FFTRealPassInverse &other);
- bool operator != (const FFTRealPassInverse &other);
-
-}; // class FFTRealPassInverse
-
-
-
-#include "FFTRealPassInverse.hpp"
-
-
-
-#endif // FFTRealPassInverse_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTRealPassInverse.hpp b/examples/spectrum/3rdparty/fftreal/FFTRealPassInverse.hpp
deleted file mode 100644
index 5737546..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTRealPassInverse.hpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/*****************************************************************************
-
- FFTRealPassInverse.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (FFTRealPassInverse_CURRENT_CODEHEADER)
- #error Recursive inclusion of FFTRealPassInverse code header.
-#endif
-#define FFTRealPassInverse_CURRENT_CODEHEADER
-
-#if ! defined (FFTRealPassInverse_CODEHEADER_INCLUDED)
-#define FFTRealPassInverse_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "FFTRealUseTrigo.h"
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <int PASS>
-void FFTRealPassInverse <PASS>::process (long len, DataType dest_ptr [], DataType src_ptr [], const DataType f_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list [])
-{
- process_internal (
- len,
- dest_ptr,
- f_ptr,
- cos_ptr,
- cos_len,
- br_ptr,
- osc_list
- );
- FFTRealPassInverse <PASS - 1>::process_rec (
- len,
- src_ptr,
- dest_ptr,
- cos_ptr,
- cos_len,
- br_ptr,
- osc_list
- );
-}
-
-
-
-template <int PASS>
-void FFTRealPassInverse <PASS>::process_rec (long len, DataType dest_ptr [], DataType src_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list [])
-{
- process_internal (
- len,
- dest_ptr,
- src_ptr,
- cos_ptr,
- cos_len,
- br_ptr,
- osc_list
- );
- FFTRealPassInverse <PASS - 1>::process_rec (
- len,
- src_ptr,
- dest_ptr,
- cos_ptr,
- cos_len,
- br_ptr,
- osc_list
- );
-}
-
-template <>
-void FFTRealPassInverse <0>::process_rec (long len, DataType dest_ptr [], DataType src_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list [])
-{
- // Stops recursion
-}
-
-
-
-template <int PASS>
-void FFTRealPassInverse <PASS>::process_internal (long len, DataType dest_ptr [], const DataType src_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list [])
-{
- const long dist = 1L << (PASS - 1);
- const long c1_r = 0;
- const long c1_i = dist;
- const long c2_r = dist * 2;
- const long c2_i = dist * 3;
- const long cend = dist * 4;
- const long table_step = cos_len >> (PASS - 1);
-
- enum { TRIGO_OSC = PASS - FFTRealFixLenParam::TRIGO_BD_LIMIT };
- enum { TRIGO_DIRECT = (TRIGO_OSC >= 0) ? 1 : 0 };
-
- long coef_index = 0;
- do
- {
- const DataType * const sf = src_ptr + coef_index;
- DataType * const df = dest_ptr + coef_index;
-
- // Extreme coefficients are always real
- df [c1_r] = sf [c1_r] + sf [c2_r];
- df [c2_r] = sf [c1_r] - sf [c2_r];
- df [c1_i] = sf [c1_i] * 2;
- df [c2_i] = sf [c2_i] * 2;
-
- FFTRealUseTrigo <TRIGO_DIRECT>::prepare (osc_list [TRIGO_OSC]);
-
- // Others are conjugate complex numbers
- for (long i = 1; i < dist; ++ i)
- {
- df [c1_r + i] = sf [c1_r + i] + sf [c2_r - i];
- df [c1_i + i] = sf [c2_r + i] - sf [cend - i];
-
- DataType c;
- DataType s;
- FFTRealUseTrigo <TRIGO_DIRECT>::iterate (
- osc_list [TRIGO_OSC],
- c,
- s,
- cos_ptr,
- i * table_step,
- (dist - i) * table_step
- );
-
- const DataType vr = sf [c1_r + i] - sf [c2_r - i];
- const DataType vi = sf [c2_r + i] + sf [cend - i];
-
- df [c2_r + i] = vr * c + vi * s;
- df [c2_i + i] = vi * c - vr * s;
- }
-
- coef_index += cend;
- }
- while (coef_index < len);
-}
-
-template <>
-void FFTRealPassInverse <2>::process_internal (long len, DataType dest_ptr [], const DataType src_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list [])
-{
- // Antepenultimate pass
- const DataType sqrt2_2 = DataType (SQRT2 * 0.5);
-
- long coef_index = 0;
- do
- {
- dest_ptr [coef_index ] = src_ptr [coef_index] + src_ptr [coef_index + 4];
- dest_ptr [coef_index + 4] = src_ptr [coef_index] - src_ptr [coef_index + 4];
- dest_ptr [coef_index + 2] = src_ptr [coef_index + 2] * 2;
- dest_ptr [coef_index + 6] = src_ptr [coef_index + 6] * 2;
-
- dest_ptr [coef_index + 1] = src_ptr [coef_index + 1] + src_ptr [coef_index + 3];
- dest_ptr [coef_index + 3] = src_ptr [coef_index + 5] - src_ptr [coef_index + 7];
-
- const DataType vr = src_ptr [coef_index + 1] - src_ptr [coef_index + 3];
- const DataType vi = src_ptr [coef_index + 5] + src_ptr [coef_index + 7];
-
- dest_ptr [coef_index + 5] = (vr + vi) * sqrt2_2;
- dest_ptr [coef_index + 7] = (vi - vr) * sqrt2_2;
-
- coef_index += 8;
- }
- while (coef_index < len);
-}
-
-template <>
-void FFTRealPassInverse <1>::process_internal (long len, DataType dest_ptr [], const DataType src_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list [])
-{
- // Penultimate and last pass at once
- const long qlen = len >> 2;
-
- long coef_index = 0;
- do
- {
- const long ri_0 = br_ptr [coef_index >> 2];
-
- const DataType b_0 = src_ptr [coef_index ] + src_ptr [coef_index + 2];
- const DataType b_2 = src_ptr [coef_index ] - src_ptr [coef_index + 2];
- const DataType b_1 = src_ptr [coef_index + 1] * 2;
- const DataType b_3 = src_ptr [coef_index + 3] * 2;
-
- dest_ptr [ri_0 ] = b_0 + b_1;
- dest_ptr [ri_0 + 2 * qlen] = b_0 - b_1;
- dest_ptr [ri_0 + 1 * qlen] = b_2 + b_3;
- dest_ptr [ri_0 + 3 * qlen] = b_2 - b_3;
-
- coef_index += 4;
- }
- while (coef_index < len);
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-#endif // FFTRealPassInverse_CODEHEADER_INCLUDED
-
-#undef FFTRealPassInverse_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTRealSelect.h b/examples/spectrum/3rdparty/fftreal/FFTRealSelect.h
deleted file mode 100644
index bd722d4..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTRealSelect.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*****************************************************************************
-
- FFTRealSelect.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (FFTRealSelect_HEADER_INCLUDED)
-#define FFTRealSelect_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "def.h"
-
-
-
-template <int P>
-class FFTRealSelect
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- FORCEINLINE static float *
- sel_bin (float *e_ptr, float *o_ptr);
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- FFTRealSelect ();
- ~FFTRealSelect ();
- FFTRealSelect (const FFTRealSelect &other);
- FFTRealSelect& operator = (const FFTRealSelect &other);
- bool operator == (const FFTRealSelect &other);
- bool operator != (const FFTRealSelect &other);
-
-}; // class FFTRealSelect
-
-
-
-#include "FFTRealSelect.hpp"
-
-
-
-#endif // FFTRealSelect_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTRealSelect.hpp b/examples/spectrum/3rdparty/fftreal/FFTRealSelect.hpp
deleted file mode 100644
index 9ddf586..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTRealSelect.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*****************************************************************************
-
- FFTRealSelect.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (FFTRealSelect_CURRENT_CODEHEADER)
- #error Recursive inclusion of FFTRealSelect code header.
-#endif
-#define FFTRealSelect_CURRENT_CODEHEADER
-
-#if ! defined (FFTRealSelect_CODEHEADER_INCLUDED)
-#define FFTRealSelect_CODEHEADER_INCLUDED
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <int P>
-float * FFTRealSelect <P>::sel_bin (float *e_ptr, float *o_ptr)
-{
- return (o_ptr);
-}
-
-
-
-template <>
-float * FFTRealSelect <0>::sel_bin (float *e_ptr, float *o_ptr)
-{
- return (e_ptr);
-}
-
-
-
-#endif // FFTRealSelect_CODEHEADER_INCLUDED
-
-#undef FFTRealSelect_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTRealUseTrigo.h b/examples/spectrum/3rdparty/fftreal/FFTRealUseTrigo.h
deleted file mode 100644
index c4368ee..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTRealUseTrigo.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*****************************************************************************
-
- FFTRealUseTrigo.h
- Copyright (c) 2005 Laurent de Soras
-
-Template parameters:
- - ALGO: algorithm choice. 0 = table, other = oscillator
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (FFTRealUseTrigo_HEADER_INCLUDED)
-#define FFTRealUseTrigo_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "def.h"
-#include "FFTRealFixLenParam.h"
-#include "OscSinCos.h"
-
-
-
-template <int ALGO>
-class FFTRealUseTrigo
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- typedef FFTRealFixLenParam::DataType DataType;
- typedef OscSinCos <DataType> OscType;
-
- FORCEINLINE static void
- prepare (OscType &osc);
- FORCEINLINE static void
- iterate (OscType &osc, DataType &c, DataType &s, const DataType cos_ptr [], long index_c, long index_s);
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- FFTRealUseTrigo ();
- ~FFTRealUseTrigo ();
- FFTRealUseTrigo (const FFTRealUseTrigo &other);
- FFTRealUseTrigo &
- operator = (const FFTRealUseTrigo &other);
- bool operator == (const FFTRealUseTrigo &other);
- bool operator != (const FFTRealUseTrigo &other);
-
-}; // class FFTRealUseTrigo
-
-
-
-#include "FFTRealUseTrigo.hpp"
-
-
-
-#endif // FFTRealUseTrigo_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/FFTRealUseTrigo.hpp b/examples/spectrum/3rdparty/fftreal/FFTRealUseTrigo.hpp
deleted file mode 100644
index aa968b8..0000000
--- a/examples/spectrum/3rdparty/fftreal/FFTRealUseTrigo.hpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*****************************************************************************
-
- FFTRealUseTrigo.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (FFTRealUseTrigo_CURRENT_CODEHEADER)
- #error Recursive inclusion of FFTRealUseTrigo code header.
-#endif
-#define FFTRealUseTrigo_CURRENT_CODEHEADER
-
-#if ! defined (FFTRealUseTrigo_CODEHEADER_INCLUDED)
-#define FFTRealUseTrigo_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "OscSinCos.h"
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <int ALGO>
-void FFTRealUseTrigo <ALGO>::prepare (OscType &osc)
-{
- osc.clear_buffers ();
-}
-
-template <>
-void FFTRealUseTrigo <0>::prepare (OscType &osc)
-{
- // Nothing
-}
-
-
-
-template <int ALGO>
-void FFTRealUseTrigo <ALGO>::iterate (OscType &osc, DataType &c, DataType &s, const DataType cos_ptr [], long index_c, long index_s)
-{
- osc.step ();
- c = osc.get_cos ();
- s = osc.get_sin ();
-}
-
-template <>
-void FFTRealUseTrigo <0>::iterate (OscType &osc, DataType &c, DataType &s, const DataType cos_ptr [], long index_c, long index_s)
-{
- c = cos_ptr [index_c];
- s = cos_ptr [index_s];
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-#endif // FFTRealUseTrigo_CODEHEADER_INCLUDED
-
-#undef FFTRealUseTrigo_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/OscSinCos.h b/examples/spectrum/3rdparty/fftreal/OscSinCos.h
deleted file mode 100644
index 775fc14..0000000
--- a/examples/spectrum/3rdparty/fftreal/OscSinCos.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*****************************************************************************
-
- OscSinCos.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (OscSinCos_HEADER_INCLUDED)
-#define OscSinCos_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "def.h"
-
-
-
-template <class T>
-class OscSinCos
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- typedef T DataType;
-
- OscSinCos ();
-
- FORCEINLINE void
- set_step (double angle_rad);
-
- FORCEINLINE DataType
- get_cos () const;
- FORCEINLINE DataType
- get_sin () const;
- FORCEINLINE void
- step ();
- FORCEINLINE void
- clear_buffers ();
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- DataType _pos_cos; // Current phase expressed with sin and cos. [-1 ; 1]
- DataType _pos_sin; // -
- DataType _step_cos; // Phase increment per step, [-1 ; 1]
- DataType _step_sin; // -
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- OscSinCos (const OscSinCos &other);
- OscSinCos & operator = (const OscSinCos &other);
- bool operator == (const OscSinCos &other);
- bool operator != (const OscSinCos &other);
-
-}; // class OscSinCos
-
-
-
-#include "OscSinCos.hpp"
-
-
-
-#endif // OscSinCos_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/OscSinCos.hpp b/examples/spectrum/3rdparty/fftreal/OscSinCos.hpp
deleted file mode 100644
index 749aef0..0000000
--- a/examples/spectrum/3rdparty/fftreal/OscSinCos.hpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*****************************************************************************
-
- OscSinCos.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (OscSinCos_CURRENT_CODEHEADER)
- #error Recursive inclusion of OscSinCos code header.
-#endif
-#define OscSinCos_CURRENT_CODEHEADER
-
-#if ! defined (OscSinCos_CODEHEADER_INCLUDED)
-#define OscSinCos_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include <cmath>
-
-namespace std { }
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class T>
-OscSinCos <T>::OscSinCos ()
-: _pos_cos (1)
-, _pos_sin (0)
-, _step_cos (1)
-, _step_sin (0)
-{
- // Nothing
-}
-
-
-
-template <class T>
-void OscSinCos <T>::set_step (double angle_rad)
-{
- using namespace std;
-
- _step_cos = static_cast <DataType> (cos (angle_rad));
- _step_sin = static_cast <DataType> (sin (angle_rad));
-}
-
-
-
-template <class T>
-typename OscSinCos <T>::DataType OscSinCos <T>::get_cos () const
-{
- return (_pos_cos);
-}
-
-
-
-template <class T>
-typename OscSinCos <T>::DataType OscSinCos <T>::get_sin () const
-{
- return (_pos_sin);
-}
-
-
-
-template <class T>
-void OscSinCos <T>::step ()
-{
- const DataType old_cos = _pos_cos;
- const DataType old_sin = _pos_sin;
-
- _pos_cos = old_cos * _step_cos - old_sin * _step_sin;
- _pos_sin = old_cos * _step_sin + old_sin * _step_cos;
-}
-
-
-
-template <class T>
-void OscSinCos <T>::clear_buffers ()
-{
- _pos_cos = static_cast <DataType> (1);
- _pos_sin = static_cast <DataType> (0);
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-#endif // OscSinCos_CODEHEADER_INCLUDED
-
-#undef OscSinCos_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/TestAccuracy.h b/examples/spectrum/3rdparty/fftreal/TestAccuracy.h
deleted file mode 100644
index 4b07a6b..0000000
--- a/examples/spectrum/3rdparty/fftreal/TestAccuracy.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*****************************************************************************
-
- TestAccuracy.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (TestAccuracy_HEADER_INCLUDED)
-#define TestAccuracy_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class FO>
-class TestAccuracy
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- typedef typename FO::DataType DataType;
- typedef long double BigFloat; // To get maximum accuracy during intermediate calculations
-
- static int perform_test_single_object (FO &fft);
- static int perform_test_d (FO &fft, const char *class_name_0);
- static int perform_test_i (FO &fft, const char *class_name_0);
- static int perform_test_di (FO &fft, const char *class_name_0);
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- enum { NBR_ACC_TESTS = 10 * 1000 * 1000 };
- enum { MAX_NBR_TESTS = 10000 };
-
- static void compute_tf (DataType s [], const DataType x [], long length);
- static void compute_itf (DataType x [], const DataType s [], long length);
- static int compare_vect_display (const DataType x_ptr [], const DataType y_ptr [], long len, BigFloat &max_err_rel);
- static BigFloat
- compute_power (const DataType x_ptr [], long len);
- static BigFloat
- compute_power (const DataType x_ptr [], const DataType y_ptr [], long len);
- static void compare_vect (const DataType x_ptr [], const DataType y_ptr [], BigFloat &power, long &max_err_pos, long len);
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- TestAccuracy ();
- ~TestAccuracy ();
- TestAccuracy (const TestAccuracy &other);
- TestAccuracy & operator = (const TestAccuracy &other);
- bool operator == (const TestAccuracy &other);
- bool operator != (const TestAccuracy &other);
-
-}; // class TestAccuracy
-
-
-
-#include "TestAccuracy.hpp"
-
-
-
-#endif // TestAccuracy_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/TestAccuracy.hpp b/examples/spectrum/3rdparty/fftreal/TestAccuracy.hpp
deleted file mode 100644
index 5c794f7..0000000
--- a/examples/spectrum/3rdparty/fftreal/TestAccuracy.hpp
+++ /dev/null
@@ -1,472 +0,0 @@
-/*****************************************************************************
-
- TestAccuracy.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (TestAccuracy_CURRENT_CODEHEADER)
- #error Recursive inclusion of TestAccuracy code header.
-#endif
-#define TestAccuracy_CURRENT_CODEHEADER
-
-#if ! defined (TestAccuracy_CODEHEADER_INCLUDED)
-#define TestAccuracy_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "def.h"
-#include "test_fnc.h"
-#include "TestWhiteNoiseGen.h"
-
-#include <typeinfo>
-#include <vector>
-
-#include <cmath>
-#include <cstdio>
-
-
-
-static const double TestAccuracy_LN10 = 2.3025850929940456840179914546844;
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class FO>
-int TestAccuracy <FO>::perform_test_single_object (FO &fft)
-{
- assert (&fft != 0);
-
- using namespace std;
-
- int ret_val = 0;
-
- const std::type_info & ti = typeid (fft);
- const char * class_name_0 = ti.name ();
-
- if (ret_val == 0)
- {
- ret_val = perform_test_d (fft, class_name_0);
- }
- if (ret_val == 0)
- {
- ret_val = perform_test_i (fft, class_name_0);
- }
- if (ret_val == 0)
- {
- ret_val = perform_test_di (fft, class_name_0);
- }
-
- if (ret_val == 0)
- {
- printf ("\n");
- }
-
- return (ret_val);
-}
-
-
-
-template <class FO>
-int TestAccuracy <FO>::perform_test_d (FO &fft, const char *class_name_0)
-{
- assert (&fft != 0);
- assert (class_name_0 != 0);
-
- using namespace std;
-
- int ret_val = 0;
- const long len = fft.get_length ();
- const long nbr_tests = limit (
- NBR_ACC_TESTS / len / len,
- 1L,
- static_cast <long> (MAX_NBR_TESTS)
- );
-
- printf ("Testing %s::do_fft () [%ld samples]... ", class_name_0, len);
- fflush (stdout);
- TestWhiteNoiseGen <DataType> noise;
- std::vector <DataType> x (len);
- std::vector <DataType> s1 (len);
- std::vector <DataType> s2 (len);
- BigFloat err_avg = 0;
-
- for (long test = 0; test < nbr_tests && ret_val == 0; ++ test)
- {
- noise.generate (&x [0], len);
- fft.do_fft (&s1 [0], &x [0]);
- compute_tf (&s2 [0], &x [0], len);
-
- BigFloat max_err;
- compare_vect_display (&s1 [0], &s2 [0], len, max_err);
- err_avg += max_err;
- }
- err_avg /= NBR_ACC_TESTS;
-
- printf ("done.\n");
- printf (
- "Average maximum error: %.6f %% (%f dB)\n",
- static_cast <double> (err_avg * 100),
- static_cast <double> ((20 / TestAccuracy_LN10) * log (err_avg))
- );
-
- return (ret_val);
-}
-
-
-
-template <class FO>
-int TestAccuracy <FO>::perform_test_i (FO &fft, const char *class_name_0)
-{
- assert (&fft != 0);
- assert (class_name_0 != 0);
-
- using namespace std;
-
- int ret_val = 0;
- const long len = fft.get_length ();
- const long nbr_tests = limit (
- NBR_ACC_TESTS / len / len,
- 10L,
- static_cast <long> (MAX_NBR_TESTS)
- );
-
- printf ("Testing %s::do_ifft () [%ld samples]... ", class_name_0, len);
- fflush (stdout);
- TestWhiteNoiseGen <DataType> noise;
- std::vector <DataType> s (len);
- std::vector <DataType> x1 (len);
- std::vector <DataType> x2 (len);
- BigFloat err_avg = 0;
-
- for (long test = 0; test < nbr_tests && ret_val == 0; ++ test)
- {
- noise.generate (&s [0], len);
- fft.do_ifft (&s [0], &x1 [0]);
- compute_itf (&x2 [0], &s [0], len);
-
- BigFloat max_err;
- compare_vect_display (&x1 [0], &x2 [0], len, max_err);
- err_avg += max_err;
- }
- err_avg /= NBR_ACC_TESTS;
-
- printf ("done.\n");
- printf (
- "Average maximum error: %.6f %% (%f dB)\n",
- static_cast <double> (err_avg * 100),
- static_cast <double> ((20 / TestAccuracy_LN10) * log (err_avg))
- );
-
- return (ret_val);
-}
-
-
-
-template <class FO>
-int TestAccuracy <FO>::perform_test_di (FO &fft, const char *class_name_0)
-{
- assert (&fft != 0);
- assert (class_name_0 != 0);
-
- using namespace std;
-
- int ret_val = 0;
- const long len = fft.get_length ();
- const long nbr_tests = limit (
- NBR_ACC_TESTS / len / len,
- 1L,
- static_cast <long> (MAX_NBR_TESTS)
- );
-
- printf (
- "Testing %s::do_fft () / do_ifft () / rescale () [%ld samples]... ",
- class_name_0,
- len
- );
- fflush (stdout);
- TestWhiteNoiseGen <DataType> noise;
- std::vector <DataType> x (len);
- std::vector <DataType> s (len);
- std::vector <DataType> y (len);
- BigFloat err_avg = 0;
-
- for (long test = 0; test < nbr_tests && ret_val == 0; ++ test)
- {
- noise.generate (&x [0], len);
- fft.do_fft (&s [0], &x [0]);
- fft.do_ifft (&s [0], &y [0]);
- fft.rescale (&y [0]);
-
- BigFloat max_err;
- compare_vect_display (&x [0], &y [0], len, max_err);
- err_avg += max_err;
- }
- err_avg /= NBR_ACC_TESTS;
-
- printf ("done.\n");
- printf (
- "Average maximum error: %.6f %% (%f dB)\n",
- static_cast <double> (err_avg * 100),
- static_cast <double> ((20 / TestAccuracy_LN10) * log (err_avg))
- );
-
- return (ret_val);
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-// Positive transform
-template <class FO>
-void TestAccuracy <FO>::compute_tf (DataType s [], const DataType x [], long length)
-{
- assert (s != 0);
- assert (x != 0);
- assert (length >= 2);
- assert ((length & 1) == 0);
-
- const long nbr_bins = length >> 1;
-
- // DC and Nyquist
- BigFloat dc = 0;
- BigFloat ny = 0;
- for (long pos = 0; pos < length; pos += 2)
- {
- const BigFloat even = x [pos ];
- const BigFloat odd = x [pos + 1];
- dc += even + odd;
- ny += even - odd;
- }
- s [0 ] = static_cast <DataType> (dc);
- s [nbr_bins] = static_cast <DataType> (ny);
-
- // Regular bins
- for (long bin = 1; bin < nbr_bins; ++ bin)
- {
- BigFloat sum_r = 0;
- BigFloat sum_i = 0;
-
- const BigFloat m = bin * static_cast <BigFloat> (2 * PI) / length;
-
- for (long pos = 0; pos < length; ++pos)
- {
- using namespace std;
-
- const BigFloat phase = pos * m;
- const BigFloat e_r = cos (phase);
- const BigFloat e_i = sin (phase);
-
- sum_r += x [pos] * e_r;
- sum_i += x [pos] * e_i;
- }
-
- s [ bin] = static_cast <DataType> (sum_r);
- s [nbr_bins + bin] = static_cast <DataType> (sum_i);
- }
-}
-
-
-
-// Negative transform
-template <class FO>
-void TestAccuracy <FO>::compute_itf (DataType x [], const DataType s [], long length)
-{
- assert (s != 0);
- assert (x != 0);
- assert (length >= 2);
- assert ((length & 1) == 0);
-
- const long nbr_bins = length >> 1;
-
- // DC and Nyquist
- BigFloat dc = s [0 ];
- BigFloat ny = s [nbr_bins];
-
- // Regular bins
- for (long pos = 0; pos < length; ++pos)
- {
- BigFloat sum = dc + ny * (1 - 2 * (pos & 1));
-
- const BigFloat m = pos * static_cast <BigFloat> (-2 * PI) / length;
-
- for (long bin = 1; bin < nbr_bins; ++ bin)
- {
- using namespace std;
-
- const BigFloat phase = bin * m;
- const BigFloat e_r = cos (phase);
- const BigFloat e_i = sin (phase);
-
- sum += 2 * ( e_r * s [bin ]
- - e_i * s [bin + nbr_bins]);
- }
-
- x [pos] = static_cast <DataType> (sum);
- }
-}
-
-
-
-template <class FO>
-int TestAccuracy <FO>::compare_vect_display (const DataType x_ptr [], const DataType y_ptr [], long len, BigFloat &max_err_rel)
-{
- assert (x_ptr != 0);
- assert (y_ptr != 0);
- assert (len > 0);
- assert (&max_err_rel != 0);
-
- using namespace std;
-
- int ret_val = 0;
-
- BigFloat power = compute_power (&x_ptr [0], &y_ptr [0], len);
- BigFloat power_dif;
- long max_err_pos;
- compare_vect (&x_ptr [0], &y_ptr [0], power_dif, max_err_pos, len);
-
- if (power == 0)
- {
- power = power_dif;
- }
- const BigFloat power_err_rel = power_dif / power;
-
- BigFloat max_err = 0;
- max_err_rel = 0;
- if (max_err_pos >= 0)
- {
- max_err = y_ptr [max_err_pos] - x_ptr [max_err_pos];
- max_err_rel = 2 * fabs (max_err) / ( fabs (y_ptr [max_err_pos])
- + fabs (x_ptr [max_err_pos]));
- }
-
- if (power_err_rel > 0.001)
- {
- printf ("Power error : %f (%.6f %%)\n",
- static_cast <double> (power_err_rel),
- static_cast <double> (power_err_rel * 100)
- );
- if (max_err_pos >= 0)
- {
- printf (
- "Maximum error: %f - %f = %f (%f)\n",
- static_cast <double> (y_ptr [max_err_pos]),
- static_cast <double> (x_ptr [max_err_pos]),
- static_cast <double> (max_err),
- static_cast <double> (max_err_pos)
- );
- }
- }
-
- return (ret_val);
-}
-
-
-
-template <class FO>
-typename TestAccuracy <FO>::BigFloat TestAccuracy <FO>::compute_power (const DataType x_ptr [], long len)
-{
- assert (x_ptr != 0);
- assert (len > 0);
-
- BigFloat power = 0;
- for (long pos = 0; pos < len; ++pos)
- {
- const BigFloat val = x_ptr [pos];
-
- power += val * val;
- }
-
- using namespace std;
-
- power = sqrt (power) / len;
-
- return (power);
-}
-
-
-
-template <class FO>
-typename TestAccuracy <FO>::BigFloat TestAccuracy <FO>::compute_power (const DataType x_ptr [], const DataType y_ptr [], long len)
-{
- assert (x_ptr != 0);
- assert (y_ptr != 0);
- assert (len > 0);
-
- return ((compute_power (x_ptr, len) + compute_power (y_ptr, len)) * 0.5);
-}
-
-
-
-template <class FO>
-void TestAccuracy <FO>::compare_vect (const DataType x_ptr [], const DataType y_ptr [], BigFloat &power, long &max_err_pos, long len)
-{
- assert (x_ptr != 0);
- assert (y_ptr != 0);
- assert (len > 0);
- assert (&power != 0);
- assert (&max_err_pos != 0);
-
- power = 0;
- BigFloat max_dif2 = 0;
- max_err_pos = -1;
-
- for (long pos = 0; pos < len; ++pos)
- {
- const BigFloat x = x_ptr [pos];
- const BigFloat y = y_ptr [pos];
- const BigFloat dif = y - x;
- const BigFloat dif2 = dif * dif;
-
- power += dif2;
- if (dif2 > max_dif2)
- {
- max_err_pos = pos;
- max_dif2 = dif2;
- }
- }
-
- using namespace std;
-
- power = sqrt (power) / len;
-}
-
-
-
-#endif // TestAccuracy_CODEHEADER_INCLUDED
-
-#undef TestAccuracy_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/TestHelperFixLen.h b/examples/spectrum/3rdparty/fftreal/TestHelperFixLen.h
deleted file mode 100644
index ecff96d..0000000
--- a/examples/spectrum/3rdparty/fftreal/TestHelperFixLen.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*****************************************************************************
-
- TestHelperFixLen.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (TestHelperFixLen_HEADER_INCLUDED)
-#define TestHelperFixLen_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "FFTRealFixLen.h"
-
-
-
-template <int L>
-class TestHelperFixLen
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- typedef FFTRealFixLen <L> FftType;
-
- static void perform_test_accuracy (int &ret_val);
- static void perform_test_speed (int &ret_val);
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- TestHelperFixLen ();
- ~TestHelperFixLen ();
- TestHelperFixLen (const TestHelperFixLen &other);
- TestHelperFixLen &
- operator = (const TestHelperFixLen &other);
- bool operator == (const TestHelperFixLen &other);
- bool operator != (const TestHelperFixLen &other);
-
-}; // class TestHelperFixLen
-
-
-
-#include "TestHelperFixLen.hpp"
-
-
-
-#endif // TestHelperFixLen_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/TestHelperFixLen.hpp b/examples/spectrum/3rdparty/fftreal/TestHelperFixLen.hpp
deleted file mode 100644
index 25048b9..0000000
--- a/examples/spectrum/3rdparty/fftreal/TestHelperFixLen.hpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*****************************************************************************
-
- TestHelperFixLen.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (TestHelperFixLen_CURRENT_CODEHEADER)
- #error Recursive inclusion of TestHelperFixLen code header.
-#endif
-#define TestHelperFixLen_CURRENT_CODEHEADER
-
-#if ! defined (TestHelperFixLen_CODEHEADER_INCLUDED)
-#define TestHelperFixLen_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "test_settings.h"
-
-#include "TestAccuracy.h"
-#if defined (test_settings_SPEED_TEST_ENABLED)
- #include "TestSpeed.h"
-#endif
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <int L>
-void TestHelperFixLen <L>::perform_test_accuracy (int &ret_val)
-{
- if (ret_val == 0)
- {
- FftType fft;
- ret_val = TestAccuracy <FftType>::perform_test_single_object (fft);
- }
-}
-
-
-
-template <int L>
-void TestHelperFixLen <L>::perform_test_speed (int &ret_val)
-{
-#if defined (test_settings_SPEED_TEST_ENABLED)
-
- if (ret_val == 0)
- {
- FftType fft;
- ret_val = TestSpeed <FftType>::perform_test_single_object (fft);
- }
-
-#endif
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-#endif // TestHelperFixLen_CODEHEADER_INCLUDED
-
-#undef TestHelperFixLen_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/TestHelperNormal.h b/examples/spectrum/3rdparty/fftreal/TestHelperNormal.h
deleted file mode 100644
index a7bff5c..0000000
--- a/examples/spectrum/3rdparty/fftreal/TestHelperNormal.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*****************************************************************************
-
- TestHelperNormal.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (TestHelperNormal_HEADER_INCLUDED)
-#define TestHelperNormal_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "FFTReal.h"
-
-
-
-template <class DT>
-class TestHelperNormal
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- typedef DT DataType;
- typedef FFTReal <DataType> FftType;
-
- static void perform_test_accuracy (int &ret_val);
- static void perform_test_speed (int &ret_val);
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- TestHelperNormal ();
- ~TestHelperNormal ();
- TestHelperNormal (const TestHelperNormal &other);
- TestHelperNormal &
- operator = (const TestHelperNormal &other);
- bool operator == (const TestHelperNormal &other);
- bool operator != (const TestHelperNormal &other);
-
-}; // class TestHelperNormal
-
-
-
-#include "TestHelperNormal.hpp"
-
-
-
-#endif // TestHelperNormal_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/TestHelperNormal.hpp b/examples/spectrum/3rdparty/fftreal/TestHelperNormal.hpp
deleted file mode 100644
index e037696..0000000
--- a/examples/spectrum/3rdparty/fftreal/TestHelperNormal.hpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*****************************************************************************
-
- TestHelperNormal.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (TestHelperNormal_CURRENT_CODEHEADER)
- #error Recursive inclusion of TestHelperNormal code header.
-#endif
-#define TestHelperNormal_CURRENT_CODEHEADER
-
-#if ! defined (TestHelperNormal_CODEHEADER_INCLUDED)
-#define TestHelperNormal_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "test_settings.h"
-
-#include "TestAccuracy.h"
-#if defined (test_settings_SPEED_TEST_ENABLED)
- #include "TestSpeed.h"
-#endif
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class DT>
-void TestHelperNormal <DT>::perform_test_accuracy (int &ret_val)
-{
- const int len_arr [] = { 1, 2, 3, 4, 7, 8, 10, 12 };
- const int nbr_len = sizeof (len_arr) / sizeof (len_arr [0]);
- for (int k = 0; k < nbr_len && ret_val == 0; ++k)
- {
- const long len = 1L << (len_arr [k]);
- FftType fft (len);
- ret_val = TestAccuracy <FftType>::perform_test_single_object (fft);
- }
-}
-
-
-
-template <class DT>
-void TestHelperNormal <DT>::perform_test_speed (int &ret_val)
-{
-#if defined (test_settings_SPEED_TEST_ENABLED)
-
- const int len_arr [] = { 1, 2, 3, 4, 7, 8, 10, 12, 14, 16, 18, 20, 22 };
- const int nbr_len = sizeof (len_arr) / sizeof (len_arr [0]);
- for (int k = 0; k < nbr_len && ret_val == 0; ++k)
- {
- const long len = 1L << (len_arr [k]);
- FftType fft (len);
- ret_val = TestSpeed <FftType>::perform_test_single_object (fft);
- }
-
-#endif
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-#endif // TestHelperNormal_CODEHEADER_INCLUDED
-
-#undef TestHelperNormal_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/TestSpeed.h b/examples/spectrum/3rdparty/fftreal/TestSpeed.h
deleted file mode 100644
index 2295781..0000000
--- a/examples/spectrum/3rdparty/fftreal/TestSpeed.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*****************************************************************************
-
- TestSpeed.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (TestSpeed_HEADER_INCLUDED)
-#define TestSpeed_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class FO>
-class TestSpeed
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- typedef typename FO::DataType DataType;
-
- static int perform_test_single_object (FO &fft);
- static int perform_test_d (FO &fft, const char *class_name_0);
- static int perform_test_i (FO &fft, const char *class_name_0);
- static int perform_test_di (FO &fft, const char *class_name_0);
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- enum { NBR_SPD_TESTS = 10 * 1000 * 1000 };
- enum { MAX_NBR_TESTS = 10000 };
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- TestSpeed ();
- ~TestSpeed ();
- TestSpeed (const TestSpeed &other);
- TestSpeed & operator = (const TestSpeed &other);
- bool operator == (const TestSpeed &other);
- bool operator != (const TestSpeed &other);
-
-}; // class TestSpeed
-
-
-
-#include "TestSpeed.hpp"
-
-
-
-#endif // TestSpeed_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/TestSpeed.hpp b/examples/spectrum/3rdparty/fftreal/TestSpeed.hpp
deleted file mode 100644
index e716b2a..0000000
--- a/examples/spectrum/3rdparty/fftreal/TestSpeed.hpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/*****************************************************************************
-
- TestSpeed.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (TestSpeed_CURRENT_CODEHEADER)
- #error Recursive inclusion of TestSpeed code header.
-#endif
-#define TestSpeed_CURRENT_CODEHEADER
-
-#if ! defined (TestSpeed_CODEHEADER_INCLUDED)
-#define TestSpeed_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "test_fnc.h"
-#include "stopwatch/StopWatch.h"
-#include "TestWhiteNoiseGen.h"
-
-#include <typeinfo>
-
-#include <cstdio>
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class FO>
-int TestSpeed <FO>::perform_test_single_object (FO &fft)
-{
- assert (&fft != 0);
-
- int ret_val = 0;
-
- const std::type_info & ti = typeid (fft);
- const char * class_name_0 = ti.name ();
-
- if (ret_val == 0)
- {
- perform_test_d (fft, class_name_0);
- }
- if (ret_val == 0)
- {
- perform_test_i (fft, class_name_0);
- }
- if (ret_val == 0)
- {
- perform_test_di (fft, class_name_0);
- }
-
- if (ret_val == 0)
- {
- printf ("\n");
- }
-
- return (ret_val);
-}
-
-
-
-template <class FO>
-int TestSpeed <FO>::perform_test_d (FO &fft, const char *class_name_0)
-{
- assert (&fft != 0);
- assert (class_name_0 != 0);
-
- const long len = fft.get_length ();
- const long nbr_tests = limit (
- static_cast <long> (NBR_SPD_TESTS / len / len),
- 1L,
- static_cast <long> (MAX_NBR_TESTS)
- );
-
- TestWhiteNoiseGen <DataType> noise;
- std::vector <DataType> x (len, 0);
- std::vector <DataType> s (len);
- noise.generate (&x [0], len);
-
- printf (
- "%s::do_fft () speed test [%ld samples]... ",
- class_name_0,
- len
- );
- fflush (stdout);
-
- stopwatch::StopWatch chrono;
- chrono.start ();
- for (long test = 0; test < nbr_tests; ++ test)
- {
- fft.do_fft (&s [0], &x [0]);
- chrono.stop_lap ();
- }
-
- printf ("%.1f clocks/sample\n", chrono.get_time_best_lap (len));
-
- return (0);
-}
-
-
-
-template <class FO>
-int TestSpeed <FO>::perform_test_i (FO &fft, const char *class_name_0)
-{
- assert (&fft != 0);
- assert (class_name_0 != 0);
-
- const long len = fft.get_length ();
- const long nbr_tests = limit (
- static_cast <long> (NBR_SPD_TESTS / len / len),
- 1L,
- static_cast <long> (MAX_NBR_TESTS)
- );
-
- TestWhiteNoiseGen <DataType> noise;
- std::vector <DataType> x (len);
- std::vector <DataType> s (len, 0);
- noise.generate (&s [0], len);
-
- printf (
- "%s::do_ifft () speed test [%ld samples]... ",
- class_name_0,
- len
- );
- fflush (stdout);
-
- stopwatch::StopWatch chrono;
- chrono.start ();
- for (long test = 0; test < nbr_tests; ++ test)
- {
- fft.do_ifft (&s [0], &x [0]);
- chrono.stop_lap ();
- }
-
- printf ("%.1f clocks/sample\n", chrono.get_time_best_lap (len));
-
- return (0);
-}
-
-
-
-template <class FO>
-int TestSpeed <FO>::perform_test_di (FO &fft, const char *class_name_0)
-{
- assert (&fft != 0);
- assert (class_name_0 != 0);
-
- const long len = fft.get_length ();
- const long nbr_tests = limit (
- static_cast <long> (NBR_SPD_TESTS / len / len),
- 1L,
- static_cast <long> (MAX_NBR_TESTS)
- );
-
- TestWhiteNoiseGen <DataType> noise;
- std::vector <DataType> x (len, 0);
- std::vector <DataType> s (len);
- std::vector <DataType> y (len);
- noise.generate (&x [0], len);
-
- printf (
- "%s::do_fft () / do_ifft () / rescale () speed test [%ld samples]... ",
- class_name_0,
- len
- );
- fflush (stdout);
-
- stopwatch::StopWatch chrono;
-
- chrono.start ();
- for (long test = 0; test < nbr_tests; ++ test)
- {
- fft.do_fft (&s [0], &x [0]);
- fft.do_ifft (&s [0], &y [0]);
- fft.rescale (&y [0]);
- chrono.stop_lap ();
- }
-
- printf ("%.1f clocks/sample\n", chrono.get_time_best_lap (len));
-
- return (0);
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-#endif // TestSpeed_CODEHEADER_INCLUDED
-
-#undef TestSpeed_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/TestWhiteNoiseGen.h b/examples/spectrum/3rdparty/fftreal/TestWhiteNoiseGen.h
deleted file mode 100644
index d815f8e..0000000
--- a/examples/spectrum/3rdparty/fftreal/TestWhiteNoiseGen.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*****************************************************************************
-
- TestWhiteNoiseGen.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (TestWhiteNoiseGen_HEADER_INCLUDED)
-#define TestWhiteNoiseGen_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class DT>
-class TestWhiteNoiseGen
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- typedef DT DataType;
-
- TestWhiteNoiseGen ();
- virtual ~TestWhiteNoiseGen () {}
-
- void generate (DataType data_ptr [], long len);
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- typedef unsigned long StateType;
-
- StateType _rand_state;
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- TestWhiteNoiseGen (const TestWhiteNoiseGen &other);
- TestWhiteNoiseGen &
- operator = (const TestWhiteNoiseGen &other);
- bool operator == (const TestWhiteNoiseGen &other);
- bool operator != (const TestWhiteNoiseGen &other);
-
-}; // class TestWhiteNoiseGen
-
-
-
-#include "TestWhiteNoiseGen.hpp"
-
-
-
-#endif // TestWhiteNoiseGen_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/TestWhiteNoiseGen.hpp b/examples/spectrum/3rdparty/fftreal/TestWhiteNoiseGen.hpp
deleted file mode 100644
index 13b7eb3..0000000
--- a/examples/spectrum/3rdparty/fftreal/TestWhiteNoiseGen.hpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*****************************************************************************
-
- TestWhiteNoiseGen.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (TestWhiteNoiseGen_CURRENT_CODEHEADER)
- #error Recursive inclusion of TestWhiteNoiseGen code header.
-#endif
-#define TestWhiteNoiseGen_CURRENT_CODEHEADER
-
-#if ! defined (TestWhiteNoiseGen_CODEHEADER_INCLUDED)
-#define TestWhiteNoiseGen_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class DT>
-TestWhiteNoiseGen <DT>::TestWhiteNoiseGen ()
-: _rand_state (0)
-{
- _rand_state = reinterpret_cast <StateType> (this);
-}
-
-
-
-template <class DT>
-void TestWhiteNoiseGen <DT>::generate (DataType data_ptr [], long len)
-{
- assert (data_ptr != 0);
- assert (len > 0);
-
- const DataType one = static_cast <DataType> (1);
- const DataType mul = one / static_cast <DataType> (0x80000000UL);
-
- long pos = 0;
- do
- {
- const DataType x = static_cast <DataType> (_rand_state & 0xFFFFFFFFUL);
- data_ptr [pos] = x * mul - one;
-
- _rand_state = _rand_state * 1234567UL + 890123UL;
-
- ++ pos;
- }
- while (pos < len);
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-#endif // TestWhiteNoiseGen_CODEHEADER_INCLUDED
-
-#undef TestWhiteNoiseGen_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/bwins/fftrealu.def b/examples/spectrum/3rdparty/fftreal/bwins/fftrealu.def
deleted file mode 100644
index 7a79397..0000000
--- a/examples/spectrum/3rdparty/fftreal/bwins/fftrealu.def
+++ /dev/null
@@ -1,5 +0,0 @@
-EXPORTS
- ??0FFTRealWrapper@@QAE@XZ @ 1 NONAME ; FFTRealWrapper::FFTRealWrapper(void)
- ??1FFTRealWrapper@@QAE@XZ @ 2 NONAME ; FFTRealWrapper::~FFTRealWrapper(void)
- ?calculateFFT@FFTRealWrapper@@QAEXQAMQBM@Z @ 3 NONAME ; void FFTRealWrapper::calculateFFT(float * const, float const * const)
-
diff --git a/examples/spectrum/3rdparty/fftreal/def.h b/examples/spectrum/3rdparty/fftreal/def.h
deleted file mode 100644
index 99c545f..0000000
--- a/examples/spectrum/3rdparty/fftreal/def.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*****************************************************************************
-
- def.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (def_HEADER_INCLUDED)
-#define def_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-
-const double PI = 3.1415926535897932384626433832795;
-const double SQRT2 = 1.41421356237309514547462185873883;
-
-#if defined (_MSC_VER)
-
- #define FORCEINLINE __forceinline
-
-#else
-
- #define FORCEINLINE inline
-
-#endif
-
-
-
-#endif // def_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/eabi/fftrealu.def b/examples/spectrum/3rdparty/fftreal/eabi/fftrealu.def
deleted file mode 100644
index f95a441..0000000
--- a/examples/spectrum/3rdparty/fftreal/eabi/fftrealu.def
+++ /dev/null
@@ -1,7 +0,0 @@
-EXPORTS
- _ZN14FFTRealWrapper12calculateFFTEPfPKf @ 1 NONAME
- _ZN14FFTRealWrapperC1Ev @ 2 NONAME
- _ZN14FFTRealWrapperC2Ev @ 3 NONAME
- _ZN14FFTRealWrapperD1Ev @ 4 NONAME
- _ZN14FFTRealWrapperD2Ev @ 5 NONAME
-
diff --git a/examples/spectrum/3rdparty/fftreal/fftreal.pas b/examples/spectrum/3rdparty/fftreal/fftreal.pas
deleted file mode 100644
index ea63754..0000000
--- a/examples/spectrum/3rdparty/fftreal/fftreal.pas
+++ /dev/null
@@ -1,661 +0,0 @@
-(*****************************************************************************
-
- DIGITAL SIGNAL PROCESSING TOOLS
- Version 1.03, 2001/06/15
- (c) 1999 - Laurent de Soras
-
- FFTReal.h
- Fourier transformation of real number arrays.
- Portable ISO C++
-
-------------------------------------------------------------------------------
-
- LEGAL
-
- Source code may be freely used for any purpose, including commercial
- applications. Programs must display in their "About" dialog-box (or
- documentation) a text telling they use these routines by Laurent de Soras.
- Modified source code can be distributed, but modifications must be clearly
- indicated.
-
- CONTACT
-
- Laurent de Soras
- 92 avenue Albert 1er
- 92500 Rueil-Malmaison
- France
-
- ldesoras@club-internet.fr
-
-------------------------------------------------------------------------------
-
- Translation to ObjectPascal by :
- Frederic Vanmol
- frederic@axiworld.be
-
-*****************************************************************************)
-
-
-unit
- FFTReal;
-
-interface
-
-uses
- Windows;
-
-(* Change this typedef to use a different floating point type in your FFTs
- (i.e. float, double or long double). *)
-type
- pflt_t = ^flt_t;
- flt_t = single;
-
- pflt_array = ^flt_array;
- flt_array = array[0..0] of flt_t;
-
- plongarray = ^longarray;
- longarray = array[0..0] of longint;
-
-const
- sizeof_flt : longint = SizeOf(flt_t);
-
-
-
-type
- // Bit reversed look-up table nested class
- TBitReversedLUT = class
- private
- _ptr : plongint;
- public
- constructor Create(const nbr_bits: integer);
- destructor Destroy; override;
- function get_ptr: plongint;
- end;
-
- // Trigonometric look-up table nested class
- TTrigoLUT = class
- private
- _ptr : pflt_t;
- public
- constructor Create(const nbr_bits: integer);
- destructor Destroy; override;
- function get_ptr(const level: integer): pflt_t;
- end;
-
- TFFTReal = class
- private
- _bit_rev_lut : TBitReversedLUT;
- _trigo_lut : TTrigoLUT;
- _sqrt2_2 : flt_t;
- _length : longint;
- _nbr_bits : integer;
- _buffer_ptr : pflt_t;
- public
- constructor Create(const length: longint);
- destructor Destroy; override;
-
- procedure do_fft(f: pflt_array; const x: pflt_array);
- procedure do_ifft(const f: pflt_array; x: pflt_array);
- procedure rescale(x: pflt_array);
- end;
-
-
-
-
-
-
-
-implementation
-
-uses
- Math;
-
-{ TBitReversedLUT }
-
-constructor TBitReversedLUT.Create(const nbr_bits: integer);
-var
- length : longint;
- cnt : longint;
- br_index : longint;
- bit : longint;
-begin
- inherited Create;
-
- length := 1 shl nbr_bits;
- GetMem(_ptr, length*SizeOf(longint));
-
- br_index := 0;
- plongarray(_ptr)^[0] := 0;
- for cnt := 1 to length-1 do
- begin
- // ++br_index (bit reversed)
- bit := length shr 1;
- br_index := br_index xor bit;
- while br_index and bit = 0 do
- begin
- bit := bit shr 1;
- br_index := br_index xor bit;
- end;
-
- plongarray(_ptr)^[cnt] := br_index;
- end;
-end;
-
-destructor TBitReversedLUT.Destroy;
-begin
- FreeMem(_ptr);
- _ptr := nil;
- inherited;
-end;
-
-function TBitReversedLUT.get_ptr: plongint;
-begin
- Result := _ptr;
-end;
-
-{ TTrigLUT }
-
-constructor TTrigoLUT.Create(const nbr_bits: integer);
-var
- total_len : longint;
- PI : double;
- level : integer;
- level_len : longint;
- level_ptr : pflt_array;
- mul : double;
- i : longint;
-begin
- inherited Create;
-
- _ptr := nil;
-
- if (nbr_bits > 3) then
- begin
- total_len := (1 shl (nbr_bits - 1)) - 4;
- GetMem(_ptr, total_len * sizeof_flt);
-
- PI := ArcTan(1) * 4;
- for level := 3 to nbr_bits-1 do
- begin
- level_len := 1 shl (level - 1);
- level_ptr := pointer(get_ptr(level));
- mul := PI / (level_len shl 1);
-
- for i := 0 to level_len-1 do
- level_ptr^[i] := cos(i * mul);
- end;
- end;
-end;
-
-destructor TTrigoLUT.Destroy;
-begin
- FreeMem(_ptr);
- _ptr := nil;
- inherited;
-end;
-
-function TTrigoLUT.get_ptr(const level: integer): pflt_t;
-var
- tempp : pflt_t;
-begin
- tempp := _ptr;
- inc(tempp, (1 shl (level-1)) - 4);
- Result := tempp;
-end;
-
-{ TFFTReal }
-
-constructor TFFTReal.Create(const length: longint);
-begin
- inherited Create;
-
- _length := length;
- _nbr_bits := Floor(Ln(length) / Ln(2) + 0.5);
- _bit_rev_lut := TBitReversedLUT.Create(Floor(Ln(length) / Ln(2) + 0.5));
- _trigo_lut := TTrigoLUT.Create(Floor(Ln(length) / Ln(2) + 0.05));
- _sqrt2_2 := Sqrt(2) * 0.5;
-
- _buffer_ptr := nil;
- if _nbr_bits > 2 then
- GetMem(_buffer_ptr, _length * sizeof_flt);
-end;
-
-destructor TFFTReal.Destroy;
-begin
- if _buffer_ptr <> nil then
- begin
- FreeMem(_buffer_ptr);
- _buffer_ptr := nil;
- end;
-
- _bit_rev_lut.Free;
- _bit_rev_lut := nil;
- _trigo_lut.Free;
- _trigo_lut := nil;
-
- inherited;
-end;
-
-(*==========================================================================*/
-/* Name: do_fft */
-/* Description: Compute the FFT of the array. */
-/* Input parameters: */
-/* - x: pointer on the source array (time). */
-/* Output parameters: */
-/* - f: pointer on the destination array (frequencies). */
-/* f [0...length(x)/2] = real values, */
-/* f [length(x)/2+1...length(x)-1] = imaginary values of */
-/* coefficents 1...length(x)/2-1. */
-/*==========================================================================*)
-procedure TFFTReal.do_fft(f: pflt_array; const x: pflt_array);
-var
- sf, df : pflt_array;
- pass : integer;
- nbr_coef : longint;
- h_nbr_coef : longint;
- d_nbr_coef : longint;
- coef_index : longint;
- bit_rev_lut_ptr : plongarray;
- rev_index_0 : longint;
- rev_index_1 : longint;
- rev_index_2 : longint;
- rev_index_3 : longint;
- df2 : pflt_array;
- n1, n2, n3 : integer;
- sf_0, sf_2 : flt_t;
- sqrt2_2 : flt_t;
- v : flt_t;
- cos_ptr : pflt_array;
- i : longint;
- sf1r, sf2r : pflt_array;
- dfr, dfi : pflt_array;
- sf1i, sf2i : pflt_array;
- c, s : flt_t;
- temp_ptr : pflt_array;
- b_0, b_2 : flt_t;
-begin
- n1 := 1;
- n2 := 2;
- n3 := 3;
-
- (*______________________________________________
- *
- * General case
- *______________________________________________
- *)
-
- if _nbr_bits > 2 then
- begin
- if _nbr_bits and 1 <> 0 then
- begin
- df := pointer(_buffer_ptr);
- sf := f;
- end
- else
- begin
- df := f;
- sf := pointer(_buffer_ptr);
- end;
-
- //
- // Do the transformation in several passes
- //
-
- // First and second pass at once
- bit_rev_lut_ptr := pointer(_bit_rev_lut.get_ptr);
- coef_index := 0;
-
- repeat
- rev_index_0 := bit_rev_lut_ptr^[coef_index];
- rev_index_1 := bit_rev_lut_ptr^[coef_index + 1];
- rev_index_2 := bit_rev_lut_ptr^[coef_index + 2];
- rev_index_3 := bit_rev_lut_ptr^[coef_index + 3];
-
- df2 := pointer(longint(df) + (coef_index*sizeof_flt));
- df2^[n1] := x^[rev_index_0] - x^[rev_index_1];
- df2^[n3] := x^[rev_index_2] - x^[rev_index_3];
-
- sf_0 := x^[rev_index_0] + x^[rev_index_1];
- sf_2 := x^[rev_index_2] + x^[rev_index_3];
-
- df2^[0] := sf_0 + sf_2;
- df2^[n2] := sf_0 - sf_2;
-
- inc(coef_index, 4);
- until (coef_index >= _length);
-
-
- // Third pass
- coef_index := 0;
- sqrt2_2 := _sqrt2_2;
-
- repeat
- sf^[coef_index] := df^[coef_index] + df^[coef_index + 4];
- sf^[coef_index + 4] := df^[coef_index] - df^[coef_index + 4];
- sf^[coef_index + 2] := df^[coef_index + 2];
- sf^[coef_index + 6] := df^[coef_index + 6];
-
- v := (df [coef_index + 5] - df^[coef_index + 7]) * sqrt2_2;
- sf^[coef_index + 1] := df^[coef_index + 1] + v;
- sf^[coef_index + 3] := df^[coef_index + 1] - v;
-
- v := (df^[coef_index + 5] + df^[coef_index + 7]) * sqrt2_2;
- sf [coef_index + 5] := v + df^[coef_index + 3];
- sf [coef_index + 7] := v - df^[coef_index + 3];
-
- inc(coef_index, 8);
- until (coef_index >= _length);
-
-
- // Next pass
- for pass := 3 to _nbr_bits-1 do
- begin
- coef_index := 0;
- nbr_coef := 1 shl pass;
- h_nbr_coef := nbr_coef shr 1;
- d_nbr_coef := nbr_coef shl 1;
-
- cos_ptr := pointer(_trigo_lut.get_ptr(pass));
- repeat
- sf1r := pointer(longint(sf) + (coef_index * sizeof_flt));
- sf2r := pointer(longint(sf1r) + (nbr_coef * sizeof_flt));
- dfr := pointer(longint(df) + (coef_index * sizeof_flt));
- dfi := pointer(longint(dfr) + (nbr_coef * sizeof_flt));
-
- // Extreme coefficients are always real
- dfr^[0] := sf1r^[0] + sf2r^[0];
- dfi^[0] := sf1r^[0] - sf2r^[0]; // dfr [nbr_coef] =
- dfr^[h_nbr_coef] := sf1r^[h_nbr_coef];
- dfi^[h_nbr_coef] := sf2r^[h_nbr_coef];
-
- // Others are conjugate complex numbers
- sf1i := pointer(longint(sf1r) + (h_nbr_coef * sizeof_flt));
- sf2i := pointer(longint(sf1i) + (nbr_coef * sizeof_flt));
-
- for i := 1 to h_nbr_coef-1 do
- begin
- c := cos_ptr^[i]; // cos (i*PI/nbr_coef);
- s := cos_ptr^[h_nbr_coef - i]; // sin (i*PI/nbr_coef);
-
- v := sf2r^[i] * c - sf2i^[i] * s;
- dfr^[i] := sf1r^[i] + v;
- dfi^[-i] := sf1r^[i] - v; // dfr [nbr_coef - i] =
-
- v := sf2r^[i] * s + sf2i^[i] * c;
- dfi^[i] := v + sf1i^[i];
- dfi^[nbr_coef - i] := v - sf1i^[i];
- end;
-
- inc(coef_index, d_nbr_coef);
- until (coef_index >= _length);
-
- // Prepare to the next pass
- temp_ptr := df;
- df := sf;
- sf := temp_ptr;
- end;
- end
-
- (*______________________________________________
- *
- * Special cases
- *______________________________________________
- *)
-
- // 4-point FFT
- else if _nbr_bits = 2 then
- begin
- f^[n1] := x^[0] - x^[n2];
- f^[n3] := x^[n1] - x^[n3];
-
- b_0 := x^[0] + x^[n2];
- b_2 := x^[n1] + x^[n3];
-
- f^[0] := b_0 + b_2;
- f^[n2] := b_0 - b_2;
- end
-
- // 2-point FFT
- else if _nbr_bits = 1 then
- begin
- f^[0] := x^[0] + x^[n1];
- f^[n1] := x^[0] - x^[n1];
- end
-
- // 1-point FFT
- else
- f^[0] := x^[0];
-end;
-
-
-(*==========================================================================*/
-/* Name: do_ifft */
-/* Description: Compute the inverse FFT of the array. Notice that */
-/* IFFT (FFT (x)) = x * length (x). Data must be */
-/* post-scaled. */
-/* Input parameters: */
-/* - f: pointer on the source array (frequencies). */
-/* f [0...length(x)/2] = real values, */
-/* f [length(x)/2+1...length(x)-1] = imaginary values of */
-/* coefficents 1...length(x)/2-1. */
-/* Output parameters: */
-/* - x: pointer on the destination array (time). */
-/*==========================================================================*)
-procedure TFFTReal.do_ifft(const f: pflt_array; x: pflt_array);
-var
- n1, n2, n3 : integer;
- n4, n5, n6, n7 : integer;
- sf, df, df_temp : pflt_array;
- pass : integer;
- nbr_coef : longint;
- h_nbr_coef : longint;
- d_nbr_coef : longint;
- coef_index : longint;
- cos_ptr : pflt_array;
- i : longint;
- sfr, sfi : pflt_array;
- df1r, df2r : pflt_array;
- df1i, df2i : pflt_array;
- c, s, vr, vi : flt_t;
- temp_ptr : pflt_array;
- sqrt2_2 : flt_t;
- bit_rev_lut_ptr : plongarray;
- sf2 : pflt_array;
- b_0, b_1, b_2, b_3 : flt_t;
-begin
- n1 := 1;
- n2 := 2;
- n3 := 3;
- n4 := 4;
- n5 := 5;
- n6 := 6;
- n7 := 7;
-
- (*______________________________________________
- *
- * General case
- *______________________________________________
- *)
-
- if _nbr_bits > 2 then
- begin
- sf := f;
-
- if _nbr_bits and 1 <> 0 then
- begin
- df := pointer(_buffer_ptr);
- df_temp := x;
- end
- else
- begin
- df := x;
- df_temp := pointer(_buffer_ptr);
- end;
-
- // Do the transformation in several pass
-
- // First pass
- for pass := _nbr_bits-1 downto 3 do
- begin
- coef_index := 0;
- nbr_coef := 1 shl pass;
- h_nbr_coef := nbr_coef shr 1;
- d_nbr_coef := nbr_coef shl 1;
-
- cos_ptr := pointer(_trigo_lut.get_ptr(pass));
-
- repeat
- sfr := pointer(longint(sf) + (coef_index*sizeof_flt));
- sfi := pointer(longint(sfr) + (nbr_coef*sizeof_flt));
- df1r := pointer(longint(df) + (coef_index*sizeof_flt));
- df2r := pointer(longint(df1r) + (nbr_coef*sizeof_flt));
-
- // Extreme coefficients are always real
- df1r^[0] := sfr^[0] + sfi^[0]; // + sfr [nbr_coef]
- df2r^[0] := sfr^[0] - sfi^[0]; // - sfr [nbr_coef]
- df1r^[h_nbr_coef] := sfr^[h_nbr_coef] * 2;
- df2r^[h_nbr_coef] := sfi^[h_nbr_coef] * 2;
-
- // Others are conjugate complex numbers
- df1i := pointer(longint(df1r) + (h_nbr_coef*sizeof_flt));
- df2i := pointer(longint(df1i) + (nbr_coef*sizeof_flt));
-
- for i := 1 to h_nbr_coef-1 do
- begin
- df1r^[i] := sfr^[i] + sfi^[-i]; // + sfr [nbr_coef - i]
- df1i^[i] := sfi^[i] - sfi^[nbr_coef - i];
-
- c := cos_ptr^[i]; // cos (i*PI/nbr_coef);
- s := cos_ptr^[h_nbr_coef - i]; // sin (i*PI/nbr_coef);
- vr := sfr^[i] - sfi^[-i]; // - sfr [nbr_coef - i]
- vi := sfi^[i] + sfi^[nbr_coef - i];
-
- df2r^[i] := vr * c + vi * s;
- df2i^[i] := vi * c - vr * s;
- end;
-
- inc(coef_index, d_nbr_coef);
- until (coef_index >= _length);
-
-
- // Prepare to the next pass
- if (pass < _nbr_bits - 1) then
- begin
- temp_ptr := df;
- df := sf;
- sf := temp_ptr;
- end
- else
- begin
- sf := df;
- df := df_temp;
- end
- end;
-
- // Antepenultimate pass
- sqrt2_2 := _sqrt2_2;
- coef_index := 0;
-
- repeat
- df^[coef_index] := sf^[coef_index] + sf^[coef_index + 4];
- df^[coef_index + 4] := sf^[coef_index] - sf^[coef_index + 4];
- df^[coef_index + 2] := sf^[coef_index + 2] * 2;
- df^[coef_index + 6] := sf^[coef_index + 6] * 2;
-
- df^[coef_index + 1] := sf^[coef_index + 1] + sf^[coef_index + 3];
- df^[coef_index + 3] := sf^[coef_index + 5] - sf^[coef_index + 7];
-
- vr := sf^[coef_index + 1] - sf^[coef_index + 3];
- vi := sf^[coef_index + 5] + sf^[coef_index + 7];
-
- df^[coef_index + 5] := (vr + vi) * sqrt2_2;
- df^[coef_index + 7] := (vi - vr) * sqrt2_2;
-
- inc(coef_index, 8);
- until (coef_index >= _length);
-
-
- // Penultimate and last pass at once
- coef_index := 0;
- bit_rev_lut_ptr := pointer(_bit_rev_lut.get_ptr);
- sf2 := df;
-
- repeat
- b_0 := sf2^[0] + sf2^[n2];
- b_2 := sf2^[0] - sf2^[n2];
- b_1 := sf2^[n1] * 2;
- b_3 := sf2^[n3] * 2;
-
- x^[bit_rev_lut_ptr^[0]] := b_0 + b_1;
- x^[bit_rev_lut_ptr^[n1]] := b_0 - b_1;
- x^[bit_rev_lut_ptr^[n2]] := b_2 + b_3;
- x^[bit_rev_lut_ptr^[n3]] := b_2 - b_3;
-
- b_0 := sf2^[n4] + sf2^[n6];
- b_2 := sf2^[n4] - sf2^[n6];
- b_1 := sf2^[n5] * 2;
- b_3 := sf2^[n7] * 2;
-
- x^[bit_rev_lut_ptr^[n4]] := b_0 + b_1;
- x^[bit_rev_lut_ptr^[n5]] := b_0 - b_1;
- x^[bit_rev_lut_ptr^[n6]] := b_2 + b_3;
- x^[bit_rev_lut_ptr^[n7]] := b_2 - b_3;
-
- inc(sf2, 8);
- inc(coef_index, 8);
- inc(bit_rev_lut_ptr, 8);
- until (coef_index >= _length);
- end
-
- (*______________________________________________
- *
- * Special cases
- *______________________________________________
- *)
-
- // 4-point IFFT
- else if _nbr_bits = 2 then
- begin
- b_0 := f^[0] + f [n2];
- b_2 := f^[0] - f [n2];
-
- x^[0] := b_0 + f [n1] * 2;
- x^[n2] := b_0 - f [n1] * 2;
- x^[n1] := b_2 + f [n3] * 2;
- x^[n3] := b_2 - f [n3] * 2;
- end
-
- // 2-point IFFT
- else if _nbr_bits = 1 then
- begin
- x^[0] := f^[0] + f^[n1];
- x^[n1] := f^[0] - f^[n1];
- end
-
- // 1-point IFFT
- else
- x^[0] := f^[0];
-end;
-
-(*==========================================================================*/
-/* Name: rescale */
-/* Description: Scale an array by divide each element by its length. */
-/* This function should be called after FFT + IFFT. */
-/* Input/Output parameters: */
-/* - x: pointer on array to rescale (time or frequency). */
-/*==========================================================================*)
-procedure TFFTReal.rescale(x: pflt_array);
-var
- mul : flt_t;
- i : longint;
-begin
- mul := 1.0 / _length;
- i := _length - 1;
-
- repeat
- x^[i] := x^[i] * mul;
- dec(i);
- until (i < 0);
-end;
-
-end.
diff --git a/examples/spectrum/3rdparty/fftreal/fftreal.pro b/examples/spectrum/3rdparty/fftreal/fftreal.pro
deleted file mode 100644
index 19019b1..0000000
--- a/examples/spectrum/3rdparty/fftreal/fftreal.pro
+++ /dev/null
@@ -1,46 +0,0 @@
-include(../../spectrum.pri)
-
-static: error(This library cannot be built for static linkage)
-
-TEMPLATE = lib
-TARGET = fftreal
-
-# FFTReal
-HEADERS += Array.h \
- Array.hpp \
- DynArray.h \
- DynArray.hpp \
- FFTRealFixLen.h \
- FFTRealFixLen.hpp \
- FFTRealFixLenParam.h \
- FFTRealPassDirect.h \
- FFTRealPassDirect.hpp \
- FFTRealPassInverse.h \
- FFTRealPassInverse.hpp \
- FFTRealSelect.h \
- FFTRealSelect.hpp \
- FFTRealUseTrigo.h \
- FFTRealUseTrigo.hpp \
- OscSinCos.h \
- OscSinCos.hpp \
- def.h
-
-# Wrapper used to export the required instantiation of the FFTRealFixLen template
-HEADERS += fftreal_wrapper.h
-SOURCES += fftreal_wrapper.cpp
-
-DEFINES += FFTREAL_LIBRARY
-
-macx {
- CONFIG += lib_bundle
-} else {
- DESTDIR = ../..$${spectrum_build_dir}
-}
-
-# Install
-
-sources.files = $$SOURCES $$HEADERS fftreal.pro readme.txt license.txt
-sources.files += bwins/fftreal.def eabi/fftreal.def
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/spectrum/3rdparty/fftreal
-INSTALLS += sources
-
diff --git a/examples/spectrum/3rdparty/fftreal/fftreal_wrapper.cpp b/examples/spectrum/3rdparty/fftreal/fftreal_wrapper.cpp
deleted file mode 100644
index 2e66bc0..0000000
--- a/examples/spectrum/3rdparty/fftreal/fftreal_wrapper.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU Lesser General Public License as
-** published by the Free Software Foundation, either version 2.1. This
-** program is distributed in the hope that it will be useful, but WITHOUT
-** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-** for more details. You should have received a copy of the GNU General
-** Public License along with this program. If not, see
-** <http://www.gnu.org/licenses/>.
-**
-***************************************************************************/
-
-#include "fftreal_wrapper.h"
-
-// FFTReal code generates quite a lot of 'unused parameter' compiler warnings,
-// which we suppress here in order to get a clean build output.
-#if defined Q_CC_MSVC
-# pragma warning(disable:4100)
-#elif defined Q_CC_GNU
-# pragma GCC diagnostic ignored "-Wunused-parameter"
-#elif defined Q_CC_MWERKS
-# pragma warning off (10182)
-#endif
-
-#include "FFTRealFixLen.h"
-
-class FFTRealWrapperPrivate {
-public:
- FFTRealFixLen<FFTLengthPowerOfTwo> m_fft;
-};
-
-
-FFTRealWrapper::FFTRealWrapper()
- : m_private(new FFTRealWrapperPrivate)
-{
-
-}
-
-FFTRealWrapper::~FFTRealWrapper()
-{
- delete m_private;
-}
-
-void FFTRealWrapper::calculateFFT(DataType in[], const DataType out[])
-{
- m_private->m_fft.do_fft(in, out);
-}
diff --git a/examples/spectrum/3rdparty/fftreal/fftreal_wrapper.h b/examples/spectrum/3rdparty/fftreal/fftreal_wrapper.h
deleted file mode 100644
index 39a1d57..0000000
--- a/examples/spectrum/3rdparty/fftreal/fftreal_wrapper.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU Lesser General Public License as
-** published by the Free Software Foundation, either version 2.1. This
-** program is distributed in the hope that it will be useful, but WITHOUT
-** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-** for more details. You should have received a copy of the GNU General
-** Public License along with this program. If not, see
-** <http://www.gnu.org/licenses/>.
-**
-***************************************************************************/
-
-#ifndef FFTREAL_WRAPPER_H
-#define FFTREAL_WRAPPER_H
-
-#include <QtCore/QtGlobal>
-
-#if defined(FFTREAL_LIBRARY)
-# define FFTREAL_EXPORT Q_DECL_EXPORT
-#else
-# define FFTREAL_EXPORT Q_DECL_IMPORT
-#endif
-
-class FFTRealWrapperPrivate;
-
-// Each pass of the FFT processes 2^X samples, where X is the
-// number below.
-static const int FFTLengthPowerOfTwo = 12;
-
-/**
- * Wrapper around the FFTRealFixLen template provided by the FFTReal
- * library
- *
- * This class instantiates a single instance of FFTRealFixLen, using
- * FFTLengthPowerOfTwo as the template parameter. It then exposes
- * FFTRealFixLen<FFTLengthPowerOfTwo>::do_fft via the calculateFFT
- * function, thereby allowing an application to dynamically link
- * against the FFTReal implementation.
- *
- * See http://ldesoras.free.fr/prod.html
- */
-class FFTREAL_EXPORT FFTRealWrapper
-{
-public:
- FFTRealWrapper();
- ~FFTRealWrapper();
-
- typedef float DataType;
- void calculateFFT(DataType in[], const DataType out[]);
-
-private:
- FFTRealWrapperPrivate* m_private;
-};
-
-#endif // FFTREAL_WRAPPER_H
-
diff --git a/examples/spectrum/3rdparty/fftreal/license.txt b/examples/spectrum/3rdparty/fftreal/license.txt
deleted file mode 100644
index 918fe68..0000000
--- a/examples/spectrum/3rdparty/fftreal/license.txt
+++ /dev/null
@@ -1,459 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/examples/spectrum/3rdparty/fftreal/readme.txt b/examples/spectrum/3rdparty/fftreal/readme.txt
deleted file mode 100644
index 0c5ce16..0000000
--- a/examples/spectrum/3rdparty/fftreal/readme.txt
+++ /dev/null
@@ -1,242 +0,0 @@
-==============================================================================
-
- FFTReal
- Version 2.00, 2005/10/18
-
- Fourier transformation (FFT, IFFT) library specialised for real data
- Portable ISO C++
-
- (c) Laurent de Soras <laurent.de.soras@club-internet.fr>
- Object Pascal port (c) Frederic Vanmol <frederic@fruityloops.com>
-
-==============================================================================
-
-
-
-1. Legal
---------
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Check the file license.txt to get full information about the license.
-
-
-
-2. Content
-----------
-
-FFTReal is a library to compute Discrete Fourier Transforms (DFT) with the
-FFT algorithm (Fast Fourier Transform) on arrays of real numbers. It can
-also compute the inverse transform.
-
-You should find in this package a lot of files ; some of them are of interest:
-- readme.txt: you are reading it
-- FFTReal.h: FFT, length fixed at run-time
-- FFTRealFixLen.h: FFT, length fixed at compile-time
-- FFTReal.pas: Pascal implementation (working but not up-to-date)
-- stopwatch directory
-
-
-
-3. Using FFTReal
-----------------
-
-Important - if you were using older versions of FFTReal (up to 1.03), some
-things have changed. FFTReal is now a template. Therefore use FFTReal<float>
-or FFTReal<double> in your code depending on the application datatype. The
-flt_t typedef has been removed.
-
-You have two ways to use FFTReal. In the first way, the FFT has its length
-fixed at run-time, when the object is instanciated. It means that you have
-not to know the length when you write the code. This is the usual way of
-proceeding.
-
-
-3.1 FFTReal - Length fixed at run-time
---------------------------------------
-
-Just instanciate one time a FFTReal object. Specify the data type you want
-as template parameter (only floating point: float, double, long double or
-custom type). The constructor precompute a lot of things, so it may be a bit
-long. The parameter is the number of points used for the next FFTs. It must
-be a power of 2:
-
- #include "FFTReal.h"
- ...
- long len = 1024;
- ...
- FFTReal <float> fft_object (len); // 1024-point FFT object constructed.
-
-Then you can use this object to compute as many FFTs and IFFTs as you want.
-They will be computed very quickly because a lot of work has been done in the
-object construction.
-
- float x [1024];
- float f [1024];
-
- ...
- fft_object.do_fft (f, x); // x (real) --FFT---> f (complex)
- ...
- fft_object.do_ifft (f, x); // f (complex) --IFFT--> x (real)
- fft_object.rescale (x); // Post-scaling should be done after FFT+IFFT
- ...
-
-x [] and f [] are floating point number arrays. x [] is the real number
-sequence which we want to compute the FFT. f [] is the result, in the
-"frequency" domain. f has the same number of elements as x [], but f []
-elements are complex numbers. The routine uses some FFT properties to
-optimize memory and to reduce calculations: the transformaton of a real
-number sequence is a conjugate complex number sequence: F [k] = F [-k]*.
-
-
-3.2 FFTRealFixLen - Length fixed at compile-time
-------------------------------------------------
-
-This class is significantly faster than the previous one, giving a speed
-gain between 50 and 100 %. The template parameter is the base-2 logarithm of
-the FFT length. The datatype is float; it can be changed by modifying the
-DataType typedef in FFTRealFixLenParam.h. As FFTReal class, it supports
-only floating-point types or equivalent.
-
-To instanciate the object, just proceed as below:
-
- #include "FFTRealFixLen.h"
- ...
- FFTRealFixLen <10> fft_object; // 1024-point (2^10) FFT object constructed.
-
-Use is similar as the one of FFTReal.
-
-
-3.3 Data organisation
----------------------
-
-Mathematically speaking, the formulas below show what does FFTReal:
-
-do_fft() : f(k) = sum (p = 0, N-1, x(p) * exp (+j*2*pi*k*p/N))
-do_ifft(): x(k) = sum (p = 0, N-1, f(p) * exp (-j*2*pi*k*p/N))
-
-Where j is the square root of -1. The formulas differ only by the sign of
-the exponential. When the sign is positive, the transform is called positive.
-Common formulas for Fourier transform are negative for the direct tranform and
-positive for the inverse one.
-
-However in these formulas, f is an array of complex numbers and doesn't
-correspound exactly to the f[] array taken as function parameter. The
-following table shows how the f[] sequence is mapped onto the usable FFT
-coefficients (called bins):
-
- FFTReal output | Positive FFT equiv. | Negative FFT equiv.
- ---------------+-----------------------+-----------------------
- f [0] | Real (bin 0) | Real (bin 0)
- f [...] | Real (bin ...) | Real (bin ...)
- f [length/2] | Real (bin length/2) | Real (bin length/2)
- f [length/2+1] | Imag (bin 1) | -Imag (bin 1)
- f [...] | Imag (bin ...) | -Imag (bin ...)
- f [length-1] | Imag (bin length/2-1) | -Imag (bin length/2-1)
-
-And FFT bins are distributed in f [] as above:
-
- | | Positive FFT | Negative FFT
- Bin | Real part | imaginary part | imaginary part
- ------------+----------------+-----------------+---------------
- 0 | f [0] | 0 | 0
- 1 | f [1] | f [length/2+1] | -f [length/2+1]
- ... | f [...], | f [...] | -f [...]
- length/2-1 | f [length/2-1] | f [length-1] | -f [length-1]
- length/2 | f [length/2] | 0 | 0
- length/2+1 | f [length/2-1] | -f [length-1] | f [length-1]
- ... | f [...] | -f [...] | f [...]
- length-1 | f [1] | -f [length/2+1] | f [length/2+1]
-
-f [] coefficients have the same layout for FFT and IFFT functions. You may
-notice that scaling must be done if you want to retrieve x after FFT and IFFT.
-Actually, IFFT (FFT (x)) = x * length(x). This is a not a problem because
-most of the applications don't care about absolute values. Thus, the operation
-requires less calculation. If you want to use the FFT and IFFT to transform a
-signal, you have to apply post- (or pre-) processing yourself. Multiplying
-or dividing floating point numbers by a power of 2 doesn't generate extra
-computation noise.
-
-
-
-4. Compilation and testing
---------------------------
-
-Drop the following files into your project or makefile:
-
-Array.*
-def.h
-DynArray.*
-FFTReal*.cpp
-FFTReal*.h*
-OscSinCos.*
-
-Other files are for testing purpose only, do not include them if you just need
-to use the library ; they are not needed to use FFTReal in your own programs.
-
-FFTReal may be compiled in two versions: release and debug. Debug version
-has checks that could slow down the code. Define NDEBUG to set the Release
-mode. For example, the command line to compile the test bench on GCC would
-look like:
-
-Debug mode:
-g++ -Wall -o fftreal_debug.exe *.cpp stopwatch/*.cpp
-
-Release mode:
-g++ -Wall -o fftreal_release.exe -DNDEBUG -O3 *.cpp stopwatch/*.cpp
-
-It may be tricky to compile the test bench because the speed tests use the
-stopwatch sub-library, which is not that cross-platform. If you encounter
-any problem that you cannot easily fix while compiling it, edit the file
-test_settings.h and un-define the speed test macro. Remove the stopwatch
-directory from your source file list, too.
-
-If it's not done by default, you should activate the exception handling
-of your compiler to get the class memory-leak-safe. Thus, when a memory
-allocation fails (in the constructor), an exception is thrown and the entire
-object is safely destructed. It reduces the permanent error checking overhead
-in the client code. Also, the test bench requires Run-Time Type Information
-(RTTI) to be enabled in order to display the names of the tested classes -
-sometimes mangled, depending on the compiler.
-
-The test bench may take a long time to compile, especially in Release mode,
-because a lot of recursive templates are instanciated.
-
-
-
-5. History
-----------
-
-v2.00 (2005.10.18)
-- Turned FFTReal class into template (data type as parameter)
-- Added FFTRealFixLen
-- Trigonometric tables are size-limited in order to preserve cache memory;
-over a given size, sin/cos functions are computed on the fly.
-- Better test bench for accuracy and speed
-
-v1.03 (2001.06.15)
-- Thanks to Frederic Vanmol for the Pascal port (works with Delphi).
-- Documentation improvement
-
-v1.02 (2001.03.25)
-- sqrt() is now precomputed when the object FFTReal is constructed, resulting
-in speed impovement for small size FFT.
-
-v1.01 (2000)
-- Small modifications, I don't remember what.
-
-v1.00 (1999.08.14)
-- First version released
-
diff --git a/examples/spectrum/3rdparty/fftreal/stopwatch/ClockCycleCounter.cpp b/examples/spectrum/3rdparty/fftreal/stopwatch/ClockCycleCounter.cpp
deleted file mode 100644
index fe1d424..0000000
--- a/examples/spectrum/3rdparty/fftreal/stopwatch/ClockCycleCounter.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-/*****************************************************************************
-
- ClockCycleCounter.cpp
- Copyright (c) 2003 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (_MSC_VER)
- #pragma warning (1 : 4130) // "'operator' : logical operation on address of string constant"
- #pragma warning (1 : 4223) // "nonstandard extension used : non-lvalue array converted to pointer"
- #pragma warning (1 : 4705) // "statement has no effect"
- #pragma warning (1 : 4706) // "assignment within conditional expression"
- #pragma warning (4 : 4786) // "identifier was truncated to '255' characters in the debug information"
- #pragma warning (4 : 4800) // "forcing value to bool 'true' or 'false' (performance warning)"
- #pragma warning (4 : 4355) // "'this' : used in base member initializer list"
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "ClockCycleCounter.h"
-
-#include <cassert>
-
-
-
-namespace stopwatch
-{
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*
-==============================================================================
-Name: ctor
-Description:
- The first object constructed initialise global data. This first
- construction may be a bit slow.
-Throws: Nothing
-==============================================================================
-*/
-
-ClockCycleCounter::ClockCycleCounter ()
-: _start_time (0)
-, _state (0)
-, _best_score (-1)
-{
- if (! _init_flag)
- {
- // Should be executed in this order
- compute_clk_mul ();
- compute_measure_time_total ();
- compute_measure_time_lap ();
-
- // Restores object state
- _start_time = 0;
- _state = 0;
- _best_score = -1;
-
- _init_flag = true;
- }
-}
-
-
-
-/*
-==============================================================================
-Name: get_time_total
-Description:
- Gives the time elapsed between the latest stop_lap() and start() calls.
-Returns:
- The duration, in clock cycles.
-Throws: Nothing
-==============================================================================
-*/
-
-Int64 ClockCycleCounter::get_time_total () const
-{
- const Int64 duration = _state - _start_time;
- assert (duration >= 0);
-
- const Int64 t = max (
- duration - _measure_time_total,
- static_cast <Int64> (0)
- );
-
- return (t * _clk_mul);
-}
-
-
-
-/*
-==============================================================================
-Name: get_time_best_lap
-Description:
- Gives the smallest time between two consecutive stop_lap() or between
- the stop_lap() and start(). The value is reset by a call to start().
- Call this function only after a stop_lap().
- The time is amputed from the duration of the stop_lap() call itself.
-Returns:
- The smallest duration, in clock cycles.
-Throws: Nothing
-==============================================================================
-*/
-
-Int64 ClockCycleCounter::get_time_best_lap () const
-{
- assert (_best_score >= 0);
-
- const Int64 t1 = max (
- _best_score - _measure_time_lap,
- static_cast <Int64> (0)
- );
- const Int64 t = min (t1, get_time_total ());
-
- return (t * _clk_mul);
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-#if defined (__MACOS__)
-
-static inline double stopwatch_ClockCycleCounter_get_time_s ()
-{
- const Nanoseconds ns = AbsoluteToNanoseconds (UpTime ());
-
- return (ns.hi * 4294967296e-9 + ns.lo * 1e-9);
-}
-
-#endif // __MACOS__
-
-
-
-/*
-==============================================================================
-Name: compute_clk_mul
-Description:
- This function, only for PowerPC/MacOS computers, computes the multiplier
- required to deduce clock cycles from the internal counter.
-Throws: Nothing
-==============================================================================
-*/
-
-void ClockCycleCounter::compute_clk_mul ()
-{
- assert (! _init_flag);
-
-#if defined (__MACOS__)
-
- long clk_speed_mhz = CurrentProcessorSpeed ();
- const Int64 clk_speed =
- static_cast <Int64> (clk_speed_mhz) * (1000L*1000L);
-
- const double start_time_s = stopwatch_ClockCycleCounter_get_time_s ();
- start ();
-
- const double duration = 0.01; // Seconds
- while (stopwatch_ClockCycleCounter_get_time_s () - start_time_s < duration)
- {
- continue;
- }
-
- const double stop_time_s = stopwatch_ClockCycleCounter_get_time_s ();
- stop ();
-
- const double diff_time_s = stop_time_s - start_time_s;
- const double nbr_cycles = diff_time_s * static_cast <double> (clk_speed);
-
- const Int64 diff_time_c = _state - _start_time;
- const double clk_mul = nbr_cycles / static_cast <double> (diff_time_c);
-
- _clk_mul = round_int (clk_mul);
-
-#endif // __MACOS__
-}
-
-
-
-void ClockCycleCounter::compute_measure_time_total ()
-{
- start ();
- spend_time ();
-
- Int64 best_result = 0x7FFFFFFFL; // Should be enough
- long nbr_tests = 100;
- for (long cnt = 0; cnt < nbr_tests; ++cnt)
- {
- start ();
- stop_lap ();
- const Int64 duration = _state - _start_time;
- best_result = min (best_result, duration);
- }
-
- _measure_time_total = best_result;
-}
-
-
-
-/*
-==============================================================================
-Name: compute_measure_time_lap
-Description:
- Computes the duration of one stop_lap() call and store it. It will be used
- later to get the real duration of the measured operation (by substracting
- the measurement duration).
-Throws: Nothing
-==============================================================================
-*/
-
-void ClockCycleCounter::compute_measure_time_lap ()
-{
- start ();
- spend_time ();
-
- long nbr_tests = 10;
- for (long cnt = 0; cnt < nbr_tests; ++cnt)
- {
- stop_lap ();
- stop_lap ();
- stop_lap ();
- stop_lap ();
- }
-
- _measure_time_lap = _best_score;
-}
-
-
-
-void ClockCycleCounter::spend_time ()
-{
- const Int64 nbr_clocks = 500; // Number of clock cycles to spend
-
- const Int64 start = read_clock_counter ();
- Int64 current;
-
- do
- {
- current = read_clock_counter ();
- }
- while ((current - start) * _clk_mul < nbr_clocks);
-}
-
-
-
-Int64 ClockCycleCounter::_measure_time_total = 0;
-Int64 ClockCycleCounter::_measure_time_lap = 0;
-int ClockCycleCounter::_clk_mul = 1;
-bool ClockCycleCounter::_init_flag = false;
-
-
-} // namespace stopwatch
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/stopwatch/ClockCycleCounter.h b/examples/spectrum/3rdparty/fftreal/stopwatch/ClockCycleCounter.h
deleted file mode 100644
index ba7a99a..0000000
--- a/examples/spectrum/3rdparty/fftreal/stopwatch/ClockCycleCounter.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*****************************************************************************
-
- ClockCycleCounter.h
- Copyright (c) 2003 Laurent de Soras
-
-Instrumentation class, for accurate time interval measurement. You may have
-to modify the implementation to adapt it to your system and/or compiler.
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (stopwatch_ClockCycleCounter_HEADER_INCLUDED)
-#define stopwatch_ClockCycleCounter_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "def.h"
-#include "Int64.h"
-
-
-
-namespace stopwatch
-{
-
-
-
-class ClockCycleCounter
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- ClockCycleCounter ();
-
- stopwatch_FORCEINLINE void
- start ();
- stopwatch_FORCEINLINE void
- stop_lap ();
- Int64 get_time_total () const;
- Int64 get_time_best_lap () const;
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- void compute_clk_mul ();
- void compute_measure_time_total ();
- void compute_measure_time_lap ();
-
- static void spend_time ();
- static stopwatch_FORCEINLINE Int64
- read_clock_counter ();
-
- Int64 _start_time;
- Int64 _state;
- Int64 _best_score;
-
- static Int64 _measure_time_total;
- static Int64 _measure_time_lap;
- static int _clk_mul;
- static bool _init_flag;
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- ClockCycleCounter (const ClockCycleCounter &other);
- ClockCycleCounter &
- operator = (const ClockCycleCounter &other);
- bool operator == (const ClockCycleCounter &other);
- bool operator != (const ClockCycleCounter &other);
-
-}; // class ClockCycleCounter
-
-
-
-} // namespace stopwatch
-
-
-
-#include "ClockCycleCounter.hpp"
-
-
-
-#endif // stopwatch_ClockCycleCounter_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/stopwatch/ClockCycleCounter.hpp b/examples/spectrum/3rdparty/fftreal/stopwatch/ClockCycleCounter.hpp
deleted file mode 100644
index fbd511e..0000000
--- a/examples/spectrum/3rdparty/fftreal/stopwatch/ClockCycleCounter.hpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/*****************************************************************************
-
- ClockCycleCounter.hpp
- Copyright (c) 2003 Laurent de Soras
-
-Please complete the definitions according to your compiler/architecture.
-It's not a big deal if it's not possible to get the clock count...
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (stopwatch_ClockCycleCounter_CURRENT_CODEHEADER)
- #error Recursive inclusion of ClockCycleCounter code header.
-#endif
-#define stopwatch_ClockCycleCounter_CURRENT_CODEHEADER
-
-#if ! defined (stopwatch_ClockCycleCounter_CODEHEADER_INCLUDED)
-#define stopwatch_ClockCycleCounter_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "fnc.h"
-
-#include <climits>
-
-
-
-namespace stopwatch
-{
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*
-==============================================================================
-Name: start
-Description:
- Starts the counter.
-Throws: Nothing
-==============================================================================
-*/
-
-void ClockCycleCounter::start ()
-{
- _best_score = (static_cast <Int64> (1) << (sizeof (Int64) * CHAR_BIT - 2));
- const Int64 start_clock = read_clock_counter ();
- _start_time = start_clock;
- _state = start_clock - _best_score;
-}
-
-
-
-/*
-==============================================================================
-Name: stop_lap
-Description:
- Captures the current time and updates the smallest duration between two
- consecutive calls to stop_lap() or the latest start().
- start() must have been called at least once before calling this function.
-Throws: Nothing
-==============================================================================
-*/
-
-void ClockCycleCounter::stop_lap ()
-{
- const Int64 end_clock = read_clock_counter ();
- _best_score = min (end_clock - _state, _best_score);
- _state = end_clock;
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-Int64 ClockCycleCounter::read_clock_counter ()
-{
- register Int64 clock_cnt;
-
-#if defined (_MSC_VER)
-
- __asm
- {
- lea edi, clock_cnt
- rdtsc
- mov [edi ], eax
- mov [edi + 4], edx
- }
-
-#elif defined (__GNUC__) && defined (__i386__)
-
- __asm__ __volatile__ ("rdtsc" : "=A" (clock_cnt));
-
-#elif (__MWERKS__) && defined (__POWERPC__)
-
- asm
- {
- loop:
- mftbu clock_cnt@hiword
- mftb clock_cnt@loword
- mftbu r5
- cmpw clock_cnt@hiword,r5
- bne loop
- }
-
-#endif
-
- return (clock_cnt);
-}
-
-
-
-} // namespace stopwatch
-
-
-
-#endif // stopwatch_ClockCycleCounter_CODEHEADER_INCLUDED
-
-#undef stopwatch_ClockCycleCounter_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/stopwatch/Int64.h b/examples/spectrum/3rdparty/fftreal/stopwatch/Int64.h
deleted file mode 100644
index 1e786e2..0000000
--- a/examples/spectrum/3rdparty/fftreal/stopwatch/Int64.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*****************************************************************************
-
- Int64.h
- Copyright (c) 2003 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (stopwatch_Int64_HEADER_INCLUDED)
-#define stopwatch_Int64_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-namespace stopwatch
-{
-
-
-#if defined (_MSC_VER)
-
- typedef __int64 Int64;
-
-#elif defined (__MWERKS__) || defined (__GNUC__)
-
- typedef long long Int64;
-
-#elif defined (__BEOS__)
-
- typedef int64 Int64;
-
-#else
-
- #error No 64-bit integer type defined for this compiler !
-
-#endif
-
-
-} // namespace stopwatch
-
-
-
-#endif // stopwatch_Int64_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/stopwatch/StopWatch.cpp b/examples/spectrum/3rdparty/fftreal/stopwatch/StopWatch.cpp
deleted file mode 100644
index 7795d86..0000000
--- a/examples/spectrum/3rdparty/fftreal/stopwatch/StopWatch.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*****************************************************************************
-
- StopWatch.cpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (_MSC_VER)
- #pragma warning (1 : 4130) // "'operator' : logical operation on address of string constant"
- #pragma warning (1 : 4223) // "nonstandard extension used : non-lvalue array converted to pointer"
- #pragma warning (1 : 4705) // "statement has no effect"
- #pragma warning (1 : 4706) // "assignment within conditional expression"
- #pragma warning (4 : 4786) // "identifier was truncated to '255' characters in the debug information"
- #pragma warning (4 : 4800) // "forcing value to bool 'true' or 'false' (performance warning)"
- #pragma warning (4 : 4355) // "'this' : used in base member initializer list"
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "StopWatch.h"
-
-#include <cassert>
-
-
-
-namespace stopwatch
-{
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-StopWatch::StopWatch ()
-: _ccc ()
-, _nbr_laps (0)
-{
- // Nothing
-}
-
-
-
-double StopWatch::get_time_total (Int64 nbr_op) const
-{
- assert (_nbr_laps > 0);
- assert (nbr_op > 0);
-
- return (
- static_cast <double> (_ccc.get_time_total ())
- / (static_cast <double> (nbr_op) * static_cast <double> (_nbr_laps))
- );
-}
-
-
-
-double StopWatch::get_time_best_lap (Int64 nbr_op) const
-{
- assert (nbr_op > 0);
-
- return (
- static_cast <double> (_ccc.get_time_best_lap ())
- / static_cast <double> (nbr_op)
- );
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-} // namespace stopwatch
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/stopwatch/StopWatch.h b/examples/spectrum/3rdparty/fftreal/stopwatch/StopWatch.h
deleted file mode 100644
index 9cc47e5..0000000
--- a/examples/spectrum/3rdparty/fftreal/stopwatch/StopWatch.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*****************************************************************************
-
- StopWatch.h
- Copyright (c) 2005 Laurent de Soras
-
-Utility class based on ClockCycleCounter to measure the unit time of a
-repeated operation.
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (stopwatch_StopWatch_HEADER_INCLUDED)
-#define stopwatch_StopWatch_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "ClockCycleCounter.h"
-
-
-
-namespace stopwatch
-{
-
-
-
-class StopWatch
-{
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-public:
-
- StopWatch ();
-
- stopwatch_FORCEINLINE void
- start ();
- stopwatch_FORCEINLINE void
- stop_lap ();
-
- double get_time_total (Int64 nbr_op) const;
- double get_time_best_lap (Int64 nbr_op) const;
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-protected:
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- ClockCycleCounter
- _ccc;
- Int64 _nbr_laps;
-
-
-
-/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-private:
-
- StopWatch (const StopWatch &other);
- StopWatch & operator = (const StopWatch &other);
- bool operator == (const StopWatch &other);
- bool operator != (const StopWatch &other);
-
-}; // class StopWatch
-
-
-
-} // namespace stopwatch
-
-
-
-#include "StopWatch.hpp"
-
-
-
-#endif // stopwatch_StopWatch_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/stopwatch/StopWatch.hpp b/examples/spectrum/3rdparty/fftreal/stopwatch/StopWatch.hpp
deleted file mode 100644
index 74482a7..0000000
--- a/examples/spectrum/3rdparty/fftreal/stopwatch/StopWatch.hpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*****************************************************************************
-
- StopWatch.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (stopwatch_StopWatch_CURRENT_CODEHEADER)
- #error Recursive inclusion of StopWatch code header.
-#endif
-#define stopwatch_StopWatch_CURRENT_CODEHEADER
-
-#if ! defined (stopwatch_StopWatch_CODEHEADER_INCLUDED)
-#define stopwatch_StopWatch_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-namespace stopwatch
-{
-
-
-
-/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-void StopWatch::start ()
-{
- _nbr_laps = 0;
- _ccc.start ();
-}
-
-
-
-void StopWatch::stop_lap ()
-{
- _ccc.stop_lap ();
- ++ _nbr_laps;
-}
-
-
-
-/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-} // namespace stopwatch
-
-
-
-#endif // stopwatch_StopWatch_CODEHEADER_INCLUDED
-
-#undef stopwatch_StopWatch_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/stopwatch/def.h b/examples/spectrum/3rdparty/fftreal/stopwatch/def.h
deleted file mode 100644
index 81ee6aa..0000000
--- a/examples/spectrum/3rdparty/fftreal/stopwatch/def.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*****************************************************************************
-
- def.h
- Copyright (c) 2003 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (stopwatch_def_HEADER_INCLUDED)
-#define stopwatch_def_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-namespace stopwatch
-{
-
-
-
-#if defined (_MSC_VER)
-
- #define stopwatch_FORCEINLINE __forceinline
-
-#else
-
- #define stopwatch_FORCEINLINE inline
-
-#endif
-
-
-
-} // namespace stopwatch
-
-
-
-#endif // stopwatch_def_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/stopwatch/fnc.h b/examples/spectrum/3rdparty/fftreal/stopwatch/fnc.h
deleted file mode 100644
index 0554535..0000000
--- a/examples/spectrum/3rdparty/fftreal/stopwatch/fnc.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*****************************************************************************
-
- fnc.h
- Copyright (c) 2003 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (stopwatch_fnc_HEADER_INCLUDED)
-#define stopwatch_fnc_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-namespace stopwatch
-{
-
-
-
-template <typename T>
-inline T min (T a, T b);
-
-template <typename T>
-inline T max (T a, T b);
-
-inline int round_int (double x);
-
-
-
-} // namespace rsp
-
-
-
-#include "fnc.hpp"
-
-
-
-#endif // stopwatch_fnc_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/stopwatch/fnc.hpp b/examples/spectrum/3rdparty/fftreal/stopwatch/fnc.hpp
deleted file mode 100644
index 0ab5949..0000000
--- a/examples/spectrum/3rdparty/fftreal/stopwatch/fnc.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*****************************************************************************
-
- fnc.hpp
- Copyright (c) 2003 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (stopwatch_fnc_CURRENT_CODEHEADER)
- #error Recursive inclusion of fnc code header.
-#endif
-#define stopwatch_fnc_CURRENT_CODEHEADER
-
-#if ! defined (stopwatch_fnc_CODEHEADER_INCLUDED)
-#define stopwatch_fnc_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include <cassert>
-#include <cmath>
-
-namespace std {}
-
-
-
-namespace stopwatch
-{
-
-
-
-template <typename T>
-inline T min (T a, T b)
-{
- return ((a < b) ? a : b);
-}
-
-
-
-template <typename T>
-inline T max (T a, T b)
-{
- return ((b < a) ? a : b);
-}
-
-
-
-int round_int (double x)
-{
- using namespace std;
-
- return (static_cast <int> (floor (x + 0.5)));
-}
-
-
-
-} // namespace stopwatch
-
-
-
-#endif // stopwatch_fnc_CODEHEADER_INCLUDED
-
-#undef stopwatch_fnc_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/test.cpp b/examples/spectrum/3rdparty/fftreal/test.cpp
deleted file mode 100644
index 7b6ed2c..0000000
--- a/examples/spectrum/3rdparty/fftreal/test.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-/*****************************************************************************
-
- test.cpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (_MSC_VER)
- #pragma warning (4 : 4786) // "identifier was truncated to '255' characters in the debug information"
- #pragma warning (4 : 4800) // "forcing value to bool 'true' or 'false' (performance warning)"
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-#include "test_settings.h"
-#include "TestHelperFixLen.h"
-#include "TestHelperNormal.h"
-
-#if defined (_MSC_VER)
-#include <crtdbg.h>
-#include <new.h>
-#endif // _MSC_VER
-
-#include <new>
-
-#include <cassert>
-#include <cstdio>
-
-
-
-#define TEST_
-
-
-/*\\\ FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-static int TEST_perform_test_accuracy_all ();
-static int TEST_perform_test_speed_all ();
-
-static void TEST_prog_init ();
-static void TEST_prog_end ();
-
-
-
-int main (int argc, char *argv [])
-{
- using namespace std;
-
- int ret_val = 0;
-
- TEST_prog_init ();
-
- try
- {
- if (ret_val == 0)
- {
- ret_val = TEST_perform_test_accuracy_all ();
- }
-
- if (ret_val == 0)
- {
- ret_val = TEST_perform_test_speed_all ();
- }
- }
-
- catch (std::exception &e)
- {
- printf ("\n*** main(): Exception (std::exception) : %s\n", e.what ());
- ret_val = -1;
- }
-
- catch (...)
- {
- printf ("\n*** main(): Undefined exception\n");
- ret_val = -1;
- }
-
- TEST_prog_end ();
-
- return (ret_val);
-}
-
-
-
-int TEST_perform_test_accuracy_all ()
-{
- int ret_val = 0;
-
- TestHelperNormal <float >::perform_test_accuracy (ret_val);
- TestHelperNormal <double>::perform_test_accuracy (ret_val);
-
- TestHelperFixLen < 1>::perform_test_accuracy (ret_val);
- TestHelperFixLen < 2>::perform_test_accuracy (ret_val);
- TestHelperFixLen < 3>::perform_test_accuracy (ret_val);
- TestHelperFixLen < 4>::perform_test_accuracy (ret_val);
- TestHelperFixLen < 7>::perform_test_accuracy (ret_val);
- TestHelperFixLen < 8>::perform_test_accuracy (ret_val);
- TestHelperFixLen <10>::perform_test_accuracy (ret_val);
- TestHelperFixLen <12>::perform_test_accuracy (ret_val);
- TestHelperFixLen <13>::perform_test_accuracy (ret_val);
-
- return (ret_val);
-}
-
-
-
-int TEST_perform_test_speed_all ()
-{
- int ret_val = 0;
-
-#if defined (test_settings_SPEED_TEST_ENABLED)
-
- TestHelperNormal <float >::perform_test_speed (ret_val);
- TestHelperNormal <double>::perform_test_speed (ret_val);
-
- TestHelperFixLen < 1>::perform_test_speed (ret_val);
- TestHelperFixLen < 2>::perform_test_speed (ret_val);
- TestHelperFixLen < 3>::perform_test_speed (ret_val);
- TestHelperFixLen < 4>::perform_test_speed (ret_val);
- TestHelperFixLen < 7>::perform_test_speed (ret_val);
- TestHelperFixLen < 8>::perform_test_speed (ret_val);
- TestHelperFixLen <10>::perform_test_speed (ret_val);
- TestHelperFixLen <12>::perform_test_speed (ret_val);
- TestHelperFixLen <14>::perform_test_speed (ret_val);
- TestHelperFixLen <16>::perform_test_speed (ret_val);
- TestHelperFixLen <20>::perform_test_speed (ret_val);
-
-#endif
-
- return (ret_val);
-}
-
-
-
-#if defined (_MSC_VER)
-static int __cdecl TEST_new_handler_cb (size_t dummy)
-{
- throw std::bad_alloc ();
- return (0);
-}
-#endif // _MSC_VER
-
-
-
-#if defined (_MSC_VER) && ! defined (NDEBUG)
-static int __cdecl TEST_debug_alloc_hook_cb (int alloc_type, void *user_data_ptr, size_t size, int block_type, long request_nbr, const unsigned char *filename_0, int line_nbr)
-{
- if (block_type != _CRT_BLOCK) // Ignore CRT blocks to prevent infinite recursion
- {
- switch (alloc_type)
- {
- case _HOOK_ALLOC:
- case _HOOK_REALLOC:
- case _HOOK_FREE:
-
- // Put some debug code here
-
- break;
-
- default:
- assert (false); // Undefined allocation type
- break;
- }
- }
-
- return (1);
-}
-#endif
-
-
-
-#if defined (_MSC_VER) && ! defined (NDEBUG)
-static int __cdecl TEST_debug_report_hook_cb (int report_type, char *user_msg_0, int *ret_val_ptr)
-{
- *ret_val_ptr = 0; // 1 to override the CRT default reporting mode
-
- switch (report_type)
- {
- case _CRT_WARN:
- case _CRT_ERROR:
- case _CRT_ASSERT:
-
-// Put some debug code here
-
- break;
- }
-
- return (*ret_val_ptr);
-}
-#endif
-
-
-
-static void TEST_prog_init ()
-{
-#if defined (_MSC_VER)
- ::_set_new_handler (::TEST_new_handler_cb);
-#endif // _MSC_VER
-
-#if defined (_MSC_VER) && ! defined (NDEBUG)
- {
- const int mode = (1 * _CRTDBG_MODE_DEBUG)
- | (1 * _CRTDBG_MODE_WNDW);
- ::_CrtSetReportMode (_CRT_WARN, mode);
- ::_CrtSetReportMode (_CRT_ERROR, mode);
- ::_CrtSetReportMode (_CRT_ASSERT, mode);
-
- const int old_flags = ::_CrtSetDbgFlag (_CRTDBG_REPORT_FLAG);
- ::_CrtSetDbgFlag ( old_flags
- | (1 * _CRTDBG_LEAK_CHECK_DF)
- | (1 * _CRTDBG_CHECK_ALWAYS_DF));
- ::_CrtSetBreakAlloc (-1); // Specify here a memory bloc number
- ::_CrtSetAllocHook (TEST_debug_alloc_hook_cb);
- ::_CrtSetReportHook (TEST_debug_report_hook_cb);
-
- // Speed up I/O but breaks C stdio compatibility
-// std::cout.sync_with_stdio (false);
-// std::cin.sync_with_stdio (false);
-// std::cerr.sync_with_stdio (false);
-// std::clog.sync_with_stdio (false);
- }
-#endif // _MSC_VER, NDEBUG
-}
-
-
-
-static void TEST_prog_end ()
-{
-#if defined (_MSC_VER) && ! defined (NDEBUG)
- {
- const int mode = (1 * _CRTDBG_MODE_DEBUG)
- | (0 * _CRTDBG_MODE_WNDW);
- ::_CrtSetReportMode (_CRT_WARN, mode);
- ::_CrtSetReportMode (_CRT_ERROR, mode);
- ::_CrtSetReportMode (_CRT_ASSERT, mode);
-
- ::_CrtMemState mem_state;
- ::_CrtMemCheckpoint (&mem_state);
- ::_CrtMemDumpStatistics (&mem_state);
- }
-#endif // _MSC_VER, NDEBUG
-}
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/test_fnc.h b/examples/spectrum/3rdparty/fftreal/test_fnc.h
deleted file mode 100644
index 2622156..0000000
--- a/examples/spectrum/3rdparty/fftreal/test_fnc.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*****************************************************************************
-
- test_fnc.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (test_fnc_HEADER_INCLUDED)
-#define test_fnc_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class T>
-inline T limit (const T &x, const T &inf, const T &sup);
-
-
-
-#include "test_fnc.hpp"
-
-
-
-#endif // test_fnc_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/test_fnc.hpp b/examples/spectrum/3rdparty/fftreal/test_fnc.hpp
deleted file mode 100644
index 4b5f9f5..0000000
--- a/examples/spectrum/3rdparty/fftreal/test_fnc.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*****************************************************************************
-
- test_fnc.hpp
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if defined (test_fnc_CURRENT_CODEHEADER)
- #error Recursive inclusion of test_fnc code header.
-#endif
-#define test_fnc_CURRENT_CODEHEADER
-
-#if ! defined (test_fnc_CODEHEADER_INCLUDED)
-#define test_fnc_CODEHEADER_INCLUDED
-
-
-
-/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
-
-
-template <class T>
-T limit (const T &x, const T &inf, const T &sup)
-{
- assert (! (sup < inf));
-
- return ((x < inf) ? inf : ((sup < x) ? sup : x));
-}
-
-
-
-#endif // test_fnc_CODEHEADER_INCLUDED
-
-#undef test_fnc_CURRENT_CODEHEADER
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/test_settings.h b/examples/spectrum/3rdparty/fftreal/test_settings.h
deleted file mode 100644
index b893afc..0000000
--- a/examples/spectrum/3rdparty/fftreal/test_settings.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
-
- test_settings.h
- Copyright (c) 2005 Laurent de Soras
-
---- Legal stuff ---
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*Tab=3***********************************************************************/
-
-
-
-#if ! defined (test_settings_HEADER_INCLUDED)
-#define test_settings_HEADER_INCLUDED
-
-#if defined (_MSC_VER)
- #pragma once
- #pragma warning (4 : 4250) // "Inherits via dominance."
-#endif
-
-
-
-// #undef this label to avoid speed test compilation.
-#define test_settings_SPEED_TEST_ENABLED
-
-
-
-#endif // test_settings_HEADER_INCLUDED
-
-
-
-/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
diff --git a/examples/spectrum/3rdparty/fftreal/testapp.dpr b/examples/spectrum/3rdparty/fftreal/testapp.dpr
deleted file mode 100644
index 54f2eb9..0000000
--- a/examples/spectrum/3rdparty/fftreal/testapp.dpr
+++ /dev/null
@@ -1,150 +0,0 @@
-program testapp;
-{$APPTYPE CONSOLE}
-uses
- SysUtils,
- fftreal in 'fftreal.pas',
- Math,
- Windows;
-
-var
- nbr_points : longint;
- x, f : pflt_array;
- fft : TFFTReal;
- i : longint;
- PI : double;
- areal, img : double;
- f_abs : double;
- buffer_size : longint;
- nbr_tests : longint;
- time0, time1, time2 : int64;
- timereso : int64;
- offset : longint;
- t0, t1 : double;
- nbr_s_chn : longint;
- tempp1, tempp2 : pflt_array;
-
-begin
- (*______________________________________________
- *
- * Exactness test
- *______________________________________________
- *)
-
- WriteLn('Accuracy test:');
- WriteLn;
-
- nbr_points := 16; // Power of 2
- GetMem(x, nbr_points * sizeof_flt);
- GetMem(f, nbr_points * sizeof_flt);
- fft := TFFTReal.Create(nbr_points); // FFT object initialized here
-
- // Test signal
- PI := ArcTan(1) * 4;
- for i := 0 to nbr_points-1 do
- begin
- x^[i] := -1 + sin (3*2*PI*i/nbr_points)
- + cos (5*2*PI*i/nbr_points) * 2
- - sin (7*2*PI*i/nbr_points) * 3
- + cos (8*2*PI*i/nbr_points) * 5;
- end;
-
- // Compute FFT and IFFT
- fft.do_fft(f, x);
- fft.do_ifft(f, x);
- fft.rescale(x);
-
- // Display the result
- WriteLn('FFT:');
- for i := 0 to nbr_points div 2 do
- begin
- areal := f^[i];
- if (i > 0) and (i < nbr_points div 2) then
- img := f^[i + nbr_points div 2]
- else
- img := 0;
-
- f_abs := Sqrt(areal * areal + img * img);
- WriteLn(Format('%5d: %12.6f %12.6f (%12.6f)', [i, areal, img, f_abs]));
- end;
-
- WriteLn;
- WriteLn('IFFT:');
- for i := 0 to nbr_points-1 do
- WriteLn(Format('%5d: %f', [i, x^[i]]));
-
- WriteLn;
-
- FreeMem(x);
- FreeMem(f);
- fft.Free;
-
-
- (*______________________________________________
- *
- * Speed test
- *______________________________________________
- *)
-
- WriteLn('Speed test:');
- WriteLn('Please wait...');
- WriteLn;
-
- nbr_points := 1024; // Power of 2
- buffer_size := 256*nbr_points; // Number of flt_t (float or double)
- nbr_tests := 10000;
-
- assert(nbr_points <= buffer_size);
- GetMem(x, buffer_size * sizeof_flt);
- GetMem(f, buffer_size * sizeof_flt);
- fft := TFFTReal.Create(nbr_points); // FFT object initialized here
-
- // Test signal: noise
- for i := 0 to nbr_points-1 do
- x^[i] := Random($7fff) - ($7fff shr 1);
-
- // timing
- QueryPerformanceFrequency(timereso);
- QueryPerformanceCounter(time0);
-
- for i := 0 to nbr_tests-1 do
- begin
- offset := (i * nbr_points) and (buffer_size - 1);
- tempp1 := f;
- inc(tempp1, offset);
- tempp2 := x;
- inc(tempp2, offset);
- fft.do_fft(tempp1, tempp2);
- end;
-
- QueryPerformanceCounter(time1);
-
- for i := 0 to nbr_tests-1 do
- begin
- offset := (i * nbr_points) and (buffer_size - 1);
- tempp1 := f;
- inc(tempp1, offset);
- tempp2 := x;
- inc(tempp2, offset);
- fft.do_ifft(tempp1, tempp2);
- fft.rescale(x);
- end;
-
- QueryPerformanceCounter(time2);
-
- t0 := ((time1-time0) / timereso) / nbr_tests;
- t1 := ((time2-time1) / timereso) / nbr_tests;
-
- WriteLn(Format('%d-points FFT : %.0f us.', [nbr_points, t0 * 1000000]));
- WriteLn(Format('%d-points IFFT + scaling: %.0f us.', [nbr_points, t1 * 1000000]));
-
- nbr_s_chn := Floor(nbr_points / ((t0 + t1) * 44100 * 2));
- WriteLn(Format('Peak performance: FFT+IFFT on %d mono channels at 44.1 KHz (with overlapping)', [nbr_s_chn]));
- WriteLn;
-
- FreeMem(x);
- FreeMem(f);
- fft.Free;
-
- WriteLn('Press [Return] key to terminate...');
- ReadLn;
-end.
diff --git a/examples/spectrum/README.txt b/examples/spectrum/README.txt
deleted file mode 100644
index c39d4a7..0000000
--- a/examples/spectrum/README.txt
+++ /dev/null
@@ -1,103 +0,0 @@
-Spectrum analyser demo app
-==========================
-
-Introduction
-------------
-
-This application is a demo which uses the QtMultimedia APIs to capture and play back PCM audio. While either recording or playback is ongoing, the application performs real-time level and frequency spectrum analysis, displaying the results in its main window.
-
-
-Acknowledgments
----------------
-
-The application uses the FFTReal v2.00 library by Laurent de Soras to perform frequency analysis of the audio signal. For further information, see the project home page:
- http://ldesoras.free.fr/prod.html
-
-
-Quick start
------------
-
-Play generated tone
-1. Select 'Play generated tone' from the mode menu
-2. Ensure that the 'Frequency sweep' box is checked
-3. Press 'OK'
-4. Press the play button
-You should hear a rising tone, and see progressively higher frequencies indicated by the spectrograph.
-
-Record and playback
-1. Select 'Record and play back audio' from the mode menu
-2. Press the record button, and speak into the microphone
-3. Wait until the buffer is full (shown as a full blue bar in the top widget)
-4. Press play, and wait until playback of the buffer is complete
-
-Play file
-1. Select 'Play file' from the mode menu
-2. Select a WAV file
-3. Press the play button
-You should hear the first few seconds of the file being played. The waveform, spectrograph and level meter should be updated as the file is played.
-
-
-Things to play with
--------------------
-
-Try repeating the 'Play generated tone' sequence using different window functions. These can be selected from the settings dialog - launch it by pressing the spanner icon. The window function is applied to the audio signal before performing the frequency analysis; different windows should have a visible effect on the resulting frequency spectrum.
-
-Try clicking on one of the spectrograph bars while the tone is being played. The frequency range for that bar will be displayed at the top of the application window.
-
-
-Troubleshooting
----------------
-
-If either recording or playback do not work, you may need to select a different input / output audio device. This can be done in the settings dialog - launch it by pressing the spanner icon.
-
-If that doesn't work, there may be a problem either in the application or in Qt. Report a bug in the usual way.
-
-
-Application interface
----------------------
-
-The main window of the application contains the following widgets, starting at the top:
-
-Message box
-This shows various messages during execution, such as the current audio format.
-
-Progress bar / waveform display
-- While recording or playback is ongoing, the audio waveform is displayed, sliding from right to left.
-- Superimposed on the waveform, the amount of data currently in the buffer is showed as a blue bar. When recording, this blue bar fills up from left to right; when playing, the bar gets consumed from left to right.
-- A green window shows which part of the buffer has most recently been analysed. This window should be close to the 'leading edge' of recording or playback, i.e. the most recently recorded / played data, although it will lag slightly depending on the performance of the machine on which the application is running.
-
-Frequency spectrograph (on the left)
-The spectrograph shows 10 bars, each representing a frequency range. The frequency range of each bar is displayed in the message box when the bar is clicked. The height of the bar shows the maximum amplitude of freqencies within its range.
-
-Level meter (on the right)
-The current peak audio level is shown as a pink bar; the current RMS level is shown as a red bar. The 'high water mark' during a recent period is shown as a thin red line.
-
-Button panel
-- The mode menu allows switching between the three operation modes - 'Play generated tone', 'Record and play back' and 'Play file'.
-- The record button starts or resumes audio capture from the current input device.
-- The pause button suspends either capture or recording.
-- The play button starts or resumes audio playback to the current output device.
-- The settings button launches the settings dialog.
-
-
-Hacking
--------
-
-If you want to hack the application, here are some pointers to get started.
-
-The spectrum.pri file contains several macros which you can enable by uncommenting:
-- LOG_FOO Enable logging from class Foo via qDebug()
-- DUMP_FOO Dump data from class Foo to the file system
- e.g. DUMP_SPECTRUMANALYSER writes files containing the raw FFT input and output.
- Be aware that this can generate a *lot* of data and may slow the app down considerably.
-- DISABLE_FOO Disable specified functionality
-
-If you don't like the combination of the waveform and progress bar in a single widget, separate them by commenting out SUPERIMPOSE_PROGRESS_ON_WAVEFORM.
-
-The spectrum.h file defines a number of parameters which can be played with. These control things such as the number of audio samples analysed per FFT calculation, the range and number of bands displayed by the spectrograph, and so on.
-
-The part of the application which interacts with QtMultimedia is in the Engine class.
-
-Some ideas for enhancements to the app are listed in TODO.txt. Feel free to start work on any of them :)
-
-
diff --git a/examples/spectrum/TODO.txt b/examples/spectrum/TODO.txt
deleted file mode 100644
index 7e5881a..0000000
--- a/examples/spectrum/TODO.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-TODO list for spectrum analyser
-===============================
-
-Bug fixes
----------
-
-
-New features
-------------
-
-* Wrap user-visible strings in tr()
-
-* Allow user to set frequency range
-There should be some constraints on this, e.g.
- - Maximum frequency must not be greater than Nyquist frequency
- - Range is divisible by number of bars?
-
-* Add more visualizers other than bar spectrogram
-e.g. Funky OpenGL visualizers, particle effects etc
-
-
-Non-functional stuff
---------------------
-
-* Improve robustness of QComboBox -> enum mapping
-At the moment, SettingsDialog relies on casting the combobox item index directly to the enumerated type. This is clearly a bit fragile...
-
-* For functions which take or return qint64 values, make a clear distinction between duration (microseconds) and length (bytes).
-A sensible convention would be that the default is bytes - i.e. microseconds must be indicated by adding a Us suffix, where not already obvious from the function name.
-
-
-
-
-
diff --git a/examples/spectrum/app/.gitignore b/examples/spectrum/app/.gitignore
deleted file mode 100644
index 82cf2a2..0000000
--- a/examples/spectrum/app/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-spectrum
-spectrum.exe
diff --git a/examples/spectrum/app/app.pro b/examples/spectrum/app/app.pro
deleted file mode 100644
index aec69d2..0000000
--- a/examples/spectrum/app/app.pro
+++ /dev/null
@@ -1,93 +0,0 @@
-include(../spectrum.pri)
-
-static: error(This application cannot be statically linked to the fftreal library)
-
-TEMPLATE = app
-
-TARGET = spectrum
-
-QT += multimedia
-
-SOURCES += main.cpp \
- engine.cpp \
- frequencyspectrum.cpp \
- levelmeter.cpp \
- mainwidget.cpp \
- progressbar.cpp \
- settingsdialog.cpp \
- spectrograph.cpp \
- spectrumanalyser.cpp \
- tonegenerator.cpp \
- tonegeneratordialog.cpp \
- utils.cpp \
- waveform.cpp \
- wavfile.cpp
-
-HEADERS += engine.h \
- frequencyspectrum.h \
- levelmeter.h \
- mainwidget.h \
- progressbar.h \
- settingsdialog.h \
- spectrograph.h \
- spectrum.h \
- spectrumanalyser.h \
- tonegenerator.h \
- tonegeneratordialog.h \
- utils.h \
- waveform.h \
- wavfile.h
-
-fftreal_dir = ../3rdparty/fftreal
-
-INCLUDEPATH += $${fftreal_dir}
-
-RESOURCES = spectrum.qrc
-
-# Dynamic linkage against FFTReal DLL
-!contains(DEFINES, DISABLE_FFT) {
- macx {
- # Link to fftreal framework
- LIBS += -F$${fftreal_dir}
- LIBS += -framework fftreal
- } else {
- LIBS += -L..$${spectrum_build_dir}
- LIBS += -lfftreal
- }
-}
-
-# Install
-
-sources.files = $$SOURCES $$HEADERS $$RESOURCES app.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/spectrum/app
-images.files += images/record.png images/settings.png
-images.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/spectrum/app/images
-INSTALLS += sources images
-
-# Deployment
-
-DESTDIR = ..$${spectrum_build_dir}
-macx {
- !contains(DEFINES, DISABLE_FFT) {
- # Relocate fftreal.framework into spectrum.app bundle
- framework_dir = ../spectrum.app/Contents/Frameworks
- framework_name = fftreal.framework/Versions/1/fftreal
- QMAKE_POST_LINK = \
- mkdir -p $${framework_dir} &&\
- rm -rf $${framework_dir}/fftreal.framework &&\
- cp -R $${fftreal_dir}/fftreal.framework $${framework_dir} &&\
- install_name_tool -id @executable_path/../Frameworks/$${framework_name} \
- $${framework_dir}/$${framework_name} &&\
- install_name_tool -change $${framework_name} \
- @executable_path/../Frameworks/$${framework_name} \
- ../spectrum.app/Contents/MacOS/spectrum
- }
-} else {
- linux-g++*: {
- # Provide relative path from application to fftreal library
- QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN
- }
-}
-
-
-QT+=widgets
diff --git a/examples/spectrum/app/engine.cpp b/examples/spectrum/app/engine.cpp
deleted file mode 100644
index bea2452..0000000
--- a/examples/spectrum/app/engine.cpp
+++ /dev/null
@@ -1,766 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "engine.h"
-#include "tonegenerator.h"
-#include "utils.h"
-
-#include <math.h>
-
-#include <QCoreApplication>
-#include <QMetaObject>
-#include <QSet>
-#include <QtMultimedia/QAudioInput>
-#include <QtMultimedia/QAudioOutput>
-#include <QDebug>
-#include <QThread>
-#include <QFile>
-
-//-----------------------------------------------------------------------------
-// Constants
-//-----------------------------------------------------------------------------
-
-const qint64 BufferDurationUs = 10 * 1000000;
-const int NotifyIntervalMs = 100;
-
-// Size of the level calculation window in microseconds
-const int LevelWindowUs = 0.1 * 1000000;
-
-
-//-----------------------------------------------------------------------------
-// Helper functions
-//-----------------------------------------------------------------------------
-
-QDebug& operator<<(QDebug &debug, const QAudioFormat &format)
-{
- debug << format.frequency() << "Hz"
- << format.channels() << "channels";
- return debug;
-}
-
-//-----------------------------------------------------------------------------
-// Constructor and destructor
-//-----------------------------------------------------------------------------
-
-Engine::Engine(QObject *parent)
- : QObject(parent)
- , m_mode(QAudio::AudioInput)
- , m_state(QAudio::StoppedState)
- , m_generateTone(false)
- , m_file(0)
- , m_analysisFile(0)
- , m_availableAudioInputDevices
- (QAudioDeviceInfo::availableDevices(QAudio::AudioInput))
- , m_audioInputDevice(QAudioDeviceInfo::defaultInputDevice())
- , m_audioInput(0)
- , m_audioInputIODevice(0)
- , m_recordPosition(0)
- , m_availableAudioOutputDevices
- (QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
- , m_audioOutputDevice(QAudioDeviceInfo::defaultOutputDevice())
- , m_audioOutput(0)
- , m_playPosition(0)
- , m_bufferPosition(0)
- , m_bufferLength(0)
- , m_dataLength(0)
- , m_levelBufferLength(0)
- , m_rmsLevel(0.0)
- , m_peakLevel(0.0)
- , m_spectrumBufferLength(0)
- , m_spectrumAnalyser()
- , m_spectrumPosition(0)
- , m_count(0)
-{
- qRegisterMetaType<FrequencySpectrum>("FrequencySpectrum");
- qRegisterMetaType<WindowFunction>("WindowFunction");
- CHECKED_CONNECT(&m_spectrumAnalyser,
- SIGNAL(spectrumChanged(FrequencySpectrum)),
- this,
- SLOT(spectrumChanged(FrequencySpectrum)));
-
- initialize();
-
-#ifdef DUMP_DATA
- createOutputDir();
-#endif
-
-#ifdef DUMP_SPECTRUM
- m_spectrumAnalyser.setOutputPath(outputPath());
-#endif
-}
-
-Engine::~Engine()
-{
-
-}
-
-//-----------------------------------------------------------------------------
-// Public functions
-//-----------------------------------------------------------------------------
-
-bool Engine::loadFile(const QString &fileName)
-{
- reset();
- bool result = false;
- Q_ASSERT(!m_generateTone);
- Q_ASSERT(!m_file);
- Q_ASSERT(!fileName.isEmpty());
- m_file = new WavFile(this);
- if (m_file->open(fileName)) {
- if (isPCMS16LE(m_file->fileFormat())) {
- result = initialize();
- } else {
- emit errorMessage(tr("Audio format not supported"),
- formatToString(m_file->fileFormat()));
- }
- } else {
- emit errorMessage(tr("Could not open file"), fileName);
- }
- if (result) {
- m_analysisFile = new WavFile(this);
- m_analysisFile->open(fileName);
- }
- return result;
-}
-
-bool Engine::generateTone(const Tone &tone)
-{
- reset();
- Q_ASSERT(!m_generateTone);
- Q_ASSERT(!m_file);
- m_generateTone = true;
- m_tone = tone;
- ENGINE_DEBUG << "Engine::generateTone"
- << "startFreq" << m_tone.startFreq
- << "endFreq" << m_tone.endFreq
- << "amp" << m_tone.amplitude;
- return initialize();
-}
-
-bool Engine::generateSweptTone(qreal amplitude)
-{
- Q_ASSERT(!m_generateTone);
- Q_ASSERT(!m_file);
- m_generateTone = true;
- m_tone.startFreq = 1;
- m_tone.endFreq = 0;
- m_tone.amplitude = amplitude;
- ENGINE_DEBUG << "Engine::generateSweptTone"
- << "startFreq" << m_tone.startFreq
- << "amp" << m_tone.amplitude;
- return initialize();
-}
-
-bool Engine::initializeRecord()
-{
- reset();
- ENGINE_DEBUG << "Engine::initializeRecord";
- Q_ASSERT(!m_generateTone);
- Q_ASSERT(!m_file);
- m_generateTone = false;
- m_tone = SweptTone();
- return initialize();
-}
-
-qint64 Engine::bufferLength() const
-{
- return m_file ? m_file->size() : m_bufferLength;
-}
-
-void Engine::setWindowFunction(WindowFunction type)
-{
- m_spectrumAnalyser.setWindowFunction(type);
-}
-
-
-//-----------------------------------------------------------------------------
-// Public slots
-//-----------------------------------------------------------------------------
-
-void Engine::startRecording()
-{
- if (m_audioInput) {
- if (QAudio::AudioInput == m_mode &&
- QAudio::SuspendedState == m_state) {
- m_audioInput->resume();
- } else {
- m_spectrumAnalyser.cancelCalculation();
- spectrumChanged(0, 0, FrequencySpectrum());
-
- m_buffer.fill(0);
- setRecordPosition(0, true);
- stopPlayback();
- m_mode = QAudio::AudioInput;
- CHECKED_CONNECT(m_audioInput, SIGNAL(stateChanged(QAudio::State)),
- this, SLOT(audioStateChanged(QAudio::State)));
- CHECKED_CONNECT(m_audioInput, SIGNAL(notify()),
- this, SLOT(audioNotify()));
- m_count = 0;
- m_dataLength = 0;
- emit dataLengthChanged(0);
- m_audioInputIODevice = m_audioInput->start();
- CHECKED_CONNECT(m_audioInputIODevice, SIGNAL(readyRead()),
- this, SLOT(audioDataReady()));
- }
- }
-}
-
-void Engine::startPlayback()
-{
- if (m_audioOutput) {
- if (QAudio::AudioOutput == m_mode &&
- QAudio::SuspendedState == m_state) {
-#ifdef Q_OS_WIN
- // The Windows backend seems to internally go back into ActiveState
- // while still returning SuspendedState, so to ensure that it doesn't
- // ignore the resume() call, we first re-suspend
- m_audioOutput->suspend();
-#endif
- m_audioOutput->resume();
- } else {
- m_spectrumAnalyser.cancelCalculation();
- spectrumChanged(0, 0, FrequencySpectrum());
- setPlayPosition(0, true);
- stopRecording();
- m_mode = QAudio::AudioOutput;
- CHECKED_CONNECT(m_audioOutput, SIGNAL(stateChanged(QAudio::State)),
- this, SLOT(audioStateChanged(QAudio::State)));
- CHECKED_CONNECT(m_audioOutput, SIGNAL(notify()),
- this, SLOT(audioNotify()));
- m_count = 0;
- if (m_file) {
- m_file->seek(0);
- m_bufferPosition = 0;
- m_dataLength = 0;
- m_audioOutput->start(m_file);
- } else {
- m_audioOutputIODevice.close();
- m_audioOutputIODevice.setBuffer(&m_buffer);
- m_audioOutputIODevice.open(QIODevice::ReadOnly);
- m_audioOutput->start(&m_audioOutputIODevice);
- }
- }
- }
-}
-
-void Engine::suspend()
-{
- if (QAudio::ActiveState == m_state ||
- QAudio::IdleState == m_state) {
- switch (m_mode) {
- case QAudio::AudioInput:
- m_audioInput->suspend();
- break;
- case QAudio::AudioOutput:
- m_audioOutput->suspend();
- break;
- }
- }
-}
-
-void Engine::setAudioInputDevice(const QAudioDeviceInfo &device)
-{
- if (device.deviceName() != m_audioInputDevice.deviceName()) {
- m_audioInputDevice = device;
- initialize();
- }
-}
-
-void Engine::setAudioOutputDevice(const QAudioDeviceInfo &device)
-{
- if (device.deviceName() != m_audioOutputDevice.deviceName()) {
- m_audioOutputDevice = device;
- initialize();
- }
-}
-
-
-//-----------------------------------------------------------------------------
-// Private slots
-//-----------------------------------------------------------------------------
-
-void Engine::audioNotify()
-{
- switch (m_mode) {
- case QAudio::AudioInput: {
- const qint64 recordPosition = qMin(m_bufferLength, audioLength(m_format, m_audioInput->processedUSecs()));
- setRecordPosition(recordPosition);
- const qint64 levelPosition = m_dataLength - m_levelBufferLength;
- if (levelPosition >= 0)
- calculateLevel(levelPosition, m_levelBufferLength);
- if (m_dataLength >= m_spectrumBufferLength) {
- const qint64 spectrumPosition = m_dataLength - m_spectrumBufferLength;
- calculateSpectrum(spectrumPosition);
- }
- emit bufferChanged(0, m_dataLength, m_buffer);
- }
- break;
- case QAudio::AudioOutput: {
- const qint64 playPosition = audioLength(m_format, m_audioOutput->processedUSecs());
- setPlayPosition(qMin(bufferLength(), playPosition));
- const qint64 levelPosition = playPosition - m_levelBufferLength;
- const qint64 spectrumPosition = playPosition - m_spectrumBufferLength;
- if (m_file) {
- if (levelPosition > m_bufferPosition ||
- spectrumPosition > m_bufferPosition ||
- qMax(m_levelBufferLength, m_spectrumBufferLength) > m_dataLength) {
- m_bufferPosition = 0;
- m_dataLength = 0;
- // Data needs to be read into m_buffer in order to be analysed
- const qint64 readPos = qMax(qint64(0), qMin(levelPosition, spectrumPosition));
- const qint64 readEnd = qMin(m_analysisFile->size(), qMax(levelPosition + m_levelBufferLength, spectrumPosition + m_spectrumBufferLength));
- const qint64 readLen = readEnd - readPos + audioLength(m_format, WaveformWindowDuration);
- qDebug() << "Engine::audioNotify [1]"
- << "analysisFileSize" << m_analysisFile->size()
- << "readPos" << readPos
- << "readLen" << readLen;
- if (m_analysisFile->seek(readPos + m_analysisFile->headerLength())) {
- m_buffer.resize(readLen);
- m_bufferPosition = readPos;
- m_dataLength = m_analysisFile->read(m_buffer.data(), readLen);
- qDebug() << "Engine::audioNotify [2]" << "bufferPosition" << m_bufferPosition << "dataLength" << m_dataLength;
- } else {
- qDebug() << "Engine::audioNotify [2]" << "file seek error";
- }
- emit bufferChanged(m_bufferPosition, m_dataLength, m_buffer);
- }
- } else {
- if (playPosition >= m_dataLength)
- stopPlayback();
- }
- if (levelPosition >= 0 && levelPosition + m_levelBufferLength < m_bufferPosition + m_dataLength)
- calculateLevel(levelPosition, m_levelBufferLength);
- if (spectrumPosition >= 0 && spectrumPosition + m_spectrumBufferLength < m_bufferPosition + m_dataLength)
- calculateSpectrum(spectrumPosition);
- }
- break;
- }
-}
-
-void Engine::audioStateChanged(QAudio::State state)
-{
- ENGINE_DEBUG << "Engine::audioStateChanged from" << m_state
- << "to" << state;
-
- if (QAudio::IdleState == state && m_file && m_file->pos() == m_file->size()) {
- stopPlayback();
- } else {
- if (QAudio::StoppedState == state) {
- // Check error
- QAudio::Error error = QAudio::NoError;
- switch (m_mode) {
- case QAudio::AudioInput:
- error = m_audioInput->error();
- break;
- case QAudio::AudioOutput:
- error = m_audioOutput->error();
- break;
- }
- if (QAudio::NoError != error) {
- reset();
- return;
- }
- }
- setState(state);
- }
-}
-
-void Engine::audioDataReady()
-{
- Q_ASSERT(0 == m_bufferPosition);
- const qint64 bytesReady = m_audioInput->bytesReady();
- const qint64 bytesSpace = m_buffer.size() - m_dataLength;
- const qint64 bytesToRead = qMin(bytesReady, bytesSpace);
-
- const qint64 bytesRead = m_audioInputIODevice->read(
- m_buffer.data() + m_dataLength,
- bytesToRead);
-
- if (bytesRead) {
- m_dataLength += bytesRead;
- emit dataLengthChanged(dataLength());
- }
-
- if (m_buffer.size() == m_dataLength)
- stopRecording();
-}
-
-void Engine::spectrumChanged(const FrequencySpectrum &spectrum)
-{
- ENGINE_DEBUG << "Engine::spectrumChanged" << "pos" << m_spectrumPosition;
- emit spectrumChanged(m_spectrumPosition, m_spectrumBufferLength, spectrum);
-}
-
-
-//-----------------------------------------------------------------------------
-// Private functions
-//-----------------------------------------------------------------------------
-
-void Engine::resetAudioDevices()
-{
- delete m_audioInput;
- m_audioInput = 0;
- m_audioInputIODevice = 0;
- setRecordPosition(0);
- delete m_audioOutput;
- m_audioOutput = 0;
- setPlayPosition(0);
- m_spectrumPosition = 0;
- setLevel(0.0, 0.0, 0);
-}
-
-void Engine::reset()
-{
- stopRecording();
- stopPlayback();
- setState(QAudio::AudioInput, QAudio::StoppedState);
- setFormat(QAudioFormat());
- m_generateTone = false;
- delete m_file;
- m_file = 0;
- delete m_analysisFile;
- m_analysisFile = 0;
- m_buffer.clear();
- m_bufferPosition = 0;
- m_bufferLength = 0;
- m_dataLength = 0;
- emit dataLengthChanged(0);
- resetAudioDevices();
-}
-
-bool Engine::initialize()
-{
- bool result = false;
-
- QAudioFormat format = m_format;
-
- if (selectFormat()) {
- if (m_format != format) {
- resetAudioDevices();
- if (m_file) {
- emit bufferLengthChanged(bufferLength());
- emit dataLengthChanged(dataLength());
- emit bufferChanged(0, 0, m_buffer);
- setRecordPosition(bufferLength());
- result = true;
- } else {
- m_bufferLength = audioLength(m_format, BufferDurationUs);
- m_buffer.resize(m_bufferLength);
- m_buffer.fill(0);
- emit bufferLengthChanged(bufferLength());
- if (m_generateTone) {
- if (0 == m_tone.endFreq) {
- const qreal nyquist = nyquistFrequency(m_format);
- m_tone.endFreq = qMin(qreal(SpectrumHighFreq), nyquist);
- }
- // Call function defined in utils.h, at global scope
- ::generateTone(m_tone, m_format, m_buffer);
- m_dataLength = m_bufferLength;
- emit dataLengthChanged(dataLength());
- emit bufferChanged(0, m_dataLength, m_buffer);
- setRecordPosition(m_bufferLength);
- result = true;
- } else {
- emit bufferChanged(0, 0, m_buffer);
- m_audioInput = new QAudioInput(m_audioInputDevice, m_format, this);
- m_audioInput->setNotifyInterval(NotifyIntervalMs);
- result = true;
- }
- }
- m_audioOutput = new QAudioOutput(m_audioOutputDevice, m_format, this);
- m_audioOutput->setNotifyInterval(NotifyIntervalMs);
- }
- } else {
- if (m_file)
- emit errorMessage(tr("Audio format not supported"),
- formatToString(m_format));
- else if (m_generateTone)
- emit errorMessage(tr("No suitable format found"), "");
- else
- emit errorMessage(tr("No common input / output format found"), "");
- }
-
- ENGINE_DEBUG << "Engine::initialize" << "m_bufferLength" << m_bufferLength;
- ENGINE_DEBUG << "Engine::initialize" << "m_dataLength" << m_dataLength;
- ENGINE_DEBUG << "Engine::initialize" << "format" << m_format;
-
- return result;
-}
-
-bool Engine::selectFormat()
-{
- bool foundSupportedFormat = false;
-
- if (m_file || QAudioFormat() != m_format) {
- QAudioFormat format = m_format;
- if (m_file)
- // Header is read from the WAV file; just need to check whether
- // it is supported by the audio output device
- format = m_file->fileFormat();
- if (m_audioOutputDevice.isFormatSupported(format)) {
- setFormat(format);
- foundSupportedFormat = true;
- }
- } else {
-
- QList<int> frequenciesList;
- #ifdef Q_OS_WIN
- // The Windows audio backend does not correctly report format support
- // (see QTBUG-9100). Furthermore, although the audio subsystem captures
- // at 11025Hz, the resulting audio is corrupted.
- frequenciesList += 8000;
- #endif
-
- if (!m_generateTone)
- frequenciesList += m_audioInputDevice.supportedFrequencies();
-
- frequenciesList += m_audioOutputDevice.supportedFrequencies();
- frequenciesList = frequenciesList.toSet().toList(); // remove duplicates
- qSort(frequenciesList);
- ENGINE_DEBUG << "Engine::initialize frequenciesList" << frequenciesList;
-
- QList<int> channelsList;
- channelsList += m_audioInputDevice.supportedChannels();
- channelsList += m_audioOutputDevice.supportedChannels();
- channelsList = channelsList.toSet().toList();
- qSort(channelsList);
- ENGINE_DEBUG << "Engine::initialize channelsList" << channelsList;
-
- QAudioFormat format;
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setCodec("audio/pcm");
- format.setSampleSize(16);
- format.setSampleType(QAudioFormat::SignedInt);
- int frequency, channels;
- foreach (frequency, frequenciesList) {
- if (foundSupportedFormat)
- break;
- format.setFrequency(frequency);
- foreach (channels, channelsList) {
- format.setChannels(channels);
- const bool inputSupport = m_generateTone ||
- m_audioInputDevice.isFormatSupported(format);
- const bool outputSupport = m_audioOutputDevice.isFormatSupported(format);
- ENGINE_DEBUG << "Engine::initialize checking " << format
- << "input" << inputSupport
- << "output" << outputSupport;
- if (inputSupport && outputSupport) {
- foundSupportedFormat = true;
- break;
- }
- }
- }
-
- if (!foundSupportedFormat)
- format = QAudioFormat();
-
- setFormat(format);
- }
-
- return foundSupportedFormat;
-}
-
-void Engine::stopRecording()
-{
- if (m_audioInput) {
- m_audioInput->stop();
- QCoreApplication::instance()->processEvents();
- m_audioInput->disconnect();
- }
- m_audioInputIODevice = 0;
-
-#ifdef DUMP_AUDIO
- dumpData();
-#endif
-}
-
-void Engine::stopPlayback()
-{
- if (m_audioOutput) {
- m_audioOutput->stop();
- QCoreApplication::instance()->processEvents();
- m_audioOutput->disconnect();
- setPlayPosition(0);
- }
-}
-
-void Engine::setState(QAudio::State state)
-{
- const bool changed = (m_state != state);
- m_state = state;
- if (changed)
- emit stateChanged(m_mode, m_state);
-}
-
-void Engine::setState(QAudio::Mode mode, QAudio::State state)
-{
- const bool changed = (m_mode != mode || m_state != state);
- m_mode = mode;
- m_state = state;
- if (changed)
- emit stateChanged(m_mode, m_state);
-}
-
-void Engine::setRecordPosition(qint64 position, bool forceEmit)
-{
- const bool changed = (m_recordPosition != position);
- m_recordPosition = position;
- if (changed || forceEmit)
- emit recordPositionChanged(m_recordPosition);
-}
-
-void Engine::setPlayPosition(qint64 position, bool forceEmit)
-{
- const bool changed = (m_playPosition != position);
- m_playPosition = position;
- if (changed || forceEmit)
- emit playPositionChanged(m_playPosition);
-}
-
-void Engine::calculateLevel(qint64 position, qint64 length)
-{
-#ifdef DISABLE_LEVEL
- Q_UNUSED(position)
- Q_UNUSED(length)
-#else
- Q_ASSERT(position + length <= m_bufferPosition + m_dataLength);
-
- qreal peakLevel = 0.0;
-
- qreal sum = 0.0;
- const char *ptr = m_buffer.constData() + position - m_bufferPosition;
- const char *const end = ptr + length;
- while (ptr < end) {
- const qint16 value = *reinterpret_cast<const qint16*>(ptr);
- const qreal fracValue = pcmToReal(value);
- peakLevel = qMax(peakLevel, fracValue);
- sum += fracValue * fracValue;
- ptr += 2;
- }
- const int numSamples = length / 2;
- qreal rmsLevel = sqrt(sum / numSamples);
-
- rmsLevel = qMax(qreal(0.0), rmsLevel);
- rmsLevel = qMin(qreal(1.0), rmsLevel);
- setLevel(rmsLevel, peakLevel, numSamples);
-
- ENGINE_DEBUG << "Engine::calculateLevel" << "pos" << position << "len" << length
- << "rms" << rmsLevel << "peak" << peakLevel;
-#endif
-}
-
-void Engine::calculateSpectrum(qint64 position)
-{
-#ifdef DISABLE_SPECTRUM
- Q_UNUSED(position)
-#else
- Q_ASSERT(position + m_spectrumBufferLength <= m_bufferPosition + m_dataLength);
- Q_ASSERT(0 == m_spectrumBufferLength % 2); // constraint of FFT algorithm
-
- // QThread::currentThread is marked 'for internal use only', but
- // we're only using it for debug output here, so it's probably OK :)
- ENGINE_DEBUG << "Engine::calculateSpectrum" << QThread::currentThread()
- << "count" << m_count << "pos" << position << "len" << m_spectrumBufferLength
- << "spectrumAnalyser.isReady" << m_spectrumAnalyser.isReady();
-
- if (m_spectrumAnalyser.isReady()) {
- m_spectrumBuffer = QByteArray::fromRawData(m_buffer.constData() + position - m_bufferPosition,
- m_spectrumBufferLength);
- m_spectrumPosition = position;
- m_spectrumAnalyser.calculate(m_spectrumBuffer, m_format);
- }
-#endif
-}
-
-void Engine::setFormat(const QAudioFormat &format)
-{
- const bool changed = (format != m_format);
- m_format = format;
- m_levelBufferLength = audioLength(m_format, LevelWindowUs);
- m_spectrumBufferLength = SpectrumLengthSamples *
- (m_format.sampleSize() / 8) * m_format.channels();
- if (changed)
- emit formatChanged(m_format);
-}
-
-void Engine::setLevel(qreal rmsLevel, qreal peakLevel, int numSamples)
-{
- m_rmsLevel = rmsLevel;
- m_peakLevel = peakLevel;
- emit levelChanged(m_rmsLevel, m_peakLevel, numSamples);
-}
-
-#ifdef DUMP_DATA
-void Engine::createOutputDir()
-{
- m_outputDir.setPath("output");
-
- // Ensure output directory exists and is empty
- if (m_outputDir.exists()) {
- const QStringList files = m_outputDir.entryList(QDir::Files);
- QString file;
- foreach (file, files)
- m_outputDir.remove(file);
- } else {
- QDir::current().mkdir("output");
- }
-}
-#endif // DUMP_DATA
-
-#ifdef DUMP_AUDIO
-void Engine::dumpData()
-{
- const QString txtFileName = m_outputDir.filePath("data.txt");
- QFile txtFile(txtFileName);
- txtFile.open(QFile::WriteOnly | QFile::Text);
- QTextStream stream(&txtFile);
- const qint16 *ptr = reinterpret_cast<const qint16*>(m_buffer.constData());
- const int numSamples = m_dataLength / (2 * m_format.channels());
- for (int i=0; i<numSamples; ++i) {
- stream << i << "\t" << *ptr << "\n";
- ptr += m_format.channels();
- }
-
- const QString pcmFileName = m_outputDir.filePath("data.pcm");
- QFile pcmFile(pcmFileName);
- pcmFile.open(QFile::WriteOnly);
- pcmFile.write(m_buffer.constData(), m_dataLength);
-}
-#endif // DUMP_AUDIO
diff --git a/examples/spectrum/app/engine.h b/examples/spectrum/app/engine.h
deleted file mode 100644
index 51c63b3..0000000
--- a/examples/spectrum/app/engine.h
+++ /dev/null
@@ -1,315 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ENGINE_H
-#define ENGINE_H
-
-#include "spectrum.h"
-#include "spectrumanalyser.h"
-#include "wavfile.h"
-
-#include <QObject>
-#include <QByteArray>
-#include <QBuffer>
-#include <QVector>
-#include <QtMultimedia/QAudioDeviceInfo>
-#include <QtMultimedia/QAudioFormat>
-
-#ifdef DUMP_CAPTURED_AUDIO
-#define DUMP_DATA
-#endif
-
-#ifdef DUMP_SPECTRUM
-#define DUMP_DATA
-#endif
-
-#ifdef DUMP_DATA
-#include <QDir>
-#endif
-
-class FrequencySpectrum;
-QT_FORWARD_DECLARE_CLASS(QAudioInput)
-QT_FORWARD_DECLARE_CLASS(QAudioOutput)
-QT_FORWARD_DECLARE_CLASS(QFile)
-
-/**
- * This class interfaces with the QtMultimedia audio classes, and also with
- * the SpectrumAnalyser class. Its role is to manage the capture and playback
- * of audio data, meanwhile performing real-time analysis of the audio level
- * and frequency spectrum.
- */
-class Engine : public QObject {
- Q_OBJECT
-public:
- Engine(QObject *parent = 0);
- ~Engine();
-
- const QList<QAudioDeviceInfo>& availableAudioInputDevices() const
- { return m_availableAudioInputDevices; }
-
- const QList<QAudioDeviceInfo>& availableAudioOutputDevices() const
- { return m_availableAudioOutputDevices; }
-
- QAudio::Mode mode() const { return m_mode; }
- QAudio::State state() const { return m_state; }
-
- /**
- * \return Current audio format
- * \note May be QAudioFormat() if engine is not initialized
- */
- const QAudioFormat& format() const { return m_format; }
-
- /**
- * Stop any ongoing recording or playback, and reset to ground state.
- */
- void reset();
-
- /**
- * Load data from WAV file
- */
- bool loadFile(const QString &fileName);
-
- /**
- * Generate tone
- */
- bool generateTone(const Tone &tone);
-
- /**
- * Generate tone
- */
- bool generateSweptTone(qreal amplitude);
-
- /**
- * Initialize for recording
- */
- bool initializeRecord();
-
- /**
- * Position of the audio input device.
- * \return Position in bytes.
- */
- qint64 recordPosition() const { return m_recordPosition; }
-
- /**
- * RMS level of the most recently processed set of audio samples.
- * \return Level in range (0.0, 1.0)
- */
- qreal rmsLevel() const { return m_rmsLevel; }
-
- /**
- * Peak level of the most recently processed set of audio samples.
- * \return Level in range (0.0, 1.0)
- */
- qreal peakLevel() const { return m_peakLevel; }
-
- /**
- * Position of the audio output device.
- * \return Position in bytes.
- */
- qint64 playPosition() const { return m_playPosition; }
-
- /**
- * Length of the internal engine buffer.
- * \return Buffer length in bytes.
- */
- qint64 bufferLength() const;
-
- /**
- * Amount of data held in the buffer.
- * \return Data length in bytes.
- */
- qint64 dataLength() const { return m_dataLength; }
-
- /**
- * Set window function applied to audio data before spectral analysis.
- */
- void setWindowFunction(WindowFunction type);
-
-public slots:
- void startRecording();
- void startPlayback();
- void suspend();
- void setAudioInputDevice(const QAudioDeviceInfo &device);
- void setAudioOutputDevice(const QAudioDeviceInfo &device);
-
-signals:
- void stateChanged(QAudio::Mode mode, QAudio::State state);
-
- /**
- * Informational message for non-modal display
- */
- void infoMessage(const QString &message, int durationMs);
-
- /**
- * Error message for modal display
- */
- void errorMessage(const QString &heading, const QString &detail);
-
- /**
- * Format of audio data has changed
- */
- void formatChanged(const QAudioFormat &format);
-
- /**
- * Length of buffer has changed.
- * \param duration Duration in microseconds
- */
- void bufferLengthChanged(qint64 duration);
-
- /**
- * Amount of data in buffer has changed.
- * \param Length of data in bytes
- */
- void dataLengthChanged(qint64 duration);
-
- /**
- * Position of the audio input device has changed.
- * \param position Position in bytes
- */
- void recordPositionChanged(qint64 position);
-
- /**
- * Position of the audio output device has changed.
- * \param position Position in bytes
- */
- void playPositionChanged(qint64 position);
-
- /**
- * Level changed
- * \param rmsLevel RMS level in range 0.0 - 1.0
- * \param peakLevel Peak level in range 0.0 - 1.0
- * \param numSamples Number of audio samples analyzed
- */
- void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples);
-
- /**
- * Spectrum has changed.
- * \param position Position of start of window in bytes
- * \param length Length of window in bytes
- * \param spectrum Resulting frequency spectrum
- */
- void spectrumChanged(qint64 position, qint64 length, const FrequencySpectrum &spectrum);
-
- /**
- * Buffer containing audio data has changed.
- * \param position Position of start of buffer in bytes
- * \param buffer Buffer
- */
- void bufferChanged(qint64 position, qint64 length, const QByteArray &buffer);
-
-private slots:
- void audioNotify();
- void audioStateChanged(QAudio::State state);
- void audioDataReady();
- void spectrumChanged(const FrequencySpectrum &spectrum);
-
-private:
- void resetAudioDevices();
- bool initialize();
- bool selectFormat();
- void stopRecording();
- void stopPlayback();
- void setState(QAudio::State state);
- void setState(QAudio::Mode mode, QAudio::State state);
- void setFormat(const QAudioFormat &format);
- void setRecordPosition(qint64 position, bool forceEmit = false);
- void setPlayPosition(qint64 position, bool forceEmit = false);
- void calculateLevel(qint64 position, qint64 length);
- void calculateSpectrum(qint64 position);
- void setLevel(qreal rmsLevel, qreal peakLevel, int numSamples);
-
-#ifdef DUMP_DATA
- void createOutputDir();
- QString outputPath() const { return m_outputDir.path(); }
-#endif
-
-#ifdef DUMP_CAPTURED_AUDIO
- void dumpData();
-#endif
-
-private:
- QAudio::Mode m_mode;
- QAudio::State m_state;
-
- bool m_generateTone;
- SweptTone m_tone;
-
- WavFile* m_file;
- // We need a second file handle via which to read data into m_buffer
- // for analysis
- WavFile* m_analysisFile;
-
- QAudioFormat m_format;
-
- const QList<QAudioDeviceInfo> m_availableAudioInputDevices;
- QAudioDeviceInfo m_audioInputDevice;
- QAudioInput* m_audioInput;
- QIODevice* m_audioInputIODevice;
- qint64 m_recordPosition;
-
- const QList<QAudioDeviceInfo> m_availableAudioOutputDevices;
- QAudioDeviceInfo m_audioOutputDevice;
- QAudioOutput* m_audioOutput;
- qint64 m_playPosition;
- QBuffer m_audioOutputIODevice;
-
- QByteArray m_buffer;
- qint64 m_bufferPosition;
- qint64 m_bufferLength;
- qint64 m_dataLength;
-
- int m_levelBufferLength;
- qreal m_rmsLevel;
- qreal m_peakLevel;
-
- int m_spectrumBufferLength;
- QByteArray m_spectrumBuffer;
- SpectrumAnalyser m_spectrumAnalyser;
- qint64 m_spectrumPosition;
-
- int m_count;
-
-#ifdef DUMP_DATA
- QDir m_outputDir;
-#endif
-
-};
-
-#endif // ENGINE_H
diff --git a/examples/spectrum/app/frequencyspectrum.cpp b/examples/spectrum/app/frequencyspectrum.cpp
deleted file mode 100644
index b4a4843..0000000
--- a/examples/spectrum/app/frequencyspectrum.cpp
+++ /dev/null
@@ -1,89 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "frequencyspectrum.h"
-
-FrequencySpectrum::FrequencySpectrum(int numPoints)
- : m_elements(numPoints)
-{
-
-}
-
-void FrequencySpectrum::reset()
-{
- iterator i = begin();
- for ( ; i != end(); ++i)
- *i = Element();
-}
-
-int FrequencySpectrum::count() const
-{
- return m_elements.count();
-}
-
-FrequencySpectrum::Element& FrequencySpectrum::operator[](int index)
-{
- return m_elements[index];
-}
-
-const FrequencySpectrum::Element& FrequencySpectrum::operator[](int index) const
-{
- return m_elements[index];
-}
-
-FrequencySpectrum::iterator FrequencySpectrum::begin()
-{
- return m_elements.begin();
-}
-
-FrequencySpectrum::iterator FrequencySpectrum::end()
-{
- return m_elements.end();
-}
-
-FrequencySpectrum::const_iterator FrequencySpectrum::begin() const
-{
- return m_elements.begin();
-}
-
-FrequencySpectrum::const_iterator FrequencySpectrum::end() const
-{
- return m_elements.end();
-}
diff --git a/examples/spectrum/app/frequencyspectrum.h b/examples/spectrum/app/frequencyspectrum.h
deleted file mode 100644
index 8b2acf2..0000000
--- a/examples/spectrum/app/frequencyspectrum.h
+++ /dev/null
@@ -1,98 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef FREQUENCYSPECTRUM_H
-#define FREQUENCYSPECTRUM_H
-
-#include <QtCore/QVector>
-
-/**
- * Represents a frequency spectrum as a series of elements, each of which
- * consists of a frequency, an amplitude and a phase.
- */
-class FrequencySpectrum {
-public:
- FrequencySpectrum(int numPoints = 0);
-
- struct Element {
- Element()
- : frequency(0.0), amplitude(0.0), phase(0.0), clipped(false)
- { }
-
- /**
- * Frequency in Hertz
- */
- qreal frequency;
-
- /**
- * Amplitude in range [0.0, 1.0]
- */
- qreal amplitude;
-
- /**
- * Phase in range [0.0, 2*PI]
- */
- qreal phase;
-
- /**
- * Indicates whether value has been clipped during spectrum analysis
- */
- bool clipped;
- };
-
- typedef QVector<Element>::iterator iterator;
- typedef QVector<Element>::const_iterator const_iterator;
-
- void reset();
-
- int count() const;
- Element& operator[](int index);
- const Element& operator[](int index) const;
- iterator begin();
- iterator end();
- const_iterator begin() const;
- const_iterator end() const;
-
-private:
- QVector<Element> m_elements;
-
-};
-
-#endif // FREQUENCYSPECTRUM_H
diff --git a/examples/spectrum/app/images/record.png b/examples/spectrum/app/images/record.png
deleted file mode 100644
index e7493aa..0000000
--- a/examples/spectrum/app/images/record.png
+++ /dev/null
Binary files differ
diff --git a/examples/spectrum/app/images/settings.png b/examples/spectrum/app/images/settings.png
deleted file mode 100644
index 12179dc..0000000
--- a/examples/spectrum/app/images/settings.png
+++ /dev/null
Binary files differ
diff --git a/examples/spectrum/app/levelmeter.cpp b/examples/spectrum/app/levelmeter.cpp
deleted file mode 100644
index 35dd388..0000000
--- a/examples/spectrum/app/levelmeter.cpp
+++ /dev/null
@@ -1,142 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "levelmeter.h"
-
-#include <math.h>
-
-#include <QPainter>
-#include <QTimer>
-#include <QDebug>
-
-
-// Constants
-const int RedrawInterval = 100; // ms
-const qreal PeakDecayRate = 0.001;
-const int PeakHoldLevelDuration = 2000; // ms
-
-
-LevelMeter::LevelMeter(QWidget *parent)
- : QWidget(parent)
- , m_rmsLevel(0.0)
- , m_peakLevel(0.0)
- , m_decayedPeakLevel(0.0)
- , m_peakDecayRate(PeakDecayRate)
- , m_peakHoldLevel(0.0)
- , m_redrawTimer(new QTimer(this))
- , m_rmsColor(Qt::red)
- , m_peakColor(255, 200, 200, 255)
-{
- setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
- setMinimumWidth(30);
-
- connect(m_redrawTimer, SIGNAL(timeout()), this, SLOT(redrawTimerExpired()));
- m_redrawTimer->start(RedrawInterval);
-}
-
-LevelMeter::~LevelMeter()
-{
-
-}
-
-void LevelMeter::reset()
-{
- m_rmsLevel = 0.0;
- m_peakLevel = 0.0;
- update();
-}
-
-void LevelMeter::levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples)
-{
- // Smooth the RMS signal
- const qreal smooth = pow(qreal(0.9), static_cast<qreal>(numSamples) / 256); // TODO: remove this magic number
- m_rmsLevel = (m_rmsLevel * smooth) + (rmsLevel * (1.0 - smooth));
-
- if (peakLevel > m_decayedPeakLevel) {
- m_peakLevel = peakLevel;
- m_decayedPeakLevel = peakLevel;
- m_peakLevelChanged.start();
- }
-
- if (peakLevel > m_peakHoldLevel) {
- m_peakHoldLevel = peakLevel;
- m_peakHoldLevelChanged.start();
- }
-
- update();
-}
-
-void LevelMeter::redrawTimerExpired()
-{
- // Decay the peak signal
- const int elapsedMs = m_peakLevelChanged.elapsed();
- const qreal decayAmount = m_peakDecayRate * elapsedMs;
- if (decayAmount < m_peakLevel)
- m_decayedPeakLevel = m_peakLevel - decayAmount;
- else
- m_decayedPeakLevel = 0.0;
-
- // Check whether to clear the peak hold level
- if (m_peakHoldLevelChanged.elapsed() > PeakHoldLevelDuration)
- m_peakHoldLevel = 0.0;
-
- update();
-}
-
-void LevelMeter::paintEvent(QPaintEvent *event)
-{
- Q_UNUSED(event)
-
- QPainter painter(this);
- painter.fillRect(rect(), Qt::black);
-
- QRect bar = rect();
-
- bar.setTop(rect().top() + (1.0 - m_peakHoldLevel) * rect().height());
- bar.setBottom(bar.top() + 5);
- painter.fillRect(bar, m_rmsColor);
- bar.setBottom(rect().bottom());
-
- bar.setTop(rect().top() + (1.0 - m_decayedPeakLevel) * rect().height());
- painter.fillRect(bar, m_peakColor);
-
- bar.setTop(rect().top() + (1.0 - m_rmsLevel) * rect().height());
- painter.fillRect(bar, m_rmsColor);
-}
diff --git a/examples/spectrum/app/levelmeter.h b/examples/spectrum/app/levelmeter.h
deleted file mode 100644
index 79aa124..0000000
--- a/examples/spectrum/app/levelmeter.h
+++ /dev/null
@@ -1,116 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LEVELMETER_H
-#define LEVELMETER_H
-
-#include <QTime>
-#include <QWidget>
-
-/**
- * Widget which displays a vertical audio level meter, indicating the
- * RMS and peak levels of the window of audio samples most recently analyzed
- * by the Engine.
- */
-class LevelMeter : public QWidget {
- Q_OBJECT
-public:
- LevelMeter(QWidget *parent = 0);
- ~LevelMeter();
-
- void paintEvent(QPaintEvent *event);
-
-public slots:
- void reset();
- void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples);
-
-private slots:
- void redrawTimerExpired();
-
-private:
- /**
- * Height of RMS level bar.
- * Range 0.0 - 1.0.
- */
- qreal m_rmsLevel;
-
- /**
- * Most recent peak level.
- * Range 0.0 - 1.0.
- */
- qreal m_peakLevel;
-
- /**
- * Height of peak level bar.
- * This is calculated by decaying m_peakLevel depending on the
- * elapsed time since m_peakLevelChanged, and the value of m_decayRate.
- */
- qreal m_decayedPeakLevel;
-
- /**
- * Time at which m_peakLevel was last changed.
- */
- QTime m_peakLevelChanged;
-
- /**
- * Rate at which peak level bar decays.
- * Expressed in level units / millisecond.
- */
- qreal m_peakDecayRate;
-
- /**
- * High watermark of peak level.
- * Range 0.0 - 1.0.
- */
- qreal m_peakHoldLevel;
-
- /**
- * Time at which m_peakHoldLevel was last changed.
- */
- QTime m_peakHoldLevelChanged;
-
- QTimer *m_redrawTimer;
-
- QColor m_rmsColor;
- QColor m_peakColor;
-
-};
-
-#endif // LEVELMETER_H
diff --git a/examples/spectrum/app/main.cpp b/examples/spectrum/app/main.cpp
deleted file mode 100644
index c776499..0000000
--- a/examples/spectrum/app/main.cpp
+++ /dev/null
@@ -1,53 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets/QApplication>
-#include "mainwidget.h"
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- app.setApplicationName("QtMultimedia spectrum analyzer");
- MainWidget w;
-
- w.show();
-
- return app.exec();
-}
diff --git a/examples/spectrum/app/mainwidget.cpp b/examples/spectrum/app/mainwidget.cpp
deleted file mode 100644
index b5cf66e..0000000
--- a/examples/spectrum/app/mainwidget.cpp
+++ /dev/null
@@ -1,448 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "engine.h"
-#include "levelmeter.h"
-#include "mainwidget.h"
-#include "waveform.h"
-#include "progressbar.h"
-#include "settingsdialog.h"
-#include "spectrograph.h"
-#include "tonegeneratordialog.h"
-#include "utils.h"
-
-#include <QLabel>
-#include <QPushButton>
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QStyle>
-#include <QMenu>
-#include <QFileDialog>
-#include <QTimerEvent>
-#include <QMessageBox>
-
-const int NullTimerId = -1;
-
-MainWidget::MainWidget(QWidget *parent)
- : QWidget(parent)
- , m_mode(NoMode)
- , m_engine(new Engine(this))
-#ifndef DISABLE_WAVEFORM
- , m_waveform(new Waveform(this))
-#endif
- , m_progressBar(new ProgressBar(this))
- , m_spectrograph(new Spectrograph(this))
- , m_levelMeter(new LevelMeter(this))
- , m_modeButton(new QPushButton(this))
- , m_recordButton(new QPushButton(this))
- , m_pauseButton(new QPushButton(this))
- , m_playButton(new QPushButton(this))
- , m_settingsButton(new QPushButton(this))
- , m_infoMessage(new QLabel(tr("Select a mode to begin"), this))
- , m_infoMessageTimerId(NullTimerId)
- , m_settingsDialog(new SettingsDialog(
- m_engine->availableAudioInputDevices(),
- m_engine->availableAudioOutputDevices(),
- this))
- , m_toneGeneratorDialog(new ToneGeneratorDialog(this))
- , m_modeMenu(new QMenu(this))
- , m_loadFileAction(0)
- , m_generateToneAction(0)
- , m_recordAction(0)
-{
- m_spectrograph->setParams(SpectrumNumBands, SpectrumLowFreq, SpectrumHighFreq);
-
- createUi();
- connectUi();
-}
-
-MainWidget::~MainWidget()
-{
-
-}
-
-
-//-----------------------------------------------------------------------------
-// Public slots
-//-----------------------------------------------------------------------------
-
-void MainWidget::stateChanged(QAudio::Mode mode, QAudio::State state)
-{
- Q_UNUSED(mode);
-
- updateButtonStates();
-
- if (QAudio::ActiveState != state && QAudio::SuspendedState != state) {
- m_levelMeter->reset();
- m_spectrograph->reset();
- }
-}
-
-void MainWidget::formatChanged(const QAudioFormat &format)
-{
- infoMessage(formatToString(format), NullMessageTimeout);
-
-#ifndef DISABLE_WAVEFORM
- if (QAudioFormat() != format) {
- m_waveform->initialize(format, WaveformTileLength,
- WaveformWindowDuration);
- }
-#endif
-}
-
-void MainWidget::spectrumChanged(qint64 position, qint64 length,
- const FrequencySpectrum &spectrum)
-{
- m_progressBar->windowChanged(position, length);
- m_spectrograph->spectrumChanged(spectrum);
-}
-
-void MainWidget::infoMessage(const QString &message, int timeoutMs)
-{
- m_infoMessage->setText(message);
-
- if (NullTimerId != m_infoMessageTimerId) {
- killTimer(m_infoMessageTimerId);
- m_infoMessageTimerId = NullTimerId;
- }
-
- if (NullMessageTimeout != timeoutMs)
- m_infoMessageTimerId = startTimer(timeoutMs);
-}
-
-void MainWidget::errorMessage(const QString &heading, const QString &detail)
-{
- QMessageBox::warning(this, heading, detail, QMessageBox::Close);
-}
-
-void MainWidget::timerEvent(QTimerEvent *event)
-{
- Q_ASSERT(event->timerId() == m_infoMessageTimerId);
- Q_UNUSED(event) // suppress warnings in release builds
- killTimer(m_infoMessageTimerId);
- m_infoMessageTimerId = NullTimerId;
- m_infoMessage->setText("");
-}
-
-void MainWidget::audioPositionChanged(qint64 position)
-{
-#ifndef DISABLE_WAVEFORM
- m_waveform->audioPositionChanged(position);
-#else
- Q_UNUSED(position)
-#endif
-}
-
-void MainWidget::bufferLengthChanged(qint64 length)
-{
- m_progressBar->bufferLengthChanged(length);
-}
-
-
-//-----------------------------------------------------------------------------
-// Private slots
-//-----------------------------------------------------------------------------
-
-void MainWidget::showFileDialog()
-{
- const QString dir;
- const QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open WAV file"), dir, "*.wav");
- if (fileNames.count()) {
- reset();
- setMode(LoadFileMode);
- m_engine->loadFile(fileNames.front());
- updateButtonStates();
- } else {
- updateModeMenu();
- }
-}
-
-void MainWidget::showSettingsDialog()
-{
- m_settingsDialog->exec();
- if (m_settingsDialog->result() == QDialog::Accepted) {
- m_engine->setAudioInputDevice(m_settingsDialog->inputDevice());
- m_engine->setAudioOutputDevice(m_settingsDialog->outputDevice());
- m_engine->setWindowFunction(m_settingsDialog->windowFunction());
- }
-}
-
-void MainWidget::showToneGeneratorDialog()
-{
- m_toneGeneratorDialog->exec();
- if (m_toneGeneratorDialog->result() == QDialog::Accepted) {
- reset();
- setMode(GenerateToneMode);
- const qreal amplitude = m_toneGeneratorDialog->amplitude();
- if (m_toneGeneratorDialog->isFrequencySweepEnabled()) {
- m_engine->generateSweptTone(amplitude);
- } else {
- const qreal frequency = m_toneGeneratorDialog->frequency();
- const Tone tone(frequency, amplitude);
- m_engine->generateTone(tone);
- updateButtonStates();
- }
- } else {
- updateModeMenu();
- }
-}
-
-void MainWidget::initializeRecord()
-{
- reset();
- setMode(RecordMode);
- if (m_engine->initializeRecord())
- updateButtonStates();
-}
-
-
-//-----------------------------------------------------------------------------
-// Private functions
-//-----------------------------------------------------------------------------
-
-void MainWidget::createUi()
-{
- createMenus();
-
- setWindowTitle(tr("Spectrum Analyser"));
-
- QVBoxLayout *windowLayout = new QVBoxLayout(this);
-
- m_infoMessage->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
- m_infoMessage->setAlignment(Qt::AlignHCenter);
- windowLayout->addWidget(m_infoMessage);
-
-#ifdef SUPERIMPOSE_PROGRESS_ON_WAVEFORM
- QScopedPointer<QHBoxLayout> waveformLayout(new QHBoxLayout);
- waveformLayout->addWidget(m_progressBar);
- m_progressBar->setMinimumHeight(m_waveform->minimumHeight());
- waveformLayout->setMargin(0);
- m_waveform->setLayout(waveformLayout.data());
- waveformLayout.take();
- windowLayout->addWidget(m_waveform);
-#else
-#ifndef DISABLE_WAVEFORM
- windowLayout->addWidget(m_waveform);
-#endif // DISABLE_WAVEFORM
- windowLayout->addWidget(m_progressBar);
-#endif // SUPERIMPOSE_PROGRESS_ON_WAVEFORM
-
- // Spectrograph and level meter
-
- QScopedPointer<QHBoxLayout> analysisLayout(new QHBoxLayout);
- analysisLayout->addWidget(m_spectrograph);
- analysisLayout->addWidget(m_levelMeter);
- windowLayout->addLayout(analysisLayout.data());
- analysisLayout.take();
-
- // Button panel
-
- const QSize buttonSize(30, 30);
-
- m_modeButton->setText(tr("Mode"));
-
- m_recordIcon = QIcon(":/images/record.png");
- m_recordButton->setIcon(m_recordIcon);
- m_recordButton->setEnabled(false);
- m_recordButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- m_recordButton->setMinimumSize(buttonSize);
-
- m_pauseIcon = style()->standardIcon(QStyle::SP_MediaPause);
- m_pauseButton->setIcon(m_pauseIcon);
- m_pauseButton->setEnabled(false);
- m_pauseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- m_pauseButton->setMinimumSize(buttonSize);
-
- m_playIcon = style()->standardIcon(QStyle::SP_MediaPlay);
- m_playButton->setIcon(m_playIcon);
- m_playButton->setEnabled(false);
- m_playButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- m_playButton->setMinimumSize(buttonSize);
-
- m_settingsIcon = QIcon(":/images/settings.png");
- m_settingsButton->setIcon(m_settingsIcon);
- m_settingsButton->setEnabled(true);
- m_settingsButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- m_settingsButton->setMinimumSize(buttonSize);
-
- QScopedPointer<QHBoxLayout> buttonPanelLayout(new QHBoxLayout);
- buttonPanelLayout->addStretch();
- buttonPanelLayout->addWidget(m_modeButton);
- buttonPanelLayout->addWidget(m_recordButton);
- buttonPanelLayout->addWidget(m_pauseButton);
- buttonPanelLayout->addWidget(m_playButton);
- buttonPanelLayout->addWidget(m_settingsButton);
-
- QWidget *buttonPanel = new QWidget(this);
- buttonPanel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- buttonPanel->setLayout(buttonPanelLayout.data());
- buttonPanelLayout.take(); // ownership transferred to buttonPanel
-
- QScopedPointer<QHBoxLayout> bottomPaneLayout(new QHBoxLayout);
- bottomPaneLayout->addWidget(buttonPanel);
- windowLayout->addLayout(bottomPaneLayout.data());
- bottomPaneLayout.take(); // ownership transferred to windowLayout
-
- // Apply layout
-
- setLayout(windowLayout);
-}
-
-void MainWidget::connectUi()
-{
- CHECKED_CONNECT(m_recordButton, SIGNAL(clicked()),
- m_engine, SLOT(startRecording()));
-
- CHECKED_CONNECT(m_pauseButton, SIGNAL(clicked()),
- m_engine, SLOT(suspend()));
-
- CHECKED_CONNECT(m_playButton, SIGNAL(clicked()),
- m_engine, SLOT(startPlayback()));
-
- CHECKED_CONNECT(m_settingsButton, SIGNAL(clicked()),
- this, SLOT(showSettingsDialog()));
-
- CHECKED_CONNECT(m_engine, SIGNAL(stateChanged(QAudio::Mode,QAudio::State)),
- this, SLOT(stateChanged(QAudio::Mode,QAudio::State)));
-
- CHECKED_CONNECT(m_engine, SIGNAL(formatChanged(const QAudioFormat &)),
- this, SLOT(formatChanged(const QAudioFormat &)));
-
- m_progressBar->bufferLengthChanged(m_engine->bufferLength());
-
- CHECKED_CONNECT(m_engine, SIGNAL(bufferLengthChanged(qint64)),
- this, SLOT(bufferLengthChanged(qint64)));
-
- CHECKED_CONNECT(m_engine, SIGNAL(dataLengthChanged(qint64)),
- this, SLOT(updateButtonStates()));
-
- CHECKED_CONNECT(m_engine, SIGNAL(recordPositionChanged(qint64)),
- m_progressBar, SLOT(recordPositionChanged(qint64)));
-
- CHECKED_CONNECT(m_engine, SIGNAL(playPositionChanged(qint64)),
- m_progressBar, SLOT(playPositionChanged(qint64)));
-
- CHECKED_CONNECT(m_engine, SIGNAL(recordPositionChanged(qint64)),
- this, SLOT(audioPositionChanged(qint64)));
-
- CHECKED_CONNECT(m_engine, SIGNAL(playPositionChanged(qint64)),
- this, SLOT(audioPositionChanged(qint64)));
-
- CHECKED_CONNECT(m_engine, SIGNAL(levelChanged(qreal, qreal, int)),
- m_levelMeter, SLOT(levelChanged(qreal, qreal, int)));
-
- CHECKED_CONNECT(m_engine, SIGNAL(spectrumChanged(qint64, qint64, const FrequencySpectrum &)),
- this, SLOT(spectrumChanged(qint64, qint64, const FrequencySpectrum &)));
-
- CHECKED_CONNECT(m_engine, SIGNAL(infoMessage(QString, int)),
- this, SLOT(infoMessage(QString, int)));
-
- CHECKED_CONNECT(m_engine, SIGNAL(errorMessage(QString, QString)),
- this, SLOT(errorMessage(QString, QString)));
-
- CHECKED_CONNECT(m_spectrograph, SIGNAL(infoMessage(QString, int)),
- this, SLOT(infoMessage(QString, int)));
-
-#ifndef DISABLE_WAVEFORM
- CHECKED_CONNECT(m_engine, SIGNAL(bufferChanged(qint64, qint64, const QByteArray &)),
- m_waveform, SLOT(bufferChanged(qint64, qint64, const QByteArray &)));
-#endif
-}
-
-void MainWidget::createMenus()
-{
- m_modeButton->setMenu(m_modeMenu);
-
- m_generateToneAction = m_modeMenu->addAction(tr("Play generated tone"));
- m_recordAction = m_modeMenu->addAction(tr("Record and play back"));
- m_loadFileAction = m_modeMenu->addAction(tr("Play file"));
-
- m_loadFileAction->setCheckable(true);
- m_generateToneAction->setCheckable(true);
- m_recordAction->setCheckable(true);
-
- connect(m_loadFileAction, SIGNAL(triggered(bool)), this, SLOT(showFileDialog()));
- connect(m_generateToneAction, SIGNAL(triggered(bool)), this, SLOT(showToneGeneratorDialog()));
- connect(m_recordAction, SIGNAL(triggered(bool)), this, SLOT(initializeRecord()));
-}
-
-void MainWidget::updateButtonStates()
-{
- const bool recordEnabled = ((QAudio::AudioOutput == m_engine->mode() ||
- (QAudio::ActiveState != m_engine->state() &&
- QAudio::IdleState != m_engine->state())) &&
- RecordMode == m_mode);
- m_recordButton->setEnabled(recordEnabled);
-
- const bool pauseEnabled = (QAudio::ActiveState == m_engine->state() ||
- QAudio::IdleState == m_engine->state());
- m_pauseButton->setEnabled(pauseEnabled);
-
- const bool playEnabled = (/*m_engine->dataLength() &&*/
- (QAudio::AudioOutput != m_engine->mode() ||
- (QAudio::ActiveState != m_engine->state() &&
- QAudio::IdleState != m_engine->state())));
- m_playButton->setEnabled(playEnabled);
-}
-
-void MainWidget::reset()
-{
-#ifndef DISABLE_WAVEFORM
- m_waveform->reset();
-#endif
- m_engine->reset();
- m_levelMeter->reset();
- m_spectrograph->reset();
- m_progressBar->reset();
-}
-
-void MainWidget::setMode(Mode mode)
-{
- m_mode = mode;
- updateModeMenu();
-}
-
-void MainWidget::updateModeMenu()
-{
- m_loadFileAction->setChecked(LoadFileMode == m_mode);
- m_generateToneAction->setChecked(GenerateToneMode == m_mode);
- m_recordAction->setChecked(RecordMode == m_mode);
-}
-
diff --git a/examples/spectrum/app/mainwidget.h b/examples/spectrum/app/mainwidget.h
deleted file mode 100644
index 14c62a2..0000000
--- a/examples/spectrum/app/mainwidget.h
+++ /dev/null
@@ -1,144 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MAINWIDGET_H
-#define MAINWIDGET_H
-
-#include <QWidget>
-#include <QIcon>
-#include <QtMultimedia/qaudio.h>
-
-class Engine;
-class FrequencySpectrum;
-class ProgressBar;
-class Spectrograph;
-class Waveform;
-class LevelMeter;
-class SettingsDialog;
-class ToneGeneratorDialog;
-
-QT_FORWARD_DECLARE_CLASS(QAudioFormat)
-QT_FORWARD_DECLARE_CLASS(QLabel)
-QT_FORWARD_DECLARE_CLASS(QPushButton)
-QT_FORWARD_DECLARE_CLASS(QMenu)
-QT_FORWARD_DECLARE_CLASS(QAction)
-
-/**
- * Main application widget, responsible for connecting the various UI
- * elements to the Engine.
- */
-class MainWidget : public QWidget {
- Q_OBJECT
-public:
- MainWidget(QWidget *parent = 0);
- ~MainWidget();
-
- // QObject
- void timerEvent(QTimerEvent *event);
-
-public slots:
- void stateChanged(QAudio::Mode mode, QAudio::State state);
- void formatChanged(const QAudioFormat &format);
- void spectrumChanged(qint64 position, qint64 length,
- const FrequencySpectrum &spectrum);
- void infoMessage(const QString &message, int timeoutMs);
- void errorMessage(const QString &heading, const QString &detail);
- void audioPositionChanged(qint64 position);
- void bufferLengthChanged(qint64 length);
-
-private slots:
- void showFileDialog();
- void showSettingsDialog();
- void showToneGeneratorDialog();
- void initializeRecord();
- void updateModeMenu();
- void updateButtonStates();
-
-private:
- void createUi();
- void createMenus();
- void connectUi();
- void reset();
-
- enum Mode {
- NoMode,
- RecordMode,
- GenerateToneMode,
- LoadFileMode
- };
-
- void setMode(Mode mode);
-
-private:
- Mode m_mode;
-
- Engine* m_engine;
-
-#ifndef DISABLE_WAVEFORM
- Waveform* m_waveform;
-#endif
- ProgressBar* m_progressBar;
- Spectrograph* m_spectrograph;
- LevelMeter* m_levelMeter;
-
- QPushButton* m_modeButton;
- QPushButton* m_recordButton;
- QIcon m_recordIcon;
- QPushButton* m_pauseButton;
- QIcon m_pauseIcon;
- QPushButton* m_playButton;
- QIcon m_playIcon;
- QPushButton* m_settingsButton;
- QIcon m_settingsIcon;
-
- QLabel* m_infoMessage;
- int m_infoMessageTimerId;
-
- SettingsDialog* m_settingsDialog;
- ToneGeneratorDialog* m_toneGeneratorDialog;
-
- QMenu* m_modeMenu;
- QAction* m_loadFileAction;
- QAction* m_generateToneAction;
- QAction* m_recordAction;
-
-};
-
-#endif // MAINWIDGET_H
diff --git a/examples/spectrum/app/progressbar.cpp b/examples/spectrum/app/progressbar.cpp
deleted file mode 100644
index 4660510..0000000
--- a/examples/spectrum/app/progressbar.cpp
+++ /dev/null
@@ -1,140 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "progressbar.h"
-#include "spectrum.h"
-#include <QPainter>
-
-ProgressBar::ProgressBar(QWidget *parent)
- : QWidget(parent)
- , m_bufferLength(0)
- , m_recordPosition(0)
- , m_playPosition(0)
- , m_windowPosition(0)
- , m_windowLength(0)
-{
- setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
- setMinimumHeight(30);
-#ifdef SUPERIMPOSE_PROGRESS_ON_WAVEFORM
- setAutoFillBackground(false);
-#endif
-}
-
-ProgressBar::~ProgressBar()
-{
-
-}
-
-void ProgressBar::reset()
-{
- m_bufferLength = 0;
- m_recordPosition = 0;
- m_playPosition = 0;
- m_windowPosition = 0;
- m_windowLength = 0;
- update();
-}
-
-void ProgressBar::paintEvent(QPaintEvent * /*event*/)
-{
- QPainter painter(this);
-
- QColor bufferColor(0, 0, 255);
- QColor windowColor(0, 255, 0);
-
-#ifdef SUPERIMPOSE_PROGRESS_ON_WAVEFORM
- bufferColor.setAlphaF(0.5);
- windowColor.setAlphaF(0.5);
-#else
- painter.fillRect(rect(), Qt::black);
-#endif
-
- if (m_bufferLength) {
- QRect bar = rect();
- const qreal play = qreal(m_playPosition) / m_bufferLength;
- bar.setLeft(rect().left() + play * rect().width());
- const qreal record = qreal(m_recordPosition) / m_bufferLength;
- bar.setRight(rect().left() + record * rect().width());
- painter.fillRect(bar, bufferColor);
-
- QRect window = rect();
- const qreal windowLeft = qreal(m_windowPosition) / m_bufferLength;
- window.setLeft(rect().left() + windowLeft * rect().width());
- const qreal windowWidth = qreal(m_windowLength) / m_bufferLength;
- window.setWidth(windowWidth * rect().width());
- painter.fillRect(window, windowColor);
- }
-}
-
-void ProgressBar::bufferLengthChanged(qint64 bufferSize)
-{
- m_bufferLength = bufferSize;
- m_recordPosition = 0;
- m_playPosition = 0;
- m_windowPosition = 0;
- m_windowLength = 0;
- repaint();
-}
-
-void ProgressBar::recordPositionChanged(qint64 recordPosition)
-{
- Q_ASSERT(recordPosition >= 0);
- Q_ASSERT(recordPosition <= m_bufferLength);
- m_recordPosition = recordPosition;
- repaint();
-}
-
-void ProgressBar::playPositionChanged(qint64 playPosition)
-{
- Q_ASSERT(playPosition >= 0);
- Q_ASSERT(playPosition <= m_bufferLength);
- m_playPosition = playPosition;
- repaint();
-}
-
-void ProgressBar::windowChanged(qint64 position, qint64 length)
-{
- Q_ASSERT(position >= 0);
- Q_ASSERT(position <= m_bufferLength);
- Q_ASSERT(position + length <= m_bufferLength);
- m_windowPosition = position;
- m_windowLength = length;
- repaint();
-}
diff --git a/examples/spectrum/app/progressbar.h b/examples/spectrum/app/progressbar.h
deleted file mode 100644
index b12f1c5..0000000
--- a/examples/spectrum/app/progressbar.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PROGRESSBAR_H
-#define PROGRESSBAR_H
-
-#include <QWidget>
-
-/**
- * Widget which displays a the current fill state of the Engine's internal
- * buffer, and the current play/record position within that buffer.
- */
-class ProgressBar : public QWidget {
- Q_OBJECT
-public:
- ProgressBar(QWidget *parent = 0);
- ~ProgressBar();
-
- void reset();
- void paintEvent(QPaintEvent *event);
-
-public slots:
- void bufferLengthChanged(qint64 length);
- void recordPositionChanged(qint64 recordPosition);
- void playPositionChanged(qint64 playPosition);
- void windowChanged(qint64 position, qint64 length);
-
-private:
- qint64 m_bufferLength;
- qint64 m_recordPosition;
- qint64 m_playPosition;
- qint64 m_windowPosition;
- qint64 m_windowLength;
-
-};
-
-#endif // PROGRESSBAR_H
diff --git a/examples/spectrum/app/settingsdialog.cpp b/examples/spectrum/app/settingsdialog.cpp
deleted file mode 100644
index 78c2db9..0000000
--- a/examples/spectrum/app/settingsdialog.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "settingsdialog.h"
-#include <QComboBox>
-#include <QDialogButtonBox>
-#include <QLabel>
-#include <QPushButton>
-#include <QVBoxLayout>
-#include <QCheckBox>
-#include <QSlider>
-#include <QSpinBox>
-
-SettingsDialog::SettingsDialog(
- const QList<QAudioDeviceInfo> &availableInputDevices,
- const QList<QAudioDeviceInfo> &availableOutputDevices,
- QWidget *parent)
- : QDialog(parent)
- , m_windowFunction(DefaultWindowFunction)
- , m_inputDeviceComboBox(new QComboBox(this))
- , m_outputDeviceComboBox(new QComboBox(this))
- , m_windowFunctionComboBox(new QComboBox(this))
-{
- QVBoxLayout *dialogLayout = new QVBoxLayout(this);
-
- // Populate combo boxes
-
- QAudioDeviceInfo device;
- foreach (device, availableInputDevices)
- m_inputDeviceComboBox->addItem(device.deviceName(),
- QVariant::fromValue(device));
- foreach (device, availableOutputDevices)
- m_outputDeviceComboBox->addItem(device.deviceName(),
- QVariant::fromValue(device));
-
- m_windowFunctionComboBox->addItem(tr("None"), QVariant::fromValue(int(NoWindow)));
- m_windowFunctionComboBox->addItem("Hann", QVariant::fromValue(int(HannWindow)));
- m_windowFunctionComboBox->setCurrentIndex(m_windowFunction);
-
- // Initialize default devices
- if (!availableInputDevices.empty())
- m_inputDevice = availableInputDevices.front();
- if (!availableOutputDevices.empty())
- m_outputDevice = availableOutputDevices.front();
-
- // Add widgets to layout
-
- QScopedPointer<QHBoxLayout> inputDeviceLayout(new QHBoxLayout);
- QLabel *inputDeviceLabel = new QLabel(tr("Input device"), this);
- inputDeviceLayout->addWidget(inputDeviceLabel);
- inputDeviceLayout->addWidget(m_inputDeviceComboBox);
- dialogLayout->addLayout(inputDeviceLayout.data());
- inputDeviceLayout.take(); // ownership transferred to dialogLayout
-
- QScopedPointer<QHBoxLayout> outputDeviceLayout(new QHBoxLayout);
- QLabel *outputDeviceLabel = new QLabel(tr("Output device"), this);
- outputDeviceLayout->addWidget(outputDeviceLabel);
- outputDeviceLayout->addWidget(m_outputDeviceComboBox);
- dialogLayout->addLayout(outputDeviceLayout.data());
- outputDeviceLayout.take(); // ownership transferred to dialogLayout
-
- QScopedPointer<QHBoxLayout> windowFunctionLayout(new QHBoxLayout);
- QLabel *windowFunctionLabel = new QLabel(tr("Window function"), this);
- windowFunctionLayout->addWidget(windowFunctionLabel);
- windowFunctionLayout->addWidget(m_windowFunctionComboBox);
- dialogLayout->addLayout(windowFunctionLayout.data());
- windowFunctionLayout.take(); // ownership transferred to dialogLayout
-
- // Connect
- CHECKED_CONNECT(m_inputDeviceComboBox, SIGNAL(activated(int)),
- this, SLOT(inputDeviceChanged(int)));
- CHECKED_CONNECT(m_outputDeviceComboBox, SIGNAL(activated(int)),
- this, SLOT(outputDeviceChanged(int)));
- CHECKED_CONNECT(m_windowFunctionComboBox, SIGNAL(activated(int)),
- this, SLOT(windowFunctionChanged(int)));
-
- // Add standard buttons to layout
- QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
- buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
- dialogLayout->addWidget(buttonBox);
-
- // Connect standard buttons
- CHECKED_CONNECT(buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()),
- this, SLOT(accept()));
- CHECKED_CONNECT(buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()),
- this, SLOT(reject()));
-
- setLayout(dialogLayout);
-}
-
-SettingsDialog::~SettingsDialog()
-{
-
-}
-
-void SettingsDialog::windowFunctionChanged(int index)
-{
- m_windowFunction = static_cast<WindowFunction>(
- m_windowFunctionComboBox->itemData(index).value<int>());
-}
-
-void SettingsDialog::inputDeviceChanged(int index)
-{
- m_inputDevice = m_inputDeviceComboBox->itemData(index).value<QAudioDeviceInfo>();
-}
-
-void SettingsDialog::outputDeviceChanged(int index)
-{
- m_outputDevice = m_outputDeviceComboBox->itemData(index).value<QAudioDeviceInfo>();
-}
-
diff --git a/examples/spectrum/app/settingsdialog.h b/examples/spectrum/app/settingsdialog.h
deleted file mode 100644
index 71d1796..0000000
--- a/examples/spectrum/app/settingsdialog.h
+++ /dev/null
@@ -1,87 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SETTINGSDIALOG_H
-#define SETTINGSDIALOG_H
-
-#include "spectrum.h"
-#include <QDialog>
-#include <QtMultimedia/QAudioDeviceInfo>
-
-QT_FORWARD_DECLARE_CLASS(QComboBox)
-QT_FORWARD_DECLARE_CLASS(QCheckBox)
-QT_FORWARD_DECLARE_CLASS(QSlider)
-QT_FORWARD_DECLARE_CLASS(QSpinBox)
-QT_FORWARD_DECLARE_CLASS(QGridLayout)
-
-/**
- * Dialog used to control settings such as the audio input / output device
- * and the windowing function.
- */
-class SettingsDialog : public QDialog {
- Q_OBJECT
-public:
- SettingsDialog(const QList<QAudioDeviceInfo> &availableInputDevices,
- const QList<QAudioDeviceInfo> &availableOutputDevices,
- QWidget *parent = 0);
- ~SettingsDialog();
-
- WindowFunction windowFunction() const { return m_windowFunction; }
- const QAudioDeviceInfo& inputDevice() const { return m_inputDevice; }
- const QAudioDeviceInfo& outputDevice() const { return m_outputDevice; }
-
-private slots:
- void windowFunctionChanged(int index);
- void inputDeviceChanged(int index);
- void outputDeviceChanged(int index);
-
-private:
- WindowFunction m_windowFunction;
- QAudioDeviceInfo m_inputDevice;
- QAudioDeviceInfo m_outputDevice;
-
- QComboBox* m_inputDeviceComboBox;
- QComboBox* m_outputDeviceComboBox;
-
- QComboBox* m_windowFunctionComboBox;
-
-};
-
-#endif // SETTINGSDIALOG_H
diff --git a/examples/spectrum/app/spectrograph.cpp b/examples/spectrum/app/spectrograph.cpp
deleted file mode 100644
index 7551491..0000000
--- a/examples/spectrum/app/spectrograph.cpp
+++ /dev/null
@@ -1,241 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "spectrograph.h"
-#include <QPainter>
-#include <QMouseEvent>
-#include <QDebug>
-#include <QTimerEvent>
-
-const int NullTimerId = -1;
-const int NullIndex = -1;
-const int BarSelectionInterval = 2000;
-
-Spectrograph::Spectrograph(QWidget *parent)
- : QWidget(parent)
- , m_barSelected(NullIndex)
- , m_timerId(NullTimerId)
- , m_lowFreq(0.0)
- , m_highFreq(0.0)
-{
- setMinimumHeight(100);
-}
-
-Spectrograph::~Spectrograph()
-{
-
-}
-
-void Spectrograph::setParams(int numBars, qreal lowFreq, qreal highFreq)
-{
- Q_ASSERT(numBars > 0);
- Q_ASSERT(highFreq > lowFreq);
- m_bars.resize(numBars);
- m_lowFreq = lowFreq;
- m_highFreq = highFreq;
- updateBars();
-}
-
-void Spectrograph::timerEvent(QTimerEvent *event)
-{
- Q_ASSERT(event->timerId() == m_timerId);
- Q_UNUSED(event) // suppress warnings in release builds
- killTimer(m_timerId);
- m_timerId = NullTimerId;
- m_barSelected = NullIndex;
- update();
-}
-
-void Spectrograph::paintEvent(QPaintEvent *event)
-{
- Q_UNUSED(event)
-
- QPainter painter(this);
- painter.fillRect(rect(), Qt::black);
-
- const int numBars = m_bars.count();
-
- // Highlight region of selected bar
- if (m_barSelected != NullIndex && numBars) {
- QRect regionRect = rect();
- regionRect.setLeft(m_barSelected * rect().width() / numBars);
- regionRect.setWidth(rect().width() / numBars);
- QColor regionColor(202, 202, 64);
- painter.setBrush(Qt::DiagCrossPattern);
- painter.fillRect(regionRect, regionColor);
- painter.setBrush(Qt::NoBrush);
- }
-
- QColor barColor(51, 204, 102);
- QColor clipColor(255, 255, 0);
-
- // Draw the outline
- const QColor gridColor = barColor.darker();
- QPen gridPen(gridColor);
- painter.setPen(gridPen);
- painter.drawLine(rect().topLeft(), rect().topRight());
- painter.drawLine(rect().topRight(), rect().bottomRight());
- painter.drawLine(rect().bottomRight(), rect().bottomLeft());
- painter.drawLine(rect().bottomLeft(), rect().topLeft());
-
- QVector<qreal> dashes;
- dashes << 2 << 2;
- gridPen.setDashPattern(dashes);
- painter.setPen(gridPen);
-
- // Draw vertical lines between bars
- if (numBars) {
- const int numHorizontalSections = numBars;
- QLine line(rect().topLeft(), rect().bottomLeft());
- for (int i=1; i<numHorizontalSections; ++i) {
- line.translate(rect().width()/numHorizontalSections, 0);
- painter.drawLine(line);
- }
- }
-
- // Draw horizontal lines
- const int numVerticalSections = 10;
- QLine line(rect().topLeft(), rect().topRight());
- for (int i=1; i<numVerticalSections; ++i) {
- line.translate(0, rect().height()/numVerticalSections);
- painter.drawLine(line);
- }
-
- barColor = barColor.lighter();
- barColor.setAlphaF(0.75);
- clipColor.setAlphaF(0.75);
-
- // Draw the bars
- if (numBars) {
- // Calculate width of bars and gaps
- const int widgetWidth = rect().width();
- const int barPlusGapWidth = widgetWidth / numBars;
- const int barWidth = 0.8 * barPlusGapWidth;
- const int gapWidth = barPlusGapWidth - barWidth;
- const int paddingWidth = widgetWidth - numBars * (barWidth + gapWidth);
- const int leftPaddingWidth = (paddingWidth + gapWidth) / 2;
- const int barHeight = rect().height() - 2 * gapWidth;
-
- for (int i=0; i<numBars; ++i) {
- const qreal value = m_bars[i].value;
- Q_ASSERT(value >= 0.0 && value <= 1.0);
- QRect bar = rect();
- bar.setLeft(rect().left() + leftPaddingWidth + (i * (gapWidth + barWidth)));
- bar.setWidth(barWidth);
- bar.setTop(rect().top() + gapWidth + (1.0 - value) * barHeight);
- bar.setBottom(rect().bottom() - gapWidth);
-
- QColor color = barColor;
- if (m_bars[i].clipped)
- color = clipColor;
-
- painter.fillRect(bar, color);
- }
- }
-}
-
-void Spectrograph::mousePressEvent(QMouseEvent *event)
-{
- const QPoint pos = event->pos();
- const int index = m_bars.count() * (pos.x() - rect().left()) / rect().width();
- selectBar(index);
-}
-
-void Spectrograph::reset()
-{
- m_spectrum.reset();
- spectrumChanged(m_spectrum);
-}
-
-void Spectrograph::spectrumChanged(const FrequencySpectrum &spectrum)
-{
- m_spectrum = spectrum;
- updateBars();
-}
-
-int Spectrograph::barIndex(qreal frequency) const
-{
- Q_ASSERT(frequency >= m_lowFreq && frequency < m_highFreq);
- const qreal bandWidth = (m_highFreq - m_lowFreq) / m_bars.count();
- const int index = (frequency - m_lowFreq) / bandWidth;
- if (index <0 || index >= m_bars.count())
- Q_ASSERT(false);
- return index;
-}
-
-QPair<qreal, qreal> Spectrograph::barRange(int index) const
-{
- Q_ASSERT(index >= 0 && index < m_bars.count());
- const qreal bandWidth = (m_highFreq - m_lowFreq) / m_bars.count();
- return QPair<qreal, qreal>(index * bandWidth, (index+1) * bandWidth);
-}
-
-void Spectrograph::updateBars()
-{
- m_bars.fill(Bar());
- FrequencySpectrum::const_iterator i = m_spectrum.begin();
- const FrequencySpectrum::const_iterator end = m_spectrum.end();
- for ( ; i != end; ++i) {
- const FrequencySpectrum::Element e = *i;
- if (e.frequency >= m_lowFreq && e.frequency < m_highFreq) {
- Bar &bar = m_bars[barIndex(e.frequency)];
- bar.value = qMax(bar.value, e.amplitude);
- bar.clipped |= e.clipped;
- }
- }
- update();
-}
-
-void Spectrograph::selectBar(int index) {
- const QPair<qreal, qreal> frequencyRange = barRange(index);
- const QString message = QString("%1 - %2 Hz")
- .arg(frequencyRange.first)
- .arg(frequencyRange.second);
- emit infoMessage(message, BarSelectionInterval);
-
- if (NullTimerId != m_timerId)
- killTimer(m_timerId);
- m_timerId = startTimer(BarSelectionInterval);
-
- m_barSelected = index;
- update();
-}
-
-
diff --git a/examples/spectrum/app/spectrograph.h b/examples/spectrum/app/spectrograph.h
deleted file mode 100644
index bfcefd8..0000000
--- a/examples/spectrum/app/spectrograph.h
+++ /dev/null
@@ -1,99 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SPECTROGRAPH_H
-#define SPECTROGRAPH_H
-
-#include <QWidget>
-#include "frequencyspectrum.h"
-
-QT_FORWARD_DECLARE_CLASS(QMouseEvent)
-
-/**
- * Widget which displays a spectrograph showing the frequency spectrum
- * of the window of audio samples most recently analyzed by the Engine.
- */
-class Spectrograph : public QWidget {
- Q_OBJECT
-public:
- Spectrograph(QWidget *parent = 0);
- ~Spectrograph();
-
- void setParams(int numBars, qreal lowFreq, qreal highFreq);
-
- // QObject
- void timerEvent(QTimerEvent *event);
-
- // QWidget
- void paintEvent(QPaintEvent *event);
- void mousePressEvent(QMouseEvent *event);
-
-signals:
- void infoMessage(const QString &message, int intervalMs);
-
-public slots:
- void reset();
- void spectrumChanged(const FrequencySpectrum &spectrum);
-
-private:
- int barIndex(qreal frequency) const;
- QPair<qreal, qreal> barRange(int barIndex) const;
- void updateBars();
-
- void selectBar(int index);
-
-private:
- struct Bar {
- Bar() : value(0.0), clipped(false) { }
- qreal value;
- bool clipped;
- };
-
- QVector<Bar> m_bars;
- int m_barSelected;
- int m_timerId;
- qreal m_lowFreq;
- qreal m_highFreq;
- FrequencySpectrum m_spectrum;
-
-
-};
-
-#endif // SPECTROGRAPH_H
diff --git a/examples/spectrum/app/spectrum.h b/examples/spectrum/app/spectrum.h
deleted file mode 100644
index e8e34e6..0000000
--- a/examples/spectrum/app/spectrum.h
+++ /dev/null
@@ -1,144 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SPECTRUM_H
-#define SPECTRUM_H
-
-#include <QtCore/qglobal.h>
-#include "utils.h"
-#include "fftreal_wrapper.h" // For FFTLengthPowerOfTwo
-
-//-----------------------------------------------------------------------------
-// Constants
-//-----------------------------------------------------------------------------
-
-// Number of audio samples used to calculate the frequency spectrum
-const int SpectrumLengthSamples = PowerOfTwo<FFTLengthPowerOfTwo>::Result;
-
-// Number of bands in the frequency spectrum
-const int SpectrumNumBands = 10;
-
-// Lower bound of first band in the spectrum
-const qreal SpectrumLowFreq = 0.0; // Hz
-
-// Upper band of last band in the spectrum
-const qreal SpectrumHighFreq = 1000.0; // Hz
-
-// Waveform window size in microseconds
-const qint64 WaveformWindowDuration = 500 * 1000;
-
-// Length of waveform tiles in bytes
-// Ideally, these would match the QAudio*::bufferSize(), but that isn't
-// available until some time after QAudio*::start() has been called, and we
-// need this value in order to initialize the waveform display.
-// We therefore just choose a sensible value.
-const int WaveformTileLength = 4096;
-
-// Fudge factor used to calculate the spectrum bar heights
-const qreal SpectrumAnalyserMultiplier = 0.15;
-
-// Disable message timeout
-const int NullMessageTimeout = -1;
-
-
-//-----------------------------------------------------------------------------
-// Types and data structures
-//-----------------------------------------------------------------------------
-
-enum WindowFunction {
- NoWindow,
- HannWindow
-};
-
-const WindowFunction DefaultWindowFunction = HannWindow;
-
-struct Tone {
- Tone(qreal freq = 0.0, qreal amp = 0.0)
- : frequency(freq), amplitude(amp)
- { }
-
- // Start and end frequencies for swept tone generation
- qreal frequency;
-
- // Amplitude in range [0.0, 1.0]
- qreal amplitude;
-};
-
-struct SweptTone {
- SweptTone(qreal start = 0.0, qreal end = 0.0, qreal amp = 0.0)
- : startFreq(start), endFreq(end), amplitude(amp)
- { Q_ASSERT(end >= start); }
-
- SweptTone(const Tone &tone)
- : startFreq(tone.frequency), endFreq(tone.frequency), amplitude(tone.amplitude)
- { }
-
- // Start and end frequencies for swept tone generation
- qreal startFreq;
- qreal endFreq;
-
- // Amplitude in range [0.0, 1.0]
- qreal amplitude;
-};
-
-
-//-----------------------------------------------------------------------------
-// Macros
-//-----------------------------------------------------------------------------
-
-// Macro which connects a signal to a slot, and which causes application to
-// abort if the connection fails. This is intended to catch programming errors
-// such as mis-typing a signal or slot name. It is necessary to write our own
-// macro to do this - the following idiom
-// Q_ASSERT(connect(source, signal, receiver, slot));
-// will not work because Q_ASSERT compiles to a no-op in release builds.
-
-#define CHECKED_CONNECT(source, signal, receiver, slot) \
- if (!connect(source, signal, receiver, slot)) \
- qt_assert_x(Q_FUNC_INFO, "CHECKED_CONNECT failed", __FILE__, __LINE__);
-
-// Handle some dependencies between macros defined in the .pro file
-
-#ifdef DISABLE_WAVEFORM
-#undef SUPERIMPOSE_PROGRESS_ON_WAVEFORM
-#endif
-
-#endif // SPECTRUM_H
-
diff --git a/examples/spectrum/app/spectrum.qrc b/examples/spectrum/app/spectrum.qrc
deleted file mode 100644
index 6100479..0000000
--- a/examples/spectrum/app/spectrum.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>images/record.png</file>
- <file>images/settings.png</file>
-</qresource>
-</RCC>
-
diff --git a/examples/spectrum/app/spectrumanalyser.cpp b/examples/spectrum/app/spectrumanalyser.cpp
deleted file mode 100644
index 8c3212d..0000000
--- a/examples/spectrum/app/spectrumanalyser.cpp
+++ /dev/null
@@ -1,281 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "spectrumanalyser.h"
-#include "utils.h"
-
-#include <QtCore/qmath.h>
-#include <QtCore/qmetatype.h>
-#include <QtMultimedia/QAudioFormat>
-#include <QThread>
-
-#include "fftreal_wrapper.h"
-
-SpectrumAnalyserThread::SpectrumAnalyserThread(QObject *parent)
- : QObject(parent)
-#ifndef DISABLE_FFT
- , m_fft(new FFTRealWrapper)
-#endif
- , m_numSamples(SpectrumLengthSamples)
- , m_windowFunction(DefaultWindowFunction)
- , m_window(SpectrumLengthSamples, 0.0)
- , m_input(SpectrumLengthSamples, 0.0)
- , m_output(SpectrumLengthSamples, 0.0)
- , m_spectrum(SpectrumLengthSamples)
-#ifdef SPECTRUM_ANALYSER_SEPARATE_THREAD
- , m_thread(new QThread(this))
-#endif
-{
-#ifdef SPECTRUM_ANALYSER_SEPARATE_THREAD
- // moveToThread() cannot be called on a QObject with a parent
- setParent(0);
- moveToThread(m_thread);
- m_thread->start();
-#endif
- calculateWindow();
-}
-
-SpectrumAnalyserThread::~SpectrumAnalyserThread()
-{
-#ifndef DISABLE_FFT
- delete m_fft;
-#endif
-}
-
-void SpectrumAnalyserThread::setWindowFunction(WindowFunction type)
-{
- m_windowFunction = type;
- calculateWindow();
-}
-
-void SpectrumAnalyserThread::calculateWindow()
-{
- for (int i=0; i<m_numSamples; ++i) {
- DataType x = 0.0;
-
- switch (m_windowFunction) {
- case NoWindow:
- x = 1.0;
- break;
- case HannWindow:
- x = 0.5 * (1 - qCos((2 * M_PI * i) / (m_numSamples - 1)));
- break;
- default:
- Q_ASSERT(false);
- }
-
- m_window[i] = x;
- }
-}
-
-void SpectrumAnalyserThread::calculateSpectrum(const QByteArray &buffer,
- int inputFrequency,
- int bytesPerSample)
-{
-#ifndef DISABLE_FFT
- Q_ASSERT(buffer.size() == m_numSamples * bytesPerSample);
-
- // Initialize data array
- const char *ptr = buffer.constData();
- for (int i=0; i<m_numSamples; ++i) {
- const qint16 pcmSample = *reinterpret_cast<const qint16*>(ptr);
- // Scale down to range [-1.0, 1.0]
- const DataType realSample = pcmToReal(pcmSample);
- const DataType windowedSample = realSample * m_window[i];
- m_input[i] = windowedSample;
- ptr += bytesPerSample;
- }
-
- // Calculate the FFT
- m_fft->calculateFFT(m_output.data(), m_input.data());
-
- // Analyze output to obtain amplitude and phase for each frequency
- for (int i=2; i<=m_numSamples/2; ++i) {
- // Calculate frequency of this complex sample
- m_spectrum[i].frequency = qreal(i * inputFrequency) / (m_numSamples);
-
- const qreal real = m_output[i];
- qreal imag = 0.0;
- if (i>0 && i<m_numSamples/2)
- imag = m_output[m_numSamples/2 + i];
-
- const qreal magnitude = sqrt(real*real + imag*imag);
- qreal amplitude = SpectrumAnalyserMultiplier * log(magnitude);
-
- // Bound amplitude to [0.0, 1.0]
- m_spectrum[i].clipped = (amplitude > 1.0);
- amplitude = qMax(qreal(0.0), amplitude);
- amplitude = qMin(qreal(1.0), amplitude);
- m_spectrum[i].amplitude = amplitude;
- }
-#endif
-
- emit calculationComplete(m_spectrum);
-}
-
-
-//=============================================================================
-// SpectrumAnalyser
-//=============================================================================
-
-SpectrumAnalyser::SpectrumAnalyser(QObject *parent)
- : QObject(parent)
- , m_thread(new SpectrumAnalyserThread(this))
- , m_state(Idle)
-#ifdef DUMP_SPECTRUMANALYSER
- , m_count(0)
-#endif
-{
- CHECKED_CONNECT(m_thread, SIGNAL(calculationComplete(FrequencySpectrum)),
- this, SLOT(calculationComplete(FrequencySpectrum)));
-}
-
-SpectrumAnalyser::~SpectrumAnalyser()
-{
-
-}
-
-#ifdef DUMP_SPECTRUMANALYSER
-void SpectrumAnalyser::setOutputPath(const QString &outputDir)
-{
- m_outputDir.setPath(outputDir);
- m_textFile.setFileName(m_outputDir.filePath("spectrum.txt"));
- m_textFile.open(QIODevice::WriteOnly | QIODevice::Text);
- m_textStream.setDevice(&m_textFile);
-}
-#endif
-
-//-----------------------------------------------------------------------------
-// Public functions
-//-----------------------------------------------------------------------------
-
-void SpectrumAnalyser::setWindowFunction(WindowFunction type)
-{
- const bool b = QMetaObject::invokeMethod(m_thread, "setWindowFunction",
- Qt::AutoConnection,
- Q_ARG(WindowFunction, type));
- Q_ASSERT(b);
- Q_UNUSED(b) // suppress warnings in release builds
-}
-
-void SpectrumAnalyser::calculate(const QByteArray &buffer,
- const QAudioFormat &format)
-{
- // QThread::currentThread is marked 'for internal use only', but
- // we're only using it for debug output here, so it's probably OK :)
- SPECTRUMANALYSER_DEBUG << "SpectrumAnalyser::calculate"
- << QThread::currentThread()
- << "state" << m_state;
-
- if (isReady()) {
- Q_ASSERT(isPCMS16LE(format));
-
- const int bytesPerSample = format.sampleSize() * format.channels() / 8;
-
-#ifdef DUMP_SPECTRUMANALYSER
- m_count++;
- const QString pcmFileName = m_outputDir.filePath(QString("spectrum_%1.pcm").arg(m_count, 4, 10, QChar('0')));
- QFile pcmFile(pcmFileName);
- pcmFile.open(QIODevice::WriteOnly);
- const int bufferLength = m_numSamples * bytesPerSample;
- pcmFile.write(buffer, bufferLength);
-
- m_textStream << "TimeDomain " << m_count << "\n";
- const qint16* input = reinterpret_cast<const qint16*>(buffer);
- for (int i=0; i<m_numSamples; ++i) {
- m_textStream << i << "\t" << *input << "\n";
- input += format.channels();
- }
-#endif
-
- m_state = Busy;
-
- // Invoke SpectrumAnalyserThread::calculateSpectrum using QMetaObject. If
- // m_thread is in a different thread from the current thread, the
- // calculation will be done in the child thread.
- // Once the calculation is finished, a calculationChanged signal will be
- // emitted by m_thread.
- const bool b = QMetaObject::invokeMethod(m_thread, "calculateSpectrum",
- Qt::AutoConnection,
- Q_ARG(QByteArray, buffer),
- Q_ARG(int, format.frequency()),
- Q_ARG(int, bytesPerSample));
- Q_ASSERT(b);
- Q_UNUSED(b) // suppress warnings in release builds
-
-#ifdef DUMP_SPECTRUMANALYSER
- m_textStream << "FrequencySpectrum " << m_count << "\n";
- FrequencySpectrum::const_iterator x = m_spectrum.begin();
- for (int i=0; i<m_numSamples; ++i, ++x)
- m_textStream << i << "\t"
- << x->frequency << "\t"
- << x->amplitude<< "\t"
- << x->phase << "\n";
-#endif
- }
-}
-
-bool SpectrumAnalyser::isReady() const
-{
- return (Idle == m_state);
-}
-
-void SpectrumAnalyser::cancelCalculation()
-{
- if (Busy == m_state)
- m_state = Cancelled;
-}
-
-
-//-----------------------------------------------------------------------------
-// Private slots
-//-----------------------------------------------------------------------------
-
-void SpectrumAnalyser::calculationComplete(const FrequencySpectrum &spectrum)
-{
- Q_ASSERT(Idle != m_state);
- if (Busy == m_state)
- emit spectrumChanged(spectrum);
- m_state = Idle;
-}
-
-
-
-
diff --git a/examples/spectrum/app/spectrumanalyser.h b/examples/spectrum/app/spectrumanalyser.h
deleted file mode 100644
index 663c213..0000000
--- a/examples/spectrum/app/spectrumanalyser.h
+++ /dev/null
@@ -1,194 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SPECTRUMANALYSER_H
-#define SPECTRUMANALYSER_H
-
-#include <QByteArray>
-#include <QObject>
-#include <QVector>
-
-#ifdef DUMP_SPECTRUMANALYSER
-#include <QDir>
-#include <QFile>
-#include <QTextStream>
-#endif
-
-#include "frequencyspectrum.h"
-#include "spectrum.h"
-
-#ifndef DISABLE_FFT
-#include "FFTRealFixLenParam.h"
-#endif
-
-QT_FORWARD_DECLARE_CLASS(QAudioFormat)
-QT_FORWARD_DECLARE_CLASS(QThread)
-
-class FFTRealWrapper;
-
-class SpectrumAnalyserThreadPrivate;
-
-/**
- * Implementation of the spectrum analysis which can be run in a
- * separate thread.
- */
-class SpectrumAnalyserThread : public QObject
-{
- Q_OBJECT
-public:
- SpectrumAnalyserThread(QObject *parent);
- ~SpectrumAnalyserThread();
-
-public slots:
- void setWindowFunction(WindowFunction type);
- void calculateSpectrum(const QByteArray &buffer,
- int inputFrequency,
- int bytesPerSample);
-
-signals:
- void calculationComplete(const FrequencySpectrum &spectrum);
-
-private:
- void calculateWindow();
-
-private:
-#ifndef DISABLE_FFT
- FFTRealWrapper* m_fft;
-#endif
-
- const int m_numSamples;
-
- WindowFunction m_windowFunction;
-
-#ifdef DISABLE_FFT
- typedef qreal DataType;
-#else
- typedef FFTRealFixLenParam::DataType DataType;
-#endif
- QVector<DataType> m_window;
-
- QVector<DataType> m_input;
- QVector<DataType> m_output;
-
- FrequencySpectrum m_spectrum;
-
-#ifdef SPECTRUM_ANALYSER_SEPARATE_THREAD
- QThread* m_thread;
-#endif
-};
-
-/**
- * Class which performs frequency spectrum analysis on a window of
- * audio samples, provided to it by the Engine.
- */
-class SpectrumAnalyser : public QObject
-{
- Q_OBJECT
-public:
- SpectrumAnalyser(QObject *parent = 0);
- ~SpectrumAnalyser();
-
-#ifdef DUMP_SPECTRUMANALYSER
- void setOutputPath(const QString &outputPath);
-#endif
-
-public:
- /*
- * Set the windowing function which is applied before calculating the FFT
- */
- void setWindowFunction(WindowFunction type);
-
- /*
- * Calculate a frequency spectrum
- *
- * \param buffer Audio data
- * \param format Format of audio data
- *
- * Frequency spectrum is calculated asynchronously. The result is returned
- * via the spectrumChanged signal.
- *
- * An ongoing calculation can be cancelled by calling cancelCalculation().
- *
- */
- void calculate(const QByteArray &buffer, const QAudioFormat &format);
-
- /*
- * Check whether the object is ready to perform another calculation
- */
- bool isReady() const;
-
- /*
- * Cancel an ongoing calculation
- *
- * Note that cancelling is asynchronous.
- */
- void cancelCalculation();
-
-signals:
- void spectrumChanged(const FrequencySpectrum &spectrum);
-
-private slots:
- void calculationComplete(const FrequencySpectrum &spectrum);
-
-private:
- void calculateWindow();
-
-private:
-
- SpectrumAnalyserThread* m_thread;
-
- enum State {
- Idle,
- Busy,
- Cancelled
- };
-
- State m_state;
-
-#ifdef DUMP_SPECTRUMANALYSER
- QDir m_outputDir;
- int m_count;
- QFile m_textFile;
- QTextStream m_textStream;
-#endif
-};
-
-#endif // SPECTRUMANALYSER_H
-
diff --git a/examples/spectrum/app/tonegenerator.cpp b/examples/spectrum/app/tonegenerator.cpp
deleted file mode 100644
index f3cad99..0000000
--- a/examples/spectrum/app/tonegenerator.cpp
+++ /dev/null
@@ -1,91 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "spectrum.h"
-#include "utils.h"
-#include <QByteArray>
-#include <QtMultimedia/QAudioFormat>
-#include <QtCore/qmath.h>
-#include <QtCore/qendian.h>
-
-void generateTone(const SweptTone &tone, const QAudioFormat &format, QByteArray &buffer)
-{
- Q_ASSERT(isPCMS16LE(format));
-
- const int channelBytes = format.sampleSize() / 8;
- const int sampleBytes = format.channels() * channelBytes;
- int length = buffer.size();
- const int numSamples = buffer.size() / sampleBytes;
-
- Q_ASSERT(length % sampleBytes == 0);
- Q_UNUSED(sampleBytes) // suppress warning in release builds
-
- unsigned char *ptr = reinterpret_cast<unsigned char *>(buffer.data());
-
- qreal phase = 0.0;
-
- const qreal d = 2 * M_PI / format.frequency();
-
- // We can't generate a zero-frequency sine wave
- const qreal startFreq = tone.startFreq ? tone.startFreq : 1.0;
-
- // Amount by which phase increases on each sample
- qreal phaseStep = d * startFreq;
-
- // Amount by which phaseStep increases on each sample
- // If this is non-zero, the output is a frequency-swept tone
- const qreal phaseStepStep = d * (tone.endFreq - startFreq) / numSamples;
-
- while (length) {
- const qreal x = tone.amplitude * qSin(phase);
- const qint16 value = realToPcm(x);
- for (int i=0; i<format.channels(); ++i) {
- qToLittleEndian<qint16>(value, ptr);
- ptr += channelBytes;
- length -= channelBytes;
- }
-
- phase += phaseStep;
- while (phase > 2 * M_PI)
- phase -= 2 * M_PI;
- phaseStep += phaseStepStep;
- }
-}
-
diff --git a/examples/spectrum/app/tonegenerator.h b/examples/spectrum/app/tonegenerator.h
deleted file mode 100644
index d2aadb2..0000000
--- a/examples/spectrum/app/tonegenerator.h
+++ /dev/null
@@ -1,56 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TONEGENERATOR_H
-#define TONEGENERATOR_H
-
-#include <QtCore/qglobal.h>
-#include "spectrum.h"
-
-QT_FORWARD_DECLARE_CLASS(QAudioFormat)
-QT_FORWARD_DECLARE_CLASS(QByteArray)
-
-/**
- * Generate a sine wave
- */
-void generateTone(const SweptTone &tone, const QAudioFormat &format, QByteArray &buffer);
-
-#endif // TONEGENERATOR_H
-
diff --git a/examples/spectrum/app/tonegeneratordialog.cpp b/examples/spectrum/app/tonegeneratordialog.cpp
deleted file mode 100644
index 5e5cd63..0000000
--- a/examples/spectrum/app/tonegeneratordialog.cpp
+++ /dev/null
@@ -1,147 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "tonegeneratordialog.h"
-#include <QComboBox>
-#include <QDialogButtonBox>
-#include <QLabel>
-#include <QPushButton>
-#include <QVBoxLayout>
-#include <QCheckBox>
-#include <QSlider>
-#include <QSpinBox>
-
-const int ToneGeneratorFreqMin = 1;
-const int ToneGeneratorFreqMax = 1000;
-const int ToneGeneratorFreqDefault = 440;
-const int ToneGeneratorAmplitudeDefault = 75;
-
-ToneGeneratorDialog::ToneGeneratorDialog(QWidget *parent)
- : QDialog(parent)
- , m_toneGeneratorSweepCheckBox(new QCheckBox(tr("Frequency sweep"), this))
- , m_frequencySweepEnabled(true)
- , m_toneGeneratorControl(new QWidget(this))
- , m_toneGeneratorFrequencyControl(new QWidget(this))
- , m_frequencySlider(new QSlider(Qt::Horizontal, this))
- , m_frequencySpinBox(new QSpinBox(this))
- , m_frequency(ToneGeneratorFreqDefault)
- , m_amplitudeSlider(new QSlider(Qt::Horizontal, this))
-{
- QVBoxLayout *dialogLayout = new QVBoxLayout(this);
-
- m_toneGeneratorSweepCheckBox->setChecked(true);
-
- // Configure tone generator controls
- m_frequencySlider->setRange(ToneGeneratorFreqMin, ToneGeneratorFreqMax);
- m_frequencySlider->setValue(ToneGeneratorFreqDefault);
- m_frequencySpinBox->setRange(ToneGeneratorFreqMin, ToneGeneratorFreqMax);
- m_frequencySpinBox->setValue(ToneGeneratorFreqDefault);
- m_amplitudeSlider->setRange(0, 100);
- m_amplitudeSlider->setValue(ToneGeneratorAmplitudeDefault);
-
- // Add widgets to layout
-
- QScopedPointer<QGridLayout> frequencyControlLayout(new QGridLayout);
- QLabel *frequencyLabel = new QLabel(tr("Frequency (Hz)"), this);
- frequencyControlLayout->addWidget(frequencyLabel, 0, 0, 2, 1);
- frequencyControlLayout->addWidget(m_frequencySlider, 0, 1);
- frequencyControlLayout->addWidget(m_frequencySpinBox, 1, 1);
- m_toneGeneratorFrequencyControl->setLayout(frequencyControlLayout.data());
- frequencyControlLayout.take(); // ownership transferred to m_toneGeneratorFrequencyControl
- m_toneGeneratorFrequencyControl->setEnabled(false);
-
- QScopedPointer<QGridLayout> toneGeneratorLayout(new QGridLayout);
- QLabel *amplitudeLabel = new QLabel(tr("Amplitude"), this);
- toneGeneratorLayout->addWidget(m_toneGeneratorSweepCheckBox, 0, 1);
- toneGeneratorLayout->addWidget(m_toneGeneratorFrequencyControl, 1, 0, 1, 2);
- toneGeneratorLayout->addWidget(amplitudeLabel, 2, 0);
- toneGeneratorLayout->addWidget(m_amplitudeSlider, 2, 1);
- m_toneGeneratorControl->setLayout(toneGeneratorLayout.data());
- m_toneGeneratorControl->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
- dialogLayout->addWidget(m_toneGeneratorControl);
- toneGeneratorLayout.take(); // ownership transferred
-
- // Connect
- CHECKED_CONNECT(m_toneGeneratorSweepCheckBox, SIGNAL(toggled(bool)),
- this, SLOT(frequencySweepEnabled(bool)));
- CHECKED_CONNECT(m_frequencySlider, SIGNAL(valueChanged(int)),
- m_frequencySpinBox, SLOT(setValue(int)));
- CHECKED_CONNECT(m_frequencySpinBox, SIGNAL(valueChanged(int)),
- m_frequencySlider, SLOT(setValue(int)));
-
- // Add standard buttons to layout
- QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
- buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
- dialogLayout->addWidget(buttonBox);
-
- // Connect standard buttons
- CHECKED_CONNECT(buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()),
- this, SLOT(accept()));
- CHECKED_CONNECT(buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()),
- this, SLOT(reject()));
-
- setLayout(dialogLayout);
-}
-
-ToneGeneratorDialog::~ToneGeneratorDialog()
-{
-
-}
-
-bool ToneGeneratorDialog::isFrequencySweepEnabled() const
-{
- return m_toneGeneratorSweepCheckBox->isChecked();
-}
-
-qreal ToneGeneratorDialog::frequency() const
-{
- return qreal(m_frequencySlider->value());
-}
-
-qreal ToneGeneratorDialog::amplitude() const
-{
- return qreal(m_amplitudeSlider->value()) / 100.0;
-}
-
-void ToneGeneratorDialog::frequencySweepEnabled(bool enabled)
-{
- m_frequencySweepEnabled = enabled;
- m_toneGeneratorFrequencyControl->setEnabled(!enabled);
-}
diff --git a/examples/spectrum/app/tonegeneratordialog.h b/examples/spectrum/app/tonegeneratordialog.h
deleted file mode 100644
index 788a0ea..0000000
--- a/examples/spectrum/app/tonegeneratordialog.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TONEGENERATORDIALOG_H
-#define TONEGENERATORDIALOG_H
-
-#include "spectrum.h"
-#include <QDialog>
-#include <QtMultimedia/QAudioDeviceInfo>
-
-QT_FORWARD_DECLARE_CLASS(QCheckBox)
-QT_FORWARD_DECLARE_CLASS(QSlider)
-QT_FORWARD_DECLARE_CLASS(QSpinBox)
-QT_FORWARD_DECLARE_CLASS(QGridLayout)
-
-/**
- * Dialog which controls the parameters of the tone generator.
- */
-class ToneGeneratorDialog : public QDialog {
- Q_OBJECT
-public:
- ToneGeneratorDialog(QWidget *parent = 0);
- ~ToneGeneratorDialog();
-
- bool isFrequencySweepEnabled() const;
- qreal frequency() const;
- qreal amplitude() const;
-
-private slots:
- void frequencySweepEnabled(bool enabled);
-
-private:
- QCheckBox* m_toneGeneratorSweepCheckBox;
- bool m_frequencySweepEnabled;
- QWidget* m_toneGeneratorControl;
- QWidget* m_toneGeneratorFrequencyControl;
- QSlider* m_frequencySlider;
- QSpinBox* m_frequencySpinBox;
- qreal m_frequency;
- QSlider* m_amplitudeSlider;
-
-};
-
-#endif // TONEGENERATORDIALOG_H
diff --git a/examples/spectrum/app/utils.cpp b/examples/spectrum/app/utils.cpp
deleted file mode 100644
index 31cc25b..0000000
--- a/examples/spectrum/app/utils.cpp
+++ /dev/null
@@ -1,139 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtMultimedia/QAudioFormat>
-#include "utils.h"
-
-qint64 audioDuration(const QAudioFormat &format, qint64 bytes)
-{
- return (bytes * 1000000) /
- (format.frequency() * format.channels() * (format.sampleSize() / 8));
-}
-
-qint64 audioLength(const QAudioFormat &format, qint64 microSeconds)
-{
- qint64 result = (format.frequency() * format.channels() * (format.sampleSize() / 8))
- * microSeconds / 1000000;
- result -= result % (format.channelCount() * format.sampleSize());
- return result;
-}
-
-qreal nyquistFrequency(const QAudioFormat &format)
-{
- return format.frequency() / 2;
-}
-
-QString formatToString(const QAudioFormat &format)
-{
- QString result;
-
- if (QAudioFormat() != format) {
- if (format.codec() == "audio/pcm") {
- Q_ASSERT(format.sampleType() == QAudioFormat::SignedInt);
-
- const QString formatEndian = (format.byteOrder() == QAudioFormat::LittleEndian)
- ? QString("LE") : QString("BE");
-
- QString formatType;
- switch (format.sampleType()) {
- case QAudioFormat::SignedInt:
- formatType = "signed";
- break;
- case QAudioFormat::UnSignedInt:
- formatType = "unsigned";
- break;
- case QAudioFormat::Float:
- formatType = "float";
- break;
- case QAudioFormat::Unknown:
- formatType = "unknown";
- break;
- }
-
- QString formatChannels = QString("%1 channels").arg(format.channels());
- switch (format.channels()) {
- case 1:
- formatChannels = "mono";
- break;
- case 2:
- formatChannels = "stereo";
- break;
- }
-
- result = QString("%1 Hz %2 bit %3 %4 %5")
- .arg(format.frequency())
- .arg(format.sampleSize())
- .arg(formatType)
- .arg(formatEndian)
- .arg(formatChannels);
- } else {
- result = format.codec();
- }
- }
-
- return result;
-}
-
-bool isPCM(const QAudioFormat &format)
-{
- return (format.codec() == "audio/pcm");
-}
-
-
-bool isPCMS16LE(const QAudioFormat &format)
-{
- return (isPCM(format) &&
- format.sampleType() == QAudioFormat::SignedInt &&
- format.sampleSize() == 16 &&
- format.byteOrder() == QAudioFormat::LittleEndian);
-}
-
-const qint16 PCMS16MaxValue = 32767;
-const quint16 PCMS16MaxAmplitude = 32768; // because minimum is -32768
-
-qreal pcmToReal(qint16 pcm)
-{
- return qreal(pcm) / PCMS16MaxAmplitude;
-}
-
-qint16 realToPcm(qreal real)
-{
- return real * PCMS16MaxValue;
-}
diff --git a/examples/spectrum/app/utils.h b/examples/spectrum/app/utils.h
deleted file mode 100644
index 9c85c61..0000000
--- a/examples/spectrum/app/utils.h
+++ /dev/null
@@ -1,112 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef UTILS_H
-#define UTILS_H
-
-#include <QtCore/qglobal.h>
-#include <QDebug>
-
-QT_FORWARD_DECLARE_CLASS(QAudioFormat)
-
-//-----------------------------------------------------------------------------
-// Miscellaneous utility functions
-//-----------------------------------------------------------------------------
-
-qint64 audioDuration(const QAudioFormat &format, qint64 bytes);
-qint64 audioLength(const QAudioFormat &format, qint64 microSeconds);
-
-QString formatToString(const QAudioFormat &format);
-
-qreal nyquistFrequency(const QAudioFormat &format);
-
-// Scale PCM value to [-1.0, 1.0]
-qreal pcmToReal(qint16 pcm);
-
-// Scale real value in [-1.0, 1.0] to PCM
-qint16 realToPcm(qreal real);
-
-// Check whether the audio format is PCM
-bool isPCM(const QAudioFormat &format);
-
-// Check whether the audio format is signed, little-endian, 16-bit PCM
-bool isPCMS16LE(const QAudioFormat &format);
-
-// Compile-time calculation of powers of two
-
-template<int N> class PowerOfTwo
-{ public: static const int Result = PowerOfTwo<N-1>::Result * 2; };
-
-template<> class PowerOfTwo<0>
-{ public: static const int Result = 1; };
-
-
-//-----------------------------------------------------------------------------
-// Debug output
-//-----------------------------------------------------------------------------
-
-class NullDebug
-{
-public:
- template <typename T>
- NullDebug& operator<<(const T&) { return *this; }
-};
-
-inline NullDebug nullDebug() { return NullDebug(); }
-
-#ifdef LOG_ENGINE
-# define ENGINE_DEBUG qDebug()
-#else
-# define ENGINE_DEBUG nullDebug()
-#endif
-
-#ifdef LOG_SPECTRUMANALYSER
-# define SPECTRUMANALYSER_DEBUG qDebug()
-#else
-# define SPECTRUMANALYSER_DEBUG nullDebug()
-#endif
-
-#ifdef LOG_WAVEFORM
-# define WAVEFORM_DEBUG qDebug()
-#else
-# define WAVEFORM_DEBUG nullDebug()
-#endif
-
-#endif // UTILS_H
diff --git a/examples/spectrum/app/waveform.cpp b/examples/spectrum/app/waveform.cpp
deleted file mode 100644
index fe44a4f..0000000
--- a/examples/spectrum/app/waveform.cpp
+++ /dev/null
@@ -1,436 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "waveform.h"
-#include "utils.h"
-#include <QPainter>
-#include <QResizeEvent>
-#include <QDebug>
-
-//#define PAINT_EVENT_TRACE
-#ifdef PAINT_EVENT_TRACE
-# define WAVEFORM_PAINT_DEBUG qDebug()
-#else
-# define WAVEFORM_PAINT_DEBUG nullDebug()
-#endif
-
-Waveform::Waveform(QWidget *parent)
- : QWidget(parent)
- , m_bufferPosition(0)
- , m_bufferLength(0)
- , m_audioPosition(0)
- , m_active(false)
- , m_tileLength(0)
- , m_tileArrayStart(0)
- , m_windowPosition(0)
- , m_windowLength(0)
-{
- setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
- setMinimumHeight(50);
-}
-
-Waveform::~Waveform()
-{
- deletePixmaps();
-}
-
-void Waveform::paintEvent(QPaintEvent * /*event*/)
-{
- QPainter painter(this);
-
- painter.fillRect(rect(), Qt::black);
-
- if (m_active) {
- WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent"
- << "windowPosition" << m_windowPosition
- << "windowLength" << m_windowLength;
- qint64 pos = m_windowPosition;
- const qint64 windowEnd = m_windowPosition + m_windowLength;
- int destLeft = 0;
- int destRight = 0;
- while (pos < windowEnd) {
- const TilePoint point = tilePoint(pos);
- WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "pos" << pos
- << "tileIndex" << point.index
- << "positionOffset" << point.positionOffset
- << "pixelOffset" << point.pixelOffset;
-
- if (point.index != NullIndex) {
- const Tile &tile = m_tiles[point.index];
- if (tile.painted) {
- const qint64 sectionLength = qMin((m_tileLength - point.positionOffset),
- (windowEnd - pos));
- Q_ASSERT(sectionLength > 0);
-
- const int sourceRight = tilePixelOffset(point.positionOffset + sectionLength);
- destRight = windowPixelOffset(pos - m_windowPosition + sectionLength);
-
- QRect destRect = rect();
- destRect.setLeft(destLeft);
- destRect.setRight(destRight);
-
- QRect sourceRect(QPoint(), m_pixmapSize);
- sourceRect.setLeft(point.pixelOffset);
- sourceRect.setRight(sourceRight);
-
- WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "tileIndex" << point.index
- << "source" << point.pixelOffset << sourceRight
- << "dest" << destLeft << destRight;
-
- painter.drawPixmap(destRect, *tile.pixmap, sourceRect);
-
- destLeft = destRight;
-
- if (point.index < m_tiles.count()) {
- pos = tilePosition(point.index + 1);
- WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "pos ->" << pos;
- } else {
- // Reached end of tile array
- WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "reached end of tile array";
- break;
- }
- } else {
- // Passed last tile which is painted
- WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "tile" << point.index << "not painted";
- break;
- }
- } else {
- // pos is past end of tile array
- WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "pos" << pos << "past end of tile array";
- break;
- }
- }
-
- WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "final pos" << pos << "final x" << destRight;
- }
-}
-
-void Waveform::resizeEvent(QResizeEvent *event)
-{
- if (event->size() != event->oldSize())
- createPixmaps(event->size());
-}
-
-void Waveform::initialize(const QAudioFormat &format, qint64 audioBufferSize, qint64 windowDurationUs)
-{
- WAVEFORM_DEBUG << "Waveform::initialize"
- << "audioBufferSize" << audioBufferSize
- << "windowDurationUs" << windowDurationUs;
-
- reset();
-
- m_format = format;
-
- // Calculate tile size
- m_tileLength = audioBufferSize;
-
- // Calculate window size
- m_windowLength = audioLength(m_format, windowDurationUs);
-
- // Calculate number of tiles required
- int nTiles;
- if (m_tileLength > m_windowLength) {
- nTiles = 2;
- } else {
- nTiles = m_windowLength / m_tileLength + 1;
- if (m_windowLength % m_tileLength)
- ++nTiles;
- }
-
- WAVEFORM_DEBUG << "Waveform::initialize"
- << "tileLength" << m_tileLength
- << "windowLength" << m_windowLength
- << "nTiles" << nTiles;
-
- m_pixmaps.fill(0, nTiles);
- m_tiles.resize(nTiles);
-
- createPixmaps(rect().size());
-
- m_active = true;
-}
-
-void Waveform::reset()
-{
- WAVEFORM_DEBUG << "Waveform::reset";
-
- m_bufferPosition = 0;
- m_buffer = QByteArray();
- m_audioPosition = 0;
- m_format = QAudioFormat();
- m_active = false;
- deletePixmaps();
- m_tiles.clear();
- m_tileLength = 0;
- m_tileArrayStart = 0;
- m_windowPosition = 0;
- m_windowLength = 0;
-}
-
-void Waveform::bufferChanged(qint64 position, qint64 length, const QByteArray &buffer)
-{
- WAVEFORM_DEBUG << "Waveform::bufferChanged"
- << "audioPosition" << m_audioPosition
- << "bufferPosition" << position
- << "bufferLength" << length;
- m_bufferPosition = position;
- m_bufferLength = length;
- m_buffer = buffer;
- paintTiles();
-}
-
-void Waveform::audioPositionChanged(qint64 position)
-{
- WAVEFORM_DEBUG << "Waveform::audioPositionChanged"
- << "audioPosition" << position
- << "bufferPosition" << m_bufferPosition
- << "bufferLength" << m_bufferLength;
-
- if (position >= m_bufferPosition) {
- if (position + m_windowLength > m_bufferPosition + m_bufferLength)
- position = qMax(qint64(0), m_bufferPosition + m_bufferLength - m_windowLength);
- m_audioPosition = position;
- setWindowPosition(position);
- }
-}
-
-void Waveform::deletePixmaps()
-{
- QPixmap *pixmap;
- foreach (pixmap, m_pixmaps)
- delete pixmap;
- m_pixmaps.clear();
-}
-
-void Waveform::createPixmaps(const QSize &widgetSize)
-{
- m_pixmapSize = widgetSize;
- m_pixmapSize.setWidth(qreal(widgetSize.width()) * m_tileLength / m_windowLength);
-
- WAVEFORM_DEBUG << "Waveform::createPixmaps"
- << "widgetSize" << widgetSize
- << "pixmapSize" << m_pixmapSize;
-
- Q_ASSERT(m_tiles.count() == m_pixmaps.count());
-
- // (Re)create pixmaps
- for (int i=0; i<m_pixmaps.size(); ++i) {
- delete m_pixmaps[i];
- m_pixmaps[i] = 0;
- m_pixmaps[i] = new QPixmap(m_pixmapSize);
- }
-
- // Update tile pixmap pointers, and mark for repainting
- for (int i=0; i<m_tiles.count(); ++i) {
- m_tiles[i].pixmap = m_pixmaps[i];
- m_tiles[i].painted = false;
- }
-}
-
-void Waveform::setWindowPosition(qint64 position)
-{
- WAVEFORM_DEBUG << "Waveform::setWindowPosition"
- << "old" << m_windowPosition << "new" << position
- << "tileArrayStart" << m_tileArrayStart;
-
- const qint64 oldPosition = m_windowPosition;
- m_windowPosition = position;
-
- if ((m_windowPosition >= oldPosition) &&
- (m_windowPosition - m_tileArrayStart < (m_tiles.count() * m_tileLength))) {
- // Work out how many tiles need to be shuffled
- const qint64 offset = m_windowPosition - m_tileArrayStart;
- const int nTiles = offset / m_tileLength;
- shuffleTiles(nTiles);
- } else {
- resetTiles(m_windowPosition);
- }
-
- if (!paintTiles() && m_windowPosition != oldPosition)
- update();
-}
-
-qint64 Waveform::tilePosition(int index) const
-{
- return m_tileArrayStart + index * m_tileLength;
-}
-
-Waveform::TilePoint Waveform::tilePoint(qint64 position) const
-{
- TilePoint result;
- if (position >= m_tileArrayStart) {
- const qint64 tileArrayEnd = m_tileArrayStart + m_tiles.count() * m_tileLength;
- if (position < tileArrayEnd) {
- const qint64 offsetIntoTileArray = position - m_tileArrayStart;
- result.index = offsetIntoTileArray / m_tileLength;
- Q_ASSERT(result.index >= 0 && result.index <= m_tiles.count());
- result.positionOffset = offsetIntoTileArray % m_tileLength;
- result.pixelOffset = tilePixelOffset(result.positionOffset);
- Q_ASSERT(result.pixelOffset >= 0 && result.pixelOffset <= m_pixmapSize.width());
- }
- }
-
- return result;
-}
-
-int Waveform::tilePixelOffset(qint64 positionOffset) const
-{
- Q_ASSERT(positionOffset >= 0 && positionOffset <= m_tileLength);
- const int result = (qreal(positionOffset) / m_tileLength) * m_pixmapSize.width();
- return result;
-}
-
-int Waveform::windowPixelOffset(qint64 positionOffset) const
-{
- Q_ASSERT(positionOffset >= 0 && positionOffset <= m_windowLength);
- const int result = (qreal(positionOffset) / m_windowLength) * rect().width();
- return result;
-}
-
-bool Waveform::paintTiles()
-{
- WAVEFORM_DEBUG << "Waveform::paintTiles";
- bool updateRequired = false;
-
- for (int i=0; i<m_tiles.count(); ++i) {
- const Tile &tile = m_tiles[i];
- if (!tile.painted) {
- const qint64 tileStart = m_tileArrayStart + i * m_tileLength;
- const qint64 tileEnd = tileStart + m_tileLength;
- if (m_bufferPosition <= tileStart && m_bufferPosition + m_bufferLength >= tileEnd) {
- paintTile(i);
- updateRequired = true;
- }
- }
- }
-
- if (updateRequired)
- update();
-
- return updateRequired;
-}
-
-void Waveform::paintTile(int index)
-{
- const qint64 tileStart = m_tileArrayStart + index * m_tileLength;
-
- WAVEFORM_DEBUG << "Waveform::paintTile"
- << "index" << index
- << "bufferPosition" << m_bufferPosition
- << "bufferLength" << m_bufferLength
- << "start" << tileStart
- << "end" << tileStart + m_tileLength;
-
- Q_ASSERT(m_bufferPosition <= tileStart);
- Q_ASSERT(m_bufferPosition + m_bufferLength >= tileStart + m_tileLength);
-
- Tile &tile = m_tiles[index];
- Q_ASSERT(!tile.painted);
-
- const qint16* base = reinterpret_cast<const qint16*>(m_buffer.constData());
- const qint16* buffer = base + ((tileStart - m_bufferPosition) / 2);
- const int numSamples = m_tileLength / (2 * m_format.channels());
-
- QPainter painter(tile.pixmap);
-
- painter.fillRect(tile.pixmap->rect(), Qt::black);
-
- QPen pen(Qt::white);
- painter.setPen(pen);
-
- // Calculate initial PCM value
- qint16 previousPcmValue = 0;
- if (buffer > base)
- previousPcmValue = *(buffer - m_format.channels());
-
- // Calculate initial point
- const qreal previousRealValue = pcmToReal(previousPcmValue);
- const int originY = ((previousRealValue + 1.0) / 2) * m_pixmapSize.height();
- const QPoint origin(0, originY);
-
- QLine line(origin, origin);
-
- for (int i=0; i<numSamples; ++i) {
- const qint16* ptr = buffer + i * m_format.channels();
-
- const int offset = reinterpret_cast<const char*>(ptr) - m_buffer.constData();
- Q_ASSERT(offset >= 0);
- Q_ASSERT(offset < m_bufferLength);
-
- const qint16 pcmValue = *ptr;
- const qreal realValue = pcmToReal(pcmValue);
-
- const int x = tilePixelOffset(i * 2 * m_format.channels());
- const int y = ((realValue + 1.0) / 2) * m_pixmapSize.height();
-
- line.setP2(QPoint(x, y));
- painter.drawLine(line);
- line.setP1(line.p2());
- }
-
- tile.painted = true;
-}
-
-void Waveform::shuffleTiles(int n)
-{
- WAVEFORM_DEBUG << "Waveform::shuffleTiles" << "n" << n;
-
- while (n--) {
- Tile tile = m_tiles.first();
- tile.painted = false;
- m_tiles.erase(m_tiles.begin());
- m_tiles += tile;
- m_tileArrayStart += m_tileLength;
- }
-
- WAVEFORM_DEBUG << "Waveform::shuffleTiles" << "tileArrayStart" << m_tileArrayStart;
-}
-
-void Waveform::resetTiles(qint64 newStartPos)
-{
- WAVEFORM_DEBUG << "Waveform::resetTiles" << "newStartPos" << newStartPos;
-
- QVector<Tile>::iterator i = m_tiles.begin();
- for ( ; i != m_tiles.end(); ++i)
- i->painted = false;
-
- m_tileArrayStart = newStartPos;
-}
-
diff --git a/examples/spectrum/app/waveform.h b/examples/spectrum/app/waveform.h
deleted file mode 100644
index a3b706d..0000000
--- a/examples/spectrum/app/waveform.h
+++ /dev/null
@@ -1,203 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WAVEFORM_H
-#define WAVEFORM_H
-
-#include <QWidget>
-#include <QtMultimedia/QAudioFormat>
-#include <QPixmap>
-#include <QScopedPointer>
-
-QT_FORWARD_DECLARE_CLASS(QByteArray)
-
-/**
- * Widget which displays a section of the audio waveform.
- *
- * The waveform is rendered on a set of QPixmaps which form a group of tiles
- * whose extent covers the widget. As the audio position is updated, these
- * tiles are scrolled from left to right; when the left-most tile scrolls
- * outside the widget, it is moved to the right end of the tile array and
- * painted with the next section of the waveform.
- */
-class Waveform : public QWidget {
- Q_OBJECT
-public:
- Waveform(QWidget *parent = 0);
- ~Waveform();
-
- // QWidget
- void paintEvent(QPaintEvent *event);
- void resizeEvent(QResizeEvent *event);
-
- void initialize(const QAudioFormat &format, qint64 audioBufferSize, qint64 windowDurationUs);
- void reset();
-
- void setAutoUpdatePosition(bool enabled);
-
-public slots:
- void bufferChanged(qint64 position, qint64 length, const QByteArray &buffer);
- void audioPositionChanged(qint64 position);
-
-private:
- static const int NullIndex = -1;
-
- void deletePixmaps();
-
- /*
- * (Re)create all pixmaps, repaint and update the display.
- * Triggers an update();
- */
- void createPixmaps(const QSize &newSize);
-
- /*
- * Update window position.
- * Triggers an update().
- */
- void setWindowPosition(qint64 position);
-
- /*
- * Base position of tile
- */
- qint64 tilePosition(int index) const;
-
- /*
- * Structure which identifies a point within a given
- * tile.
- */
- struct TilePoint
- {
- TilePoint(int idx = 0, qint64 pos = 0, qint64 pix = 0)
- : index(idx), positionOffset(pos), pixelOffset(pix)
- { }
-
- // Index of tile
- int index;
-
- // Number of bytes from start of tile
- qint64 positionOffset;
-
- // Number of pixels from left of corresponding pixmap
- int pixelOffset;
- };
-
- /*
- * Convert position in m_buffer into a tile index and an offset in pixels
- * into the corresponding pixmap.
- *
- * \param position Offset into m_buffer, in bytes
-
- * If position is outside the tile array, index is NullIndex and
- * offset is zero.
- */
- TilePoint tilePoint(qint64 position) const;
-
- /*
- * Convert offset in bytes into a tile into an offset in pixels
- * within that tile.
- */
- int tilePixelOffset(qint64 positionOffset) const;
-
- /*
- * Convert offset in bytes into the window into an offset in pixels
- * within the widget rect().
- */
- int windowPixelOffset(qint64 positionOffset) const;
-
- /*
- * Paint all tiles which can be painted.
- * \return true iff update() was called
- */
- bool paintTiles();
-
- /*
- * Paint the specified tile
- *
- * \pre Sufficient data is available to completely paint the tile, i.e.
- * m_dataLength is greater than the upper bound of the tile.
- */
- void paintTile(int index);
-
- /*
- * Move the first n tiles to the end of the array, and mark them as not
- * painted.
- */
- void shuffleTiles(int n);
-
- /*
- * Reset tile array
- */
- void resetTiles(qint64 newStartPos);
-
-private:
- qint64 m_bufferPosition;
- qint64 m_bufferLength;
- QByteArray m_buffer;
-
- qint64 m_audioPosition;
- QAudioFormat m_format;
-
- bool m_active;
-
- QSize m_pixmapSize;
- QVector<QPixmap*> m_pixmaps;
-
- struct Tile {
- // Pointer into parent m_pixmaps array
- QPixmap* pixmap;
-
- // Flag indicating whether this tile has been painted
- bool painted;
- };
-
- QVector<Tile> m_tiles;
-
- // Length of audio data in bytes depicted by each tile
- qint64 m_tileLength;
-
- // Position in bytes of the first tile, relative to m_buffer
- qint64 m_tileArrayStart;
-
- qint64 m_windowPosition;
- qint64 m_windowLength;
-
-};
-
-#endif // WAVEFORM_H
diff --git a/examples/spectrum/app/wavfile.cpp b/examples/spectrum/app/wavfile.cpp
deleted file mode 100644
index 7c17ba9..0000000
--- a/examples/spectrum/app/wavfile.cpp
+++ /dev/null
@@ -1,151 +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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qendian.h>
-#include <QVector>
-#include <QDebug>
-#include "utils.h"
-#include "wavfile.h"
-
-struct chunk
-{
- char id[4];
- quint32 size;
-};
-
-struct RIFFHeader
-{
- chunk descriptor; // "RIFF"
- char type[4]; // "WAVE"
-};
-
-struct WAVEHeader
-{
- chunk descriptor;
- quint16 audioFormat;
- quint16 numChannels;
- quint32 sampleRate;
- quint32 byteRate;
- quint16 blockAlign;
- quint16 bitsPerSample;
-};
-
-struct DATAHeader
-{
- chunk descriptor;
-};
-
-struct CombinedHeader
-{
- RIFFHeader riff;
- WAVEHeader wave;
-};
-
-WavFile::WavFile(QObject *parent)
- : QFile(parent)
- , m_headerLength(0)
-{
-
-}
-
-bool WavFile::open(const QString &fileName)
-{
- close();
- setFileName(fileName);
- return QFile::open(QIODevice::ReadOnly) && readHeader();
-}
-
-const QAudioFormat &WavFile::fileFormat() const
-{
- return m_fileFormat;
-}
-
-qint64 WavFile::headerLength() const
-{
-return m_headerLength;
-}
-
-bool WavFile::readHeader()
-{
- seek(0);
- CombinedHeader header;
- bool result = read(reinterpret_cast<char *>(&header), sizeof(CombinedHeader)) == sizeof(CombinedHeader);
- if (result) {
- if ((memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0
- || memcmp(&header.riff.descriptor.id, "RIFX", 4) == 0)
- && memcmp(&header.riff.type, "WAVE", 4) == 0
- && memcmp(&header.wave.descriptor.id, "fmt ", 4) == 0
- && (header.wave.audioFormat == 1 || header.wave.audioFormat == 0)) {
-
- // Read off remaining header information
- DATAHeader dataHeader;
-
- if (qFromLittleEndian<quint32>(header.wave.descriptor.size) > sizeof(WAVEHeader)) {
- // Extended data available
- quint16 extraFormatBytes;
- if (peek((char*)&extraFormatBytes, sizeof(quint16)) != sizeof(quint16))
- return false;
- const qint64 throwAwayBytes = sizeof(quint16) + qFromLittleEndian<quint16>(extraFormatBytes);
- if (read(throwAwayBytes).size() != throwAwayBytes)
- return false;
- }
-
- if (read((char*)&dataHeader, sizeof(DATAHeader)) != sizeof(DATAHeader))
- return false;
-
- // Establish format
- if (memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0)
- m_fileFormat.setByteOrder(QAudioFormat::LittleEndian);
- else
- m_fileFormat.setByteOrder(QAudioFormat::BigEndian);
-
- int bps = qFromLittleEndian<quint16>(header.wave.bitsPerSample);
- m_fileFormat.setChannels(qFromLittleEndian<quint16>(header.wave.numChannels));
- m_fileFormat.setCodec("audio/pcm");
- m_fileFormat.setFrequency(qFromLittleEndian<quint32>(header.wave.sampleRate));
- m_fileFormat.setSampleSize(qFromLittleEndian<quint16>(header.wave.bitsPerSample));
- m_fileFormat.setSampleType(bps == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt);
- } else {
- result = false;
- }
- }
- m_headerLength = pos();
- return result;
-}
diff --git a/examples/spectrum/app/wavfile.h b/examples/spectrum/app/wavfile.h
deleted file mode 100644
index b974c47..0000000
--- a/examples/spectrum/app/wavfile.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef WAVFILE_H
-#define WAVFILE_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qfile.h>
-#include <QtMultimedia/qaudioformat.h>
-
-class WavFile : public QFile
-{
-public:
- WavFile(QObject *parent = 0);
-
- bool open(const QString &fileName);
- const QAudioFormat &fileFormat() const;
- qint64 headerLength() const;
-
-private:
- bool readHeader();
-
-private:
- QAudioFormat m_fileFormat;
- qint64 m_headerLength;
-
-};
-
-#endif
-
diff --git a/examples/spectrum/spectrum.pri b/examples/spectrum/spectrum.pri
deleted file mode 100644
index 75c0113..0000000
--- a/examples/spectrum/spectrum.pri
+++ /dev/null
@@ -1,49 +0,0 @@
-# The following macros allow certain features and debugging output
-# to be disabled / enabled at compile time.
-
-# Debug output from spectrum calculation
-DEFINES += LOG_SPECTRUMANALYSER
-
-# Debug output from waveform generation
-#DEFINES += LOG_WAVEFORM
-
-# Debug output from engine
-DEFINES += LOG_ENGINE
-
-# Dump input data to spectrum analyer, plus artefact data files
-#DEFINES += DUMP_SPECTRUMANALYSER
-
-# Dump captured audio data
-#DEFINES += DUMP_CAPTURED_AUDIO
-
-# Disable calculation of level
-#DEFINES += DISABLE_LEVEL
-
-# Disable calculation of frequency spectrum
-# If this macro is defined, the FFTReal DLL will not be built
-#DEFINES += DISABLE_FFT
-
-# Disables rendering of the waveform
-#DEFINES += DISABLE_WAVEFORM
-
-# If defined, superimpose the progress bar on the waveform
-DEFINES += SUPERIMPOSE_PROGRESS_ON_WAVEFORM
-
-# Perform spectrum analysis calculation in a separate thread
-DEFINES += SPECTRUM_ANALYSER_SEPARATE_THREAD
-
-# Suppress warnings about strncpy potentially being unsafe, emitted by MSVC
-win32: DEFINES += _CRT_SECURE_NO_WARNINGS
-
-win32 {
- # spectrum_build_dir is defined with a leading slash so that it can
- # be used in contexts such as
- # ..$${spectrum_build_dir}
- # without the result having a trailing slash where spectrum_build_dir
- # is undefined.
- build_pass {
- CONFIG(release, release|debug): spectrum_build_dir = /release
- CONFIG(debug, release|debug): spectrum_build_dir = /debug
- }
-}
-
diff --git a/examples/spectrum/spectrum.pro b/examples/spectrum/spectrum.pro
deleted file mode 100644
index 662d652..0000000
--- a/examples/spectrum/spectrum.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-include(spectrum.pri)
-
-TEMPLATE = subdirs
-
-# Ensure that library is built before application
-CONFIG += ordered
-
-!contains(DEFINES, DISABLE_FFT) {
- SUBDIRS += 3rdparty/fftreal
-}
-
-SUBDIRS += app
-
-TARGET = spectrum
-
-sources.files = README.txt spectrum.pri spectrum.pro TODO.txt
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/spectrum
-INSTALLS += sources
-
-QT+=widgets
diff --git a/examples/videographicsitem/main.cpp b/examples/videographicsitem/main.cpp
deleted file mode 100644
index 78721da..0000000
--- a/examples/videographicsitem/main.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "videoplayer.h"
-
-#include <QtWidgets/QApplication>
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- VideoPlayer player;
- player.show();
-
- return app.exec();
-}
-
diff --git a/examples/videographicsitem/videographicsitem.pro b/examples/videographicsitem/videographicsitem.pro
deleted file mode 100644
index 66ed4f6..0000000
--- a/examples/videographicsitem/videographicsitem.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-TEMPLATE = app
-TARGET = videographicsitem
-
-QT += multimedia multimediawidgets
-
-contains(QT_CONFIG, opengl): QT += opengl
-
-HEADERS += videoplayer.h \
- videoitem.h
-
-SOURCES += main.cpp \
- videoplayer.cpp \
- videoitem.cpp
-
-target.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/videographicsitem
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/videographicsitem
-
-INSTALLS += target sources
-
-QT+=widgets
diff --git a/examples/videographicsitem/videoitem.cpp b/examples/videographicsitem/videoitem.cpp
deleted file mode 100644
index d314ac0..0000000
--- a/examples/videographicsitem/videoitem.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "videoitem.h"
-
-#include <QtWidgets>
-#include <qvideosurfaceformat.h>
-
-VideoItem::VideoItem(QGraphicsItem *parent)
- : QGraphicsItem(parent)
- , imageFormat(QImage::Format_Invalid)
- , framePainted(false)
-{
-}
-
-VideoItem::~VideoItem()
-{
-}
-
-QRectF VideoItem::boundingRect() const
-{
- return QRectF(QPointF(0,0), surfaceFormat().sizeHint());
-}
-
-void VideoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(option);
- Q_UNUSED(widget);
-
- if (currentFrame.map(QAbstractVideoBuffer::ReadOnly)) {
- const QTransform oldTransform = painter->transform();
-
- if (surfaceFormat().scanLineDirection() == QVideoSurfaceFormat::BottomToTop) {
- painter->scale(1, -1);
- painter->translate(0, -boundingRect().height());
- }
-
- painter->drawImage(boundingRect(), QImage(
- currentFrame.bits(),
- imageSize.width(),
- imageSize.height(),
- imageFormat));
-
- painter->setTransform(oldTransform);
-
- framePainted = true;
-
- currentFrame.unmap();
- }
-}
-
-QList<QVideoFrame::PixelFormat> VideoItem::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
-{
- if (handleType == QAbstractVideoBuffer::NoHandle) {
- return QList<QVideoFrame::PixelFormat>()
- << QVideoFrame::Format_RGB32
- << QVideoFrame::Format_ARGB32
- << QVideoFrame::Format_ARGB32_Premultiplied
- << QVideoFrame::Format_RGB565
- << QVideoFrame::Format_RGB555;
- } else {
- return QList<QVideoFrame::PixelFormat>();
- }
-}
-
-bool VideoItem::start(const QVideoSurfaceFormat &format)
-{
- if (isFormatSupported(format)) {
- imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
- imageSize = format.frameSize();
- framePainted = true;
-
- QAbstractVideoSurface::start(format);
-
- prepareGeometryChange();
-
- return true;
- } else {
- return false;
- }
-}
-
-void VideoItem::stop()
-{
- currentFrame = QVideoFrame();
- framePainted = false;
-
- QAbstractVideoSurface::stop();
-}
-
-bool VideoItem::present(const QVideoFrame &frame)
-{
- if (!framePainted) {
- if (!QAbstractVideoSurface::isActive())
- setError(StoppedError);
-
- return false;
- } else {
- currentFrame = frame;
- framePainted = false;
-
- update();
-
- return true;
- }
-}
diff --git a/examples/videographicsitem/videoitem.h b/examples/videographicsitem/videoitem.h
deleted file mode 100644
index 48215a1..0000000
--- a/examples/videographicsitem/videoitem.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VIDEOITEM_H
-#define VIDEOITEM_H
-
-#include <qabstractvideosurface.h>
-#include <QtWidgets/QGraphicsItem>
-
-class VideoItem
- : public QAbstractVideoSurface,
- public QGraphicsItem
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsItem)
-public:
- explicit VideoItem(QGraphicsItem *parentItem = 0);
- ~VideoItem();
-
- QRectF boundingRect() const;
- void paint(
- QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
-
- //video surface
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const;
-
- bool start(const QVideoSurfaceFormat &format);
- void stop();
- bool present(const QVideoFrame &frame);
-
-private:
- QImage::Format imageFormat;
- QSize imageSize;
-
- QVideoFrame currentFrame;
- bool framePainted;
-};
-
-#endif
-
diff --git a/examples/videographicsitem/videoplayer.cpp b/examples/videographicsitem/videoplayer.cpp
deleted file mode 100644
index b406d51..0000000
--- a/examples/videographicsitem/videoplayer.cpp
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "videoplayer.h"
-#include "videoitem.h"
-
-#include <QtWidgets>
-#include <qvideosurfaceformat.h>
-
-#if !defined(QT_NO_OPENGL)
-# include <QtOpenGL/QGLWidget>
-#endif
-
-VideoPlayer::VideoPlayer(QWidget *parent, Qt::WindowFlags flags)
- : QWidget(parent, flags)
- , mediaPlayer(0, QMediaPlayer::VideoSurface)
- , videoItem(0)
- , playButton(0)
- , positionSlider(0)
-{
- videoItem = new VideoItem;
-
- QGraphicsScene *scene = new QGraphicsScene(this);
- QGraphicsView *graphicsView = new QGraphicsView(scene);
-
-#if !defined(QT_NO_OPENGL)
- graphicsView->setViewport(new QGLWidget);
-#endif
-
- scene->addItem(videoItem);
-
- QSlider *rotateSlider = new QSlider(Qt::Horizontal);
- rotateSlider->setRange(-180, 180);
- rotateSlider->setValue(0);
-
- connect(rotateSlider, SIGNAL(valueChanged(int)),
- this, SLOT(rotateVideo(int)));
-
- QAbstractButton *openButton = new QPushButton(tr("Open..."));
- connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));
-
- playButton = new QPushButton;
- playButton->setEnabled(false);
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
-
- connect(playButton, SIGNAL(clicked()),
- this, SLOT(play()));
-
- positionSlider = new QSlider(Qt::Horizontal);
- positionSlider->setRange(0, 0);
-
- connect(positionSlider, SIGNAL(sliderMoved(int)),
- this, SLOT(setPosition(int)));
-
- QBoxLayout *controlLayout = new QHBoxLayout;
- controlLayout->setMargin(0);
- controlLayout->addWidget(openButton);
- controlLayout->addWidget(playButton);
- controlLayout->addWidget(positionSlider);
-
- QBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(graphicsView);
- layout->addWidget(rotateSlider);
- layout->addLayout(controlLayout);
-
- setLayout(layout);
-
- mediaPlayer.setVideoOutput(videoItem);
- connect(&mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)),
- this, SLOT(mediaStateChanged(QMediaPlayer::State)));
- connect(&mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
- connect(&mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
-}
-
-VideoPlayer::~VideoPlayer()
-{
-}
-
-
-void VideoPlayer::openFile()
-{
- QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie"),QDir::homePath());
-
- if (!fileName.isEmpty()) {
- mediaPlayer.setMedia(QUrl::fromLocalFile(fileName));
-
- playButton->setEnabled(true);
- }
-}
-
-void VideoPlayer::play()
-{
- switch(mediaPlayer.state()) {
- case QMediaPlayer::PlayingState:
- mediaPlayer.pause();
- break;
- default:
- mediaPlayer.play();
- break;
- }
-}
-
-void VideoPlayer::mediaStateChanged(QMediaPlayer::State state)
-{
- switch(state) {
- case QMediaPlayer::PlayingState:
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
- break;
- default:
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
- break;
- }
-}
-
-void VideoPlayer::positionChanged(qint64 position)
-{
- positionSlider->setValue(position);
-}
-
-void VideoPlayer::durationChanged(qint64 duration)
-{
- positionSlider->setRange(0, duration);
-}
-
-void VideoPlayer::setPosition(int position)
-{
- mediaPlayer.setPosition(position);
-}
-
-
-void VideoPlayer::rotateVideo(int angle)
-{
- //rotate around the center of video element
- qreal x = videoItem->boundingRect().width() / 2.0;
- qreal y = videoItem->boundingRect().height() / 2.0;
- videoItem->setTransform(QTransform().translate(x, y).rotate(angle).translate(-x, -y));
-}
diff --git a/examples/videographicsitem/videoplayer.h b/examples/videographicsitem/videoplayer.h
deleted file mode 100644
index e08a9dd..0000000
--- a/examples/videographicsitem/videoplayer.h
+++ /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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VIDEOPLAYER_H
-#define VIDEOPLAYER_H
-
-#include <qmediaplayer.h>
-
-#include <QtGui/QMovie>
-#include <QtWidgets/QWidget>
-
-QT_BEGIN_NAMESPACE
-class QAbstractButton;
-class QSlider;
-QT_END_NAMESPACE
-
-
-class VideoItem;
-
-class VideoPlayer : public QWidget
-{
- Q_OBJECT
-public:
- VideoPlayer(QWidget *parent = 0, Qt::WindowFlags flags = 0);
- ~VideoPlayer();
-
- QSize sizeHint() const { return QSize(800, 600); }
-
-public slots:
- void openFile();
- void play();
-
-private slots:
- void mediaStateChanged(QMediaPlayer::State state);
- void positionChanged(qint64 position);
- void durationChanged(qint64 duration);
- void setPosition(int position);
- void rotateVideo(int angle);
-
-private:
- QMediaPlayer mediaPlayer;
- VideoItem *videoItem;
- QAbstractButton *playButton;
- QSlider *positionSlider;
-};
-
-#endif
-
diff --git a/examples/videowidget/main.cpp b/examples/videowidget/main.cpp
deleted file mode 100644
index 725e637..0000000
--- a/examples/videowidget/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "videoplayer.h"
-
-#include <QtWidgets/QApplication>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- VideoPlayer player;
- player.show();
-
- return app.exec();
-}
diff --git a/examples/videowidget/videoplayer.cpp b/examples/videowidget/videoplayer.cpp
deleted file mode 100644
index 589d0c9..0000000
--- a/examples/videowidget/videoplayer.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "videoplayer.h"
-
-#include "videowidget.h"
-
-#include <QtWidgets>
-#include <qvideosurfaceformat.h>
-
-VideoPlayer::VideoPlayer(QWidget *parent)
- : QWidget(parent)
- , mediaPlayer(0, QMediaPlayer::VideoSurface)
- , playButton(0)
- , positionSlider(0)
-{
- VideoWidget *videoWidget = new VideoWidget;
-
- QAbstractButton *openButton = new QPushButton(tr("Open..."));
- connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));
-
- playButton = new QPushButton;
- playButton->setEnabled(false);
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
-
- connect(playButton, SIGNAL(clicked()),
- this, SLOT(play()));
-
- positionSlider = new QSlider(Qt::Horizontal);
- positionSlider->setRange(0, 0);
-
- connect(positionSlider, SIGNAL(sliderMoved(int)),
- this, SLOT(setPosition(int)));
-
- QBoxLayout *controlLayout = new QHBoxLayout;
- controlLayout->setMargin(0);
- controlLayout->addWidget(openButton);
- controlLayout->addWidget(playButton);
- controlLayout->addWidget(positionSlider);
-
- QBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(videoWidget);
- layout->addLayout(controlLayout);
-
- setLayout(layout);
-
- mediaPlayer.setVideoOutput(videoWidget->videoSurface());
- connect(&mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)),
- this, SLOT(mediaStateChanged(QMediaPlayer::State)));
- connect(&mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
- connect(&mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
-}
-
-VideoPlayer::~VideoPlayer()
-{
-}
-
-void VideoPlayer::openFile()
-{
- QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie"),QDir::homePath());
-
- if (!fileName.isEmpty()) {
- mediaPlayer.setMedia(QUrl::fromLocalFile(fileName));
-
- playButton->setEnabled(true);
- }
-}
-
-void VideoPlayer::play()
-{
- switch(mediaPlayer.state()) {
- case QMediaPlayer::PlayingState:
- mediaPlayer.pause();
- break;
- default:
- mediaPlayer.play();
- break;
- }
-}
-
-void VideoPlayer::mediaStateChanged(QMediaPlayer::State state)
-{
- switch(state) {
- case QMediaPlayer::PlayingState:
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause));
- break;
- default:
- playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
- break;
- }
-}
-
-void VideoPlayer::positionChanged(qint64 position)
-{
- positionSlider->setValue(position);
-}
-
-void VideoPlayer::durationChanged(qint64 duration)
-{
- positionSlider->setRange(0, duration);
-}
-
-void VideoPlayer::setPosition(int position)
-{
- mediaPlayer.setPosition(position);
-}
diff --git a/examples/videowidget/videoplayer.h b/examples/videowidget/videoplayer.h
deleted file mode 100644
index 573baa1..0000000
--- a/examples/videowidget/videoplayer.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VIDEOPLAYER_H
-#define VIDEOPLAYER_H
-
-#include <qmediaplayer.h>
-
-#include <QtGui/QMovie>
-#include <QtWidgets/QWidget>
-
-QT_BEGIN_NAMESPACE
-class QAbstractButton;
-class QSlider;
-QT_END_NAMESPACE
-
-class VideoPlayer : public QWidget
-{
- Q_OBJECT
-public:
- VideoPlayer(QWidget *parent = 0);
- ~VideoPlayer();
-
-public slots:
- void openFile();
- void play();
-
-private slots:
- void mediaStateChanged(QMediaPlayer::State state);
- void positionChanged(qint64 position);
- void durationChanged(qint64 duration);
- void setPosition(int position);
-
-private:
- QMediaPlayer mediaPlayer;
- QAbstractButton *playButton;
- QSlider *positionSlider;
-};
-
-#endif
diff --git a/examples/videowidget/videowidget.cpp b/examples/videowidget/videowidget.cpp
deleted file mode 100644
index 3b4fdfb..0000000
--- a/examples/videowidget/videowidget.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "videowidget.h"
-
-#include "videowidgetsurface.h"
-
-#include <QtWidgets>
-#include <qvideosurfaceformat.h>
-
-//! [0]
-VideoWidget::VideoWidget(QWidget *parent)
- : QWidget(parent)
- , surface(0)
-{
- setAutoFillBackground(false);
- setAttribute(Qt::WA_NoSystemBackground, true);
- setAttribute(Qt::WA_PaintOnScreen, true);
-
- QPalette palette = this->palette();
- palette.setColor(QPalette::Background, Qt::black);
- setPalette(palette);
-
- setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
-
- surface = new VideoWidgetSurface(this);
-}
-//! [0]
-
-//! [1]
-VideoWidget::~VideoWidget()
-{
- delete surface;
-}
-//! [1]
-
-//! [2]
-QSize VideoWidget::sizeHint() const
-{
- return surface->surfaceFormat().sizeHint();
-}
-//! [2]
-
-
-//! [3]
-void VideoWidget::paintEvent(QPaintEvent *event)
-{
- QPainter painter(this);
-
- if (surface->isActive()) {
- const QRect videoRect = surface->videoRect();
-
- if (!videoRect.contains(event->rect())) {
- QRegion region = event->region();
- region.subtract(videoRect);
-
- QBrush brush = palette().background();
-
- foreach (const QRect &rect, region.rects())
- painter.fillRect(rect, brush);
- }
-
- surface->paint(&painter);
- } else {
- painter.fillRect(event->rect(), palette().background());
- }
-}
-//! [3]
-
-//! [4]
-void VideoWidget::resizeEvent(QResizeEvent *event)
-{
- QWidget::resizeEvent(event);
-
- surface->updateVideoRect();
-}
-//! [4]
diff --git a/examples/videowidget/videowidget.h b/examples/videowidget/videowidget.h
deleted file mode 100644
index 87987cb..0000000
--- a/examples/videowidget/videowidget.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VIDEOWIDGET_H
-#define VIDEOWIDGET_H
-
-#include "videowidgetsurface.h"
-
-#include <QtWidgets/QWidget>
-
-QT_BEGIN_NAMESPACE
-class QAbstractVideoSurface;
-QT_END_NAMESPACE
-
-class VideoWidgetSurface;
-
-//! [0]
-class VideoWidget : public QWidget
-{
- Q_OBJECT
-public:
- VideoWidget(QWidget *parent = 0);
- ~VideoWidget();
-
- QAbstractVideoSurface *videoSurface() const { return surface; }
-
- QSize sizeHint() const;
-
-protected:
- void paintEvent(QPaintEvent *event);
- void resizeEvent(QResizeEvent *event);
-
-private:
- VideoWidgetSurface *surface;
-};
-//! [0]
-
-#endif
diff --git a/examples/videowidget/videowidget.pro b/examples/videowidget/videowidget.pro
deleted file mode 100644
index 76e5f36..0000000
--- a/examples/videowidget/videowidget.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-TEMPLATE = app
-TARGET = videowidget
-
-QT += multimedia multimediawidgets
-
-HEADERS = \
- videoplayer.h \
- videowidget.h \
- videowidgetsurface.h
-
-SOURCES = \
- main.cpp \
- videoplayer.cpp \
- videowidget.cpp \
- videowidgetsurface.cpp
-
-target.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/videowidget
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtmultimedia/videowidget
-
-INSTALLS += target sources
-
-QT+=widgets
diff --git a/examples/videowidget/videowidgetsurface.cpp b/examples/videowidget/videowidgetsurface.cpp
deleted file mode 100644
index a0b71bf..0000000
--- a/examples/videowidget/videowidgetsurface.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "videowidgetsurface.h"
-
-#include <QtWidgets>
-#include <qabstractvideosurface.h>
-#include <qvideosurfaceformat.h>
-
-VideoWidgetSurface::VideoWidgetSurface(QWidget *widget, QObject *parent)
- : QAbstractVideoSurface(parent)
- , widget(widget)
- , imageFormat(QImage::Format_Invalid)
-{
-}
-
-//! [0]
-QList<QVideoFrame::PixelFormat> VideoWidgetSurface::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
-{
- if (handleType == QAbstractVideoBuffer::NoHandle) {
- return QList<QVideoFrame::PixelFormat>()
- << QVideoFrame::Format_RGB32
- << QVideoFrame::Format_ARGB32
- << QVideoFrame::Format_ARGB32_Premultiplied
- << QVideoFrame::Format_RGB565
- << QVideoFrame::Format_RGB555;
- } else {
- return QList<QVideoFrame::PixelFormat>();
- }
-}
-//! [0]
-
-//! [1]
-bool VideoWidgetSurface::isFormatSupported(
- const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const
-{
- Q_UNUSED(similar);
-
- const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
- const QSize size = format.frameSize();
-
- return imageFormat != QImage::Format_Invalid
- && !size.isEmpty()
- && format.handleType() == QAbstractVideoBuffer::NoHandle;
-}
-//! [1]
-
-//! [2]
-bool VideoWidgetSurface::start(const QVideoSurfaceFormat &format)
-{
- const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
- const QSize size = format.frameSize();
-
- if (imageFormat != QImage::Format_Invalid && !size.isEmpty()) {
- this->imageFormat = imageFormat;
- imageSize = size;
- sourceRect = format.viewport();
-
- QAbstractVideoSurface::start(format);
-
- widget->updateGeometry();
- updateVideoRect();
-
- return true;
- } else {
- return false;
- }
-}
-//! [2]
-
-//! [3]
-void VideoWidgetSurface::stop()
-{
- currentFrame = QVideoFrame();
- targetRect = QRect();
-
- QAbstractVideoSurface::stop();
-
- widget->update();
-}
-//! [3]
-
-//! [4]
-bool VideoWidgetSurface::present(const QVideoFrame &frame)
-{
- if (surfaceFormat().pixelFormat() != frame.pixelFormat()
- || surfaceFormat().frameSize() != frame.size()) {
- setError(IncorrectFormatError);
- stop();
-
- return false;
- } else {
- currentFrame = frame;
-
- widget->repaint(targetRect);
-
- return true;
- }
-}
-//! [4]
-
-//! [5]
-void VideoWidgetSurface::updateVideoRect()
-{
- QSize size = surfaceFormat().sizeHint();
- size.scale(widget->size().boundedTo(size), Qt::KeepAspectRatio);
-
- targetRect = QRect(QPoint(0, 0), size);
- targetRect.moveCenter(widget->rect().center());
-}
-//! [5]
-
-//! [6]
-void VideoWidgetSurface::paint(QPainter *painter)
-{
- if (currentFrame.map(QAbstractVideoBuffer::ReadOnly)) {
- const QTransform oldTransform = painter->transform();
-
- if (surfaceFormat().scanLineDirection() == QVideoSurfaceFormat::BottomToTop) {
- painter->scale(1, -1);
- painter->translate(0, -widget->height());
- }
-
- QImage image(
- currentFrame.bits(),
- currentFrame.width(),
- currentFrame.height(),
- currentFrame.bytesPerLine(),
- imageFormat);
-
- painter->drawImage(targetRect, image, sourceRect);
-
- painter->setTransform(oldTransform);
-
- currentFrame.unmap();
- }
-}
-//! [6]
diff --git a/examples/videowidget/videowidgetsurface.h b/examples/videowidget/videowidgetsurface.h
deleted file mode 100644
index d10db39..0000000
--- a/examples/videowidget/videowidgetsurface.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 examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VIDEOWIDGETSURFACE_H
-#define VIDEOWIDGETSURFACE_H
-
-#include <QtCore/QRect>
-#include <QtGui/QImage>
-#include <qabstractvideosurface.h>
-#include <qvideoframe.h>
-
-//! [0]
-class VideoWidgetSurface : public QAbstractVideoSurface
-{
- Q_OBJECT
-public:
- VideoWidgetSurface(QWidget *widget, QObject *parent = 0);
-
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const;
- bool isFormatSupported(const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const;
-
- bool start(const QVideoSurfaceFormat &format);
- void stop();
-
- bool present(const QVideoFrame &frame);
-
- QRect videoRect() const { return targetRect; }
- void updateVideoRect();
-
- void paint(QPainter *painter);
-
-private:
- QWidget *widget;
- QImage::Format imageFormat;
- QRect targetRect;
- QSize imageSize;
- QRect sourceRect;
- QVideoFrame currentFrame;
-};
-//! [0]
-
-#endif
diff --git a/modules/qt_multimedia.pri b/modules/qt_multimedia.pri
deleted file mode 100644
index cb87b0a..0000000
--- a/modules/qt_multimedia.pri
+++ /dev/null
@@ -1,17 +0,0 @@
-QT.multimedia.VERSION = 5.0.0
-QT.multimedia.MAJOR_VERSION = 5
-QT.multimedia.MINOR_VERSION = 0
-QT.multimedia.PATCH_VERSION = 0
-
-QT.multimedia.name = QtMultimedia
-QT.multimedia.bins = $$QT_MODULE_BIN_BASE
-QT.multimedia.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/QtMultimedia
-QT.multimedia.private_includes = $$QT_MODULE_INCLUDE_BASE/QtMultimedia/$$QT.multimedia.VERSION
-QT.multimedia.sources = $$QT_MODULE_BASE/src/multimedia
-QT.multimedia.libs = $$QT_MODULE_LIB_BASE
-QT.multimedia.plugins = $$QT_MODULE_PLUGIN_BASE
-QT.multimedia.imports = $$QT_MODULE_IMPORT_BASE
-QT.multimedia.depends = gui network
-QT.multimedia.DEFINES = QT_MULTIMEDIA_LIB
-
-QT_CONFIG += multimedia
diff --git a/modules/qt_multimediawidgets.pri b/modules/qt_multimediawidgets.pri
deleted file mode 100644
index 4dcbf41..0000000
--- a/modules/qt_multimediawidgets.pri
+++ /dev/null
@@ -1,17 +0,0 @@
-QT.multimediawidgets.VERSION = 5.0.0
-QT.multimediawidgets.MAJOR_VERSION = 5
-QT.multimediawidgets.MINOR_VERSION = 0
-QT.multimediawidgets.PATCH_VERSION = 0
-
-QT.multimediawidgets.name = QtMultimediaWidgets
-QT.multimediawidgets.bins = $$QT_MODULE_BIN_BASE
-QT.multimediawidgets.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/QtMultimediaWidgets
-QT.multimediawidgets.private_includes = $$QT_MODULE_INCLUDE_BASE/QtMultimediaWidgets/$$QT.multimediawidgets.VERSION
-QT.multimediawidgets.sources = $$QT_MODULE_BASE/src/multimediawidgets
-QT.multimediawidgets.libs = $$QT_MODULE_LIB_BASE
-QT.multimediawidgets.plugins = $$QT_MODULE_PLUGIN_BASE
-QT.multimediawidgets.imports = $$QT_MODULE_IMPORT_BASE
-QT.multimediawidgets.depends = gui network
-QT.multimediawidgets.DEFINES = QT_MULTIMEDIAWIDGETS_LIB
-
-QT_CONFIG += multimediawidgets
diff --git a/qtmultimedia.pro b/qtmultimedia.pro
deleted file mode 100644
index 0a2ca05..0000000
--- a/qtmultimedia.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-TEMPLATE = subdirs
-
-module_qtmultimedia_src.subdir = src
-module_qtmultimedia_src.target = module-qtmultimedia-src
-
-module_qtmultimedia_examples.subdir = examples
-module_qtmultimedia_examples.target = module-qtmultimedia-examples
-module_qtmultimedia_examples.depends = module_qtmultimedia_src
-!contains(QT_BUILD_PARTS,examples) {
- module_qtmultimedia_examples.CONFIG = no_default_target no_default_install
-}
-
-module_qtmultimedia_tests.subdir = tests
-module_qtmultimedia_tests.target = module-qtmultimedia-tests
-module_qtmultimedia_tests.depends = module_qtmultimedia_src
-module_qtmultimedia_tests.CONFIG = no_default_install
-!contains(QT_BUILD_PARTS,tests):module_qtmultimedia_tests.CONFIG += no_default_target
-
-SUBDIRS += module_qtmultimedia_src \
- module_qtmultimedia_examples \
- module_qtmultimedia_tests \
-
-include(doc/config/qtmultimedia_doc.pri)
diff --git a/qtmultimediakit.pro b/qtmultimediakit.pro
deleted file mode 100644
index 55aa220..0000000
--- a/qtmultimediakit.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-# This is only so that Qt5.git still builds, since it's expecting
-# the .pro file to match the directory name
-include(qtmultimedia.pro)
-
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
-
diff --git a/sync.profile b/sync.profile
deleted file mode 100644
index cd48b0b..0000000
--- a/sync.profile
+++ /dev/null
@@ -1,53 +0,0 @@
-%modules = ( # path to module name map
- "QtMultimedia" => "$basedir/src/multimedia",
- "QtMultimediaWidgets" => "$basedir/src/multimediawidgets",
-);
-
-%moduleheaders = ( # restrict the module headers to those found in relative path
-);
-
-%classnames = (
- "qtmultimediaversion.h" => "QtMultimediaVersion",
- "qtmultimediawidgetsversion.h" => "QtMultimediaWidgetsVersion",
-);
-
-%mastercontent = (
- "gui" => "#include <QtGui/QtGui>\n",
- "network" => "#include <QtNetwork/QtNetwork>\n",
- "core" => "#include <QtCore/QtCore>\n",
-);
-
-%modulepris = (
- "QtMultimedia" => "$basedir/modules/qt_multimedia.pri",
- "QtMultimediaWidgets" => "$basedir/modules/qt_multimediawidgets.pri",
-);
-
-# Module dependencies.
-# Every module that is required to build this module should have one entry.
-# Each of the module version specifiers can take one of the following values:
-# - A specific Git revision.
-# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
-#
-%dependencies = (
- "qtbase" => "refs/heads/master",
- "qtsvg" => "refs/heads/master",
- "qtxmlpatterns" => "refs/heads/master",
- "qtdeclarative" => "refs/heads/master",
-);
-# Compile tests
-%configtests = (
- # Windows tests
- "directshow" => {},
- "wmsdk" => {},
- "wmp" => {},
- "wmf" => {},
- "evr" => {},
-
- # Linux tests
- "alsa" => {},
- "gstreamer" => {},
- "gstreamer_photography" => {},
- "gstreamer_appsrc" => {},
- "pulseaudio" => {},
- "resourcepolicy" => {},
-);
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
deleted file mode 100644
index affd4e3..0000000
--- a/tests/auto/auto.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += multimedia.pro
-contains(QT_CONFIG,multimediawidgets): SUBDIRS += multimediawidgets.pro
-
-# These autotests consist of things such as static code checks
-# which require that the autotest is run on the same machine
-# doing the build - i.e. cross-compilation is not allowed.
-win32|mac|linux-g++* {
- # NOTE: Disabled until we have established which tests fall into this category
- # !contains(QT_CONFIG,embedded):!maemo5:!maemo6:SUBDIRS+=host.pro
-}
diff --git a/tests/auto/multimedia.pro b/tests/auto/multimedia.pro
deleted file mode 100644
index 07289e2..0000000
--- a/tests/auto/multimedia.pro
+++ /dev/null
@@ -1,57 +0,0 @@
-
-TEMPLATE = subdirs
-SUBDIRS += \
- qabstractvideobuffer \
- qabstractvideosurface \
- qaudiocapturesource \
- qaudiodeviceinfo \
- qaudioformat \
- qaudioinput \
- qaudiooutput \
- qmediabindableinterface \
- qmediacontainercontrol \
- qmediacontent \
- qmediaplayerbackend \
- qmediaplaylistnavigator \
- qmediarecorder \
- qmediaresource \
- qmediaservice \
- qmediatimerange \
- qradiotuner \
- qradiodata \
- qvideoframe \
- qvideosurfaceformat \
- qmetadatareadercontrol \
- qmetadatawritercontrol \
- qmediaplayer \
- qcameraimagecapture \
- qmediaobject \
- qcamera \
- qcamerabackend \
- qwavedecoder
-
-# These is disabled until intent is clearer
-# qvideodevicecontrol \
-# qvideoencodercontrol \
-
-# This is a commment for the mock backend directory so that maketestselftest
-# doesn't believe it's an untested directory
-# qmultimedia_common
-
-
-# Tests depending on private interfaces should only be built if
-# these interfaces are exported.
-contains (QT_CONFIG, private_tests) {
- SUBDIRS += \
- qmediaplaylist \
- qmediapluginloader \
- qmediaimageviewer \
- qmediaserviceprovider
-
- contains (QT_CONFIG, declarative) {
- # All the declarative tests depend on private interfaces
- SUBDIRS += \
- qsoundeffect \
- qdeclarativeaudio
- }
-}
diff --git a/tests/auto/multimediawidgets.pro b/tests/auto/multimediawidgets.pro
deleted file mode 100644
index 5a55ecc..0000000
--- a/tests/auto/multimediawidgets.pro
+++ /dev/null
@@ -1,25 +0,0 @@
-
-TEMPLATE = subdirs
-SUBDIRS += \
- qcameraviewfinder \
- qcamerawidgets \
- qmediaplayerwidgets \
-
-# This is a commment for the mock backend directory so that maketestselftest
-# doesn't believe it's an untested directory
-# qmultimedia_common
-
-# Tests depending on private interfaces should only be built if
-# these interfaces are exported.
-contains (QT_CONFIG, private_tests) {
- SUBDIRS += \
- qgraphicsvideoitem \
- qpaintervideosurface \
- qmediaimageviewerwidgets \
- qvideowidget \
-
- contains (QT_CONFIG, declarative) {
- disabled:SUBDIRS += qdeclarativevideo
- }
-}
-
diff --git a/tests/auto/qabstractvideobuffer/qabstractvideobuffer.pro b/tests/auto/qabstractvideobuffer/qabstractvideobuffer.pro
deleted file mode 100644
index dfb7e5d..0000000
--- a/tests/auto/qabstractvideobuffer/qabstractvideobuffer.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qabstractvideobuffer
-
-QT += core multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qabstractvideobuffer.cpp
-
diff --git a/tests/auto/qabstractvideobuffer/tst_qabstractvideobuffer.cpp b/tests/auto/qabstractvideobuffer/tst_qabstractvideobuffer.cpp
deleted file mode 100644
index 999e36c..0000000
--- a/tests/auto/qabstractvideobuffer/tst_qabstractvideobuffer.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-
-#include <qabstractvideobuffer.h>
-
-class tst_QAbstractVideoBuffer : public QObject
-{
- Q_OBJECT
-public:
- tst_QAbstractVideoBuffer();
- ~tst_QAbstractVideoBuffer();
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
-private slots:
- void handleType_data();
- void handleType();
- void handle();
- void mapMode();
-};
-
-class QtTestVideoBuffer : public QAbstractVideoBuffer
-{
-public:
- QtTestVideoBuffer(QAbstractVideoBuffer::HandleType type) : QAbstractVideoBuffer(type) {}
-
- MapMode mapMode() const { return QAbstractVideoBuffer::ReadWrite; }
-
- uchar *map(MapMode, int *, int *) { return 0; }
- void unmap() {}
-};
-
-tst_QAbstractVideoBuffer::tst_QAbstractVideoBuffer()
-{
-}
-
-tst_QAbstractVideoBuffer::~tst_QAbstractVideoBuffer()
-{
-}
-
-void tst_QAbstractVideoBuffer::initTestCase()
-{
-}
-
-void tst_QAbstractVideoBuffer::cleanupTestCase()
-{
-}
-
-void tst_QAbstractVideoBuffer::init()
-{
-}
-
-void tst_QAbstractVideoBuffer::cleanup()
-{
-}
-
-#define ADD_HANDLE_TEST(x) \
- QTest::newRow(#x) \
- << QAbstractVideoBuffer::x \
- << QString(QLatin1String(#x));
-
-void tst_QAbstractVideoBuffer::handleType_data()
-{
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("type");
- QTest::addColumn<QString>("stringized");
-
- ADD_HANDLE_TEST(NoHandle);
- ADD_HANDLE_TEST(GLTextureHandle);
- ADD_HANDLE_TEST(XvShmImageHandle);
- ADD_HANDLE_TEST(QPixmapHandle);
- ADD_HANDLE_TEST(CoreImageHandle);
-
- // User handles are different
-
- QTest::newRow("user1")
- << QAbstractVideoBuffer::UserHandle << QString::fromAscii("UserHandle(1000)");
- QTest::newRow("user2")
- << QAbstractVideoBuffer::HandleType(QAbstractVideoBuffer::UserHandle + 1) << QString::fromAscii("UserHandle(1001)");
-}
-
-void tst_QAbstractVideoBuffer::handleType()
-{
- QFETCH(QAbstractVideoBuffer::HandleType, type);
- QFETCH(QString, stringized);
-
- QtTestVideoBuffer buffer(type);
-
- QCOMPARE(buffer.handleType(), type);
-
- QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
- qDebug() << type;
-}
-
-void tst_QAbstractVideoBuffer::handle()
-{
- QtTestVideoBuffer buffer(QAbstractVideoBuffer::NoHandle);
-
- QVERIFY(buffer.handle().isNull());
-}
-
-void tst_QAbstractVideoBuffer::mapMode()
-{
- QtTestVideoBuffer maptest(QAbstractVideoBuffer::NoHandle);
- QVERIFY2(maptest.mapMode() == QAbstractVideoBuffer::ReadWrite, "ReadWrite Failed");
-}
-
-QTEST_MAIN(tst_QAbstractVideoBuffer)
-
-#include "tst_qabstractvideobuffer.moc"
diff --git a/tests/auto/qabstractvideosurface/qabstractvideosurface.pro b/tests/auto/qabstractvideosurface/qabstractvideosurface.pro
deleted file mode 100644
index c1718a6..0000000
--- a/tests/auto/qabstractvideosurface/qabstractvideosurface.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qabstractvideosurface
-
-QT += core multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qabstractvideosurface.cpp
-
diff --git a/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp b/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp
deleted file mode 100644
index 7413fdd..0000000
--- a/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp
+++ /dev/null
@@ -1,399 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-
-#include <qabstractvideosurface.h>
-#include <qvideosurfaceformat.h>
-
-class tst_QAbstractVideoSurface : public QObject
-{
- Q_OBJECT
-public:
- tst_QAbstractVideoSurface();
- ~tst_QAbstractVideoSurface();
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
-private slots:
- void setError();
- void isFormatSupported_data();
- void isFormatSupported();
- void nearestFormat_data();
- void nearestFormat();
- void start_data();
- void start();
- void nativeResolution();
- void supportedFormatsChanged();
-};
-
-typedef QMap<QAbstractVideoBuffer::HandleType, QVideoFrame::PixelFormat> SupportedFormatMap;
-
-Q_DECLARE_METATYPE(SupportedFormatMap)
-Q_DECLARE_METATYPE(QVideoSurfaceFormat)
-Q_DECLARE_METATYPE(QAbstractVideoSurface::Error);
-
-class QtTestVideoSurface : public QAbstractVideoSurface
-{
- Q_OBJECT
-public:
- explicit QtTestVideoSurface(QObject *parent = 0) : QAbstractVideoSurface(parent) {}
- explicit QtTestVideoSurface(SupportedFormatMap formats, QObject *parent = 0)
- : QAbstractVideoSurface(parent), supportedFormats(formats) {}
-
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const
- {
- return supportedFormats.values(handleType);
- }
-
- bool present(const QVideoFrame &) { return false; }
-
- using QAbstractVideoSurface::setError;
-
- /* adding protected setNativeResolution*/
- using QAbstractVideoSurface::setNativeResolution;
-
- /* fun to generate supportedFormatsChanged signal */
- QList<QVideoFrame::PixelFormat> supportedPixelFormatsChange(QList<QVideoFrame::PixelFormat> formats)
- {
- supportedFormats.insertMulti(QAbstractVideoBuffer::NoHandle, QVideoFrame::Format_RGB32);
- QList<QVideoFrame::PixelFormat> supportedFormats = supportedPixelFormats();
- if (supportedFormats.count() != formats.count()) {
- emit supportedFormatsChanged();
- }
- return supportedFormats;
- }
-
-private:
- SupportedFormatMap supportedFormats;
-};
-
-tst_QAbstractVideoSurface::tst_QAbstractVideoSurface()
-{
-}
-
-tst_QAbstractVideoSurface::~tst_QAbstractVideoSurface()
-{
-}
-
-void tst_QAbstractVideoSurface::initTestCase()
-{
-}
-
-void tst_QAbstractVideoSurface::cleanupTestCase()
-{
-}
-
-void tst_QAbstractVideoSurface::init()
-{
-}
-
-void tst_QAbstractVideoSurface::cleanup()
-{
-}
-
-void tst_QAbstractVideoSurface::setError()
-{
- qRegisterMetaType<QAbstractVideoSurface::Error>();
-
- QtTestVideoSurface surface;
-
- QCOMPARE(surface.error(), QAbstractVideoSurface::NoError);
-
- surface.setError(QAbstractVideoSurface::StoppedError);
- QCOMPARE(surface.error(), QAbstractVideoSurface::StoppedError);
-
- surface.setError(QAbstractVideoSurface::ResourceError);
- QCOMPARE(surface.error(), QAbstractVideoSurface::ResourceError);
-
- surface.setError(QAbstractVideoSurface::NoError);
- QCOMPARE(surface.error(), QAbstractVideoSurface::NoError);
-
- surface.setError(QAbstractVideoSurface::UnsupportedFormatError);
- QCOMPARE(surface.error(), QAbstractVideoSurface::UnsupportedFormatError);
-
- surface.setError(QAbstractVideoSurface::IncorrectFormatError);
- QCOMPARE(surface.error(), QAbstractVideoSurface::IncorrectFormatError);
-}
-
-void tst_QAbstractVideoSurface::isFormatSupported_data()
-{
- QTest::addColumn<SupportedFormatMap>("supportedFormats");
- QTest::addColumn<QVideoSurfaceFormat>("format");
- QTest::addColumn<bool>("supported");
-
- SupportedFormatMap formats;
-
- QTest::newRow("no formats: rgb32")
- << formats
- << QVideoSurfaceFormat(QSize(800, 600), QVideoFrame::Format_RGB32)
- << false;
- QTest::newRow("no formats: yv12")
- << formats
- << QVideoSurfaceFormat(QSize(800, 600), QVideoFrame::Format_YV12)
- << false;
- QTest::newRow("no formats: rgb32 gl")
- << formats
- << QVideoSurfaceFormat(
- QSize(800, 600),
- QVideoFrame::Format_RGB32,
- QAbstractVideoBuffer::GLTextureHandle)
- << false;
- QTest::newRow("no formats: rgb24 gl")
- << formats
- << QVideoSurfaceFormat(
- QSize(800, 600),
- QVideoFrame::Format_RGB24,
- QAbstractVideoBuffer::GLTextureHandle)
- << false;
-
- formats.insertMulti(QAbstractVideoBuffer::NoHandle, QVideoFrame::Format_RGB32);
- formats.insertMulti(QAbstractVideoBuffer::NoHandle, QVideoFrame::Format_RGB24);
- formats.insertMulti(QAbstractVideoBuffer::NoHandle, QVideoFrame::Format_YUV444);
- formats.insertMulti(QAbstractVideoBuffer::GLTextureHandle, QVideoFrame::Format_RGB32);
-
- QTest::newRow("supported: rgb32")
- << formats
- << QVideoSurfaceFormat(QSize(800, 600), QVideoFrame::Format_RGB32)
- << true;
- QTest::newRow("supported: rgb24")
- << formats
- << QVideoSurfaceFormat(QSize(800, 600), QVideoFrame::Format_RGB24)
- << true;
- QTest::newRow("unsupported: yv12")
- << formats
- << QVideoSurfaceFormat(QSize(800, 600), QVideoFrame::Format_YV12)
- << false;
- QTest::newRow("supported: rgb32 gl")
- << formats
- << QVideoSurfaceFormat(
- QSize(800, 600),
- QVideoFrame::Format_RGB32,
- QAbstractVideoBuffer::GLTextureHandle)
- << true;
- QTest::newRow("unsupported: rgb24 gl")
- << formats
- << QVideoSurfaceFormat(
- QSize(800, 600),
- QVideoFrame::Format_RGB24,
- QAbstractVideoBuffer::GLTextureHandle)
- << false;
- QTest::newRow("unsupported: yv12 gl")
- << formats
- << QVideoSurfaceFormat(
- QSize(800, 600),
- QVideoFrame::Format_YV12,
- QAbstractVideoBuffer::GLTextureHandle)
- << false;
-
- formats.insertMulti(QAbstractVideoBuffer::NoHandle, QVideoFrame::Format_YV12);
- formats.insertMulti(QAbstractVideoBuffer::GLTextureHandle, QVideoFrame::Format_RGB24);
-
- QTest::newRow("supported: yv12")
- << formats
- << QVideoSurfaceFormat(QSize(800, 600), QVideoFrame::Format_YV12)
- << true;
- QTest::newRow("supported: rgb24 gl")
- << formats
- << QVideoSurfaceFormat(
- QSize(800, 600),
- QVideoFrame::Format_RGB24,
- QAbstractVideoBuffer::GLTextureHandle)
- << true;
-}
-
-void tst_QAbstractVideoSurface::isFormatSupported()
-{
- QFETCH(SupportedFormatMap, supportedFormats);
- QFETCH(QVideoSurfaceFormat, format);
- QFETCH(bool, supported);
-
- QtTestVideoSurface surface(supportedFormats);
-
- QCOMPARE(surface.isFormatSupported(format), supported);
-}
-
-void tst_QAbstractVideoSurface::nearestFormat_data()
-{
- isFormatSupported_data();
-}
-
-void tst_QAbstractVideoSurface::nearestFormat()
-{
- QFETCH(SupportedFormatMap, supportedFormats);
- QFETCH(QVideoSurfaceFormat, format);
- QFETCH(bool, supported);
-
- QtTestVideoSurface surface(supportedFormats);
-
- QCOMPARE(surface.nearestFormat(format) == format, supported);
-}
-
-void tst_QAbstractVideoSurface::start_data()
-{
- QTest::addColumn<QVideoSurfaceFormat>("format");
-
- QTest::newRow("rgb32") << QVideoSurfaceFormat(
- QSize(800, 600),
- QVideoFrame::Format_RGB32);
- QTest::newRow("yv12") << QVideoSurfaceFormat(
- QSize(800, 600),
- QVideoFrame::Format_YV12);
- QTest::newRow("rgb32 gl") << QVideoSurfaceFormat(
- QSize(800, 600),
- QVideoFrame::Format_RGB32,
- QAbstractVideoBuffer::GLTextureHandle);
-}
-
-void tst_QAbstractVideoSurface::start()
-{
- QFETCH(QVideoSurfaceFormat, format);
-
- QtTestVideoSurface surface;
- surface.setError(QAbstractVideoSurface::ResourceError);
-
- QSignalSpy formatSpy(&surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)));
- QSignalSpy activeSpy(&surface, SIGNAL(activeChanged(bool)));
-
- QVERIFY(!surface.isActive());
- QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat());
-
- QVERIFY(surface.start(format));
-
- QVERIFY(surface.isActive());
- QCOMPARE(surface.surfaceFormat(), format);
-
- QCOMPARE(formatSpy.count(), 1);
- QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.last().at(0)), format);
-
- QCOMPARE(activeSpy.count(), 1);
- QCOMPARE(activeSpy.last().at(0).toBool(), true);
-
- // Starting twice won't change active
- // XXX should this also not emit surfaceFormatChanged?
- QVERIFY(surface.start(format));
- QCOMPARE(activeSpy.count(), 1);
- QVERIFY(surface.isActive());
-
- // error() is reset on a successful start.
- QCOMPARE(surface.error(), QAbstractVideoSurface::NoError);
-
- surface.stop();
-
- QVERIFY(!surface.isActive());
- QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat());
-
- QCOMPARE(formatSpy.count(), 3);
- QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.last().at(0)), QVideoSurfaceFormat());
-
- QCOMPARE(activeSpy.count(), 2);
- QCOMPARE(activeSpy.last().at(0).toBool(), false);
-
- // Stopping a stopped surface shouldn't hurt
- surface.stop();
-
- QVERIFY(!surface.isActive());
- QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat());
-
- QCOMPARE(formatSpy.count(), 3);
- QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.last().at(0)), QVideoSurfaceFormat());
-
- QCOMPARE(activeSpy.count(), 2);
- QCOMPARE(activeSpy.last().at(0).toBool(), false);
-}
-
-// Test nativeResolution property
-void tst_QAbstractVideoSurface::nativeResolution()
-{
- QtTestVideoSurface surface;
- QSignalSpy spy(&surface, SIGNAL(nativeResolutionChanged(QSize)));
- QSize size1 = surface.nativeResolution();
- QVERIFY(size1.width() == -1);
- QVERIFY(size1.height() == -1);
- QVERIFY(spy.count() == 0);
-
- QSize res(100,150);
- surface.setNativeResolution(res);
- QVERIFY(spy.count() == 1);
-
- QSize size2 = qvariant_cast<QSize>(spy.at(0).at(0));
- QVERIFY(size2.width() == 100);
- QVERIFY(size2.height() == 150);
-
- // Setting again should not emit
- surface.setNativeResolution(res);
- QVERIFY(spy.count() == 1);
-
- size2 = qvariant_cast<QSize>(spy.at(0).at(0));
- QVERIFY(size2.width() == 100);
- QVERIFY(size2.height() == 150);
-
- spy.clear();
-}
-
-// QAbstractVideoSurface's supported Formats Changed Signal
-void tst_QAbstractVideoSurface::supportedFormatsChanged()
-{
- SupportedFormatMap formatMap;
- formatMap.insertMulti(QAbstractVideoBuffer::NoHandle, QVideoFrame::Format_RGB24);
- QtTestVideoSurface surface(formatMap);
- QSignalSpy spy(&surface, SIGNAL(supportedFormatsChanged()));
- QList<QVideoFrame::PixelFormat> formats = surface.supportedPixelFormats();
- QVERIFY(formats.count() == 1);
- QVERIFY(spy.count() == 0);
-
- // user defined implementation for generation of supportedFormatsChanged signal
- QList<QVideoFrame::PixelFormat> newFormats = surface.supportedPixelFormatsChange(formats);
- QVERIFY(newFormats.count() == (formats.count() + 1));
- QVERIFY(spy.count() == 1);
- spy.clear();
-}
-
-QTEST_MAIN(tst_QAbstractVideoSurface)
-
-#include "tst_qabstractvideosurface.moc"
diff --git a/tests/auto/qaudiocapturesource/qaudiocapturesource.pro b/tests/auto/qaudiocapturesource/qaudiocapturesource.pro
deleted file mode 100644
index 1d0c2e2..0000000
--- a/tests/auto/qaudiocapturesource/qaudiocapturesource.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qaudiocapturesource
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qaudiocapturesource.cpp
-
-include (../qmultimedia_common/mockrecorder.pri)
-include (../qmultimedia_common/mock.pri)
-
diff --git a/tests/auto/qaudiocapturesource/tst_qaudiocapturesource.cpp b/tests/auto/qaudiocapturesource/tst_qaudiocapturesource.cpp
deleted file mode 100644
index d2620b8..0000000
--- a/tests/auto/qaudiocapturesource/tst_qaudiocapturesource.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 <QtTest/QtTest>
-#include <QDebug>
-
-#include <qaudioformat.h>
-
-#include <qaudiocapturesource.h>
-#include <qaudioencodercontrol.h>
-#include <qmediarecordercontrol.h>
-#include <qaudioendpointselector.h>
-#include <qaudiodeviceinfo.h>
-#include <qaudioinput.h>
-#include <qmediaobject.h>
-
-//TESTED_COMPONENT=src/multimedia
-
-#include "mockmediaserviceprovider.h"
-#include "mockmediarecorderservice.h"
-
-QT_USE_NAMESPACE
-
-class tst_QAudioCaptureSource: public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- //void testNullService();
- //void testNullControl();
- void testAudioSource();
- void testOptions();
- void testDevices();
- void testAvailability();
- void testAvailableAudioInputChangedSignal();
-
-private:
- QAudioCaptureSource *audiosource;
- MockMediaRecorderService *mockMediaRecorderService;
- MockMediaServiceProvider *mockProvider;
-};
-
-void tst_QAudioCaptureSource::initTestCase()
-{
- mockMediaRecorderService = new MockMediaRecorderService;
- mockProvider = new MockMediaServiceProvider(mockMediaRecorderService);
-}
-
-void tst_QAudioCaptureSource::cleanupTestCase()
-{
- delete audiosource;
- delete mockProvider;
- audiosource = 0;
-}
-/*
-void tst_QAudioCaptureSource::testNullService()
-{
- MockProvider provider(0);
- QAudioCaptureSource source(0, &provider);
-
- QCOMPARE(source.audioInputs().size(), 0);
- QCOMPARE(source.defaultAudioInput(), QString());
- QCOMPARE(source.activeAudioInput(), QString());
-}
-*/
-/*
-void tst_QAudioCaptureSource::testNullControl()
-{
- MockRecorderService service;
- service.hasAudioDeviceControl = false;
- MockProvider provider(&service);
- QAudioCaptureSource source(0, &provider);
-
- QCOMPARE(source.audioInputs().size(), 0);
- QCOMPARE(source.defaultAudioInput(), QString());
- QCOMPARE(source.activeAudioInput(), QString());
-
- QCOMPARE(source.audioDescription("blah"), QString());
-
- QSignalSpy deviceNameSpy(&source, SIGNAL(activeAudioInputChanged(QString)));
-
- source.setAudioInput("blah");
- QCOMPARE(deviceNameSpy.count(), 0);
-}
-*/
-void tst_QAudioCaptureSource::testAudioSource()
-{
- audiosource = new QAudioCaptureSource(0, mockProvider);
-
- QCOMPARE(audiosource->service(),(QMediaService *) mockMediaRecorderService);
-}
-
-void tst_QAudioCaptureSource::testOptions()
-{
- const QString codec(QLatin1String("audio/mpeg"));
-
- QStringList options = mockMediaRecorderService->mockAudioEncoderControl->supportedEncodingOptions(codec);
- QCOMPARE(options.count(), 4);
- mockMediaRecorderService->mockAudioEncoderControl->setEncodingOption(codec, options.first(),8000);
- QVERIFY(mockMediaRecorderService->mockAudioEncoderControl->encodingOption(codec, options.first()).toInt() == 8000);
-}
-
-void tst_QAudioCaptureSource::testDevices()
-{
- audiosource = new QAudioCaptureSource(0,mockProvider);
- QList<QString> devices = audiosource->audioInputs();
- QVERIFY(devices.size() > 0);
- QVERIFY(devices.at(0).compare("device1") == 0);
- QVERIFY(audiosource->audioDescription("device1").compare("dev1 comment") == 0);
- QVERIFY(audiosource->defaultAudioInput() == "device1");
- QVERIFY(audiosource->isAvailable() == true);
-
- QSignalSpy checkSignal(audiosource, SIGNAL(activeAudioInputChanged(QString)));
- audiosource->setAudioInput("device2");
- QVERIFY(audiosource->activeAudioInput().compare("device2") == 0);
- QVERIFY(checkSignal.count() == 1);
- QVERIFY(audiosource->isAvailable() == true);
-}
-
-void tst_QAudioCaptureSource::testAvailability()
-{
- MockMediaRecorderService service;
- service.hasControls = false;
- MockMediaServiceProvider provider(&service);
- QAudioCaptureSource source(0, &provider);
-
- QVERIFY(source.isAvailable() == false);
- QVERIFY(source.availabilityError() == QtMultimedia::ServiceMissingError);
-
- service.hasControls = true;
- MockMediaServiceProvider provider2(&service);
- QAudioCaptureSource source2(0, &provider2);
-
- QVERIFY(source2.isAvailable() == true);
- QVERIFY(source2.availabilityError() == QtMultimedia::NoError);
-}
-
-void tst_QAudioCaptureSource::testAvailableAudioInputChangedSignal()
-{
- // The availabilityChangedSignal is implemented in QAudioCaptureSource. SO using it to test the signal.
- audiosource = new QAudioCaptureSource(0, mockProvider);
-
- /* Spy the signal availableEndpointChanged and audioInputchanged */
- QSignalSpy changed(mockMediaRecorderService->mockAudioEndpointSelector, SIGNAL(availableEndpointsChanged()));
- QSignalSpy audioInputchange(audiosource, SIGNAL(availableAudioInputsChanged()));
-
- /* Add the end points and verify if the available end point changed signal is emitted. */
- QMetaObject::invokeMethod(mockMediaRecorderService->mockAudioEndpointSelector, "addEndpoints");
- QVERIFY(changed.count() == 1);
- QVERIFY(audioInputchange.count() == 1);
-
- /* Now try removes */
- changed.clear();
- audioInputchange.clear();
- QMetaObject::invokeMethod(mockMediaRecorderService->mockAudioEndpointSelector, "removeEndpoints");
- QVERIFY(changed.count() == 1);
- QVERIFY(audioInputchange.count() == 1);
-}
-
-QTEST_MAIN(tst_QAudioCaptureSource)
-
-#include "tst_qaudiocapturesource.moc"
diff --git a/tests/auto/qaudiodeviceinfo/qaudiodeviceinfo.pro b/tests/auto/qaudiodeviceinfo/qaudiodeviceinfo.pro
deleted file mode 100644
index ffe9829..0000000
--- a/tests/auto/qaudiodeviceinfo/qaudiodeviceinfo.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TARGET = tst_qaudiodeviceinfo
-
-QT += core multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-# This is more of a system test
-# CONFIG += testcase
-
-SOURCES += tst_qaudiodeviceinfo.cpp
-
diff --git a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp
deleted file mode 100644
index f459a74..0000000
--- a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include <QtCore/qlocale.h>
-#include <qaudiodeviceinfo.h>
-
-#include <QStringList>
-#include <QList>
-
-//TESTED_COMPONENT=src/multimedia
-
-class tst_QAudioDeviceInfo : public QObject
-{
- Q_OBJECT
-public:
- tst_QAudioDeviceInfo(QObject* parent=0) : QObject(parent) {}
-
-private slots:
- void initTestCase();
- void checkAvailableDefaultInput();
- void checkAvailableDefaultOutput();
- void outputList();
- void codecs();
- void channels();
- void sampleSizes();
- void byteOrders();
- void sampleTypes();
- void frequencies();
- void isFormatSupported();
- void preferred();
- void nearest();
- void supportedChannelCounts();
- void supportedSampleRates();
- void assignOperator();
- void deviceName();
- void defaultConstructor();
-
-private:
- bool available;
- QAudioDeviceInfo* device;
-};
-
-void tst_QAudioDeviceInfo::initTestCase()
-{
- // Only perform tests if audio output device exists!
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
- if (devices.size() > 0)
- available = true;
- else {
- qWarning()<<"NOTE: no audio output device found, no test will be performed";
- available = false;
- }
-}
-
-void tst_QAudioDeviceInfo::checkAvailableDefaultInput()
-{
- // Only perform tests if audio input device exists!
- bool storeAvailable = available;
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
- if (devices.size() > 0)
- available = true;
- else {
- qWarning()<<"NOTE: no audio input device found, no test will be performed";
- available = false;
- }
- if (available)
- QVERIFY(!QAudioDeviceInfo::defaultInputDevice().isNull());
- available = storeAvailable;
-}
-
-void tst_QAudioDeviceInfo::checkAvailableDefaultOutput()
-{
- if (available)
- QVERIFY(!QAudioDeviceInfo::defaultOutputDevice().isNull());
-}
-
-void tst_QAudioDeviceInfo::outputList()
-{
- if (available) {
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
- QVERIFY(devices.size() > 0);
- device = new QAudioDeviceInfo(devices.at(0));
- }
-}
-
-void tst_QAudioDeviceInfo::codecs()
-{
- if (available) {
- QStringList avail = device->supportedCodecs();
- QVERIFY(avail.size() > 0);
- }
-}
-
-void tst_QAudioDeviceInfo::channels()
-{
- if (available) {
- QList<int> avail = device->supportedChannels();
- QVERIFY(avail.size() > 0);
- }
-}
-
-void tst_QAudioDeviceInfo::sampleSizes()
-{
- if (available) {
- QList<int> avail = device->supportedSampleSizes();
- QVERIFY(avail.size() > 0);
- }
-}
-
-void tst_QAudioDeviceInfo::byteOrders()
-{
- if (available) {
- QList<QAudioFormat::Endian> avail = device->supportedByteOrders();
- QVERIFY(avail.size() > 0);
- }
-}
-
-void tst_QAudioDeviceInfo::sampleTypes()
-{
- if (available) {
- QList<QAudioFormat::SampleType> avail = device->supportedSampleTypes();
- QVERIFY(avail.size() > 0);
- }
-}
-
-void tst_QAudioDeviceInfo::frequencies()
-{
- if (available) {
- QList<int> avail = device->supportedFrequencies();
- QVERIFY(avail.size() > 0);
- }
-}
-
-void tst_QAudioDeviceInfo::isFormatSupported()
-{
- if (available) {
- QAudioFormat format;
- format.setFrequency(44100);
- format.setChannels(2);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleSize(16);
- format.setCodec("audio/pcm");
-
- // Should always be true for these format
- QVERIFY(device->isFormatSupported(format));
- }
-}
-
-void tst_QAudioDeviceInfo::preferred()
-{
- if (available) {
- QAudioFormat format = device->preferredFormat();
- QVERIFY(format.isValid());
- }
-}
-
-// Returns closest QAudioFormat to settings that system audio supports.
-void tst_QAudioDeviceInfo::nearest()
-{
- if (available) {
- /*
- QAudioFormat format1, format2;
- format1.setFrequency(8000);
- format2 = device->nearestFormat(format1);
- QVERIFY(format2.frequency() == 44100);
- */
- QAudioFormat format;
- format.setFrequency(44100);
- format.setChannels(2);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleSize(16);
- format.setCodec("audio/pcm");
-
- QAudioFormat format2 = device->nearestFormat(format);
-
- // This is definitely dependent on platform support (but isFormatSupported tests that above)
- QVERIFY(format2.frequency() == 44100);
- }
-}
-
-// Returns a list of supported channel counts.
-void tst_QAudioDeviceInfo::supportedChannelCounts()
-{
- if (available) {
- QList<int> avail = device->supportedChannelCounts();
- QVERIFY(avail.size() > 0);
- }
-}
-
-// Returns a list of supported sample rates.
-void tst_QAudioDeviceInfo::supportedSampleRates()
-{
- if (available) {
- QList<int> avail = device->supportedSampleRates();
- QVERIFY(avail.size() > 0);
- }
-}
-
-// QAudioDeviceInfo's assignOperator method
-void tst_QAudioDeviceInfo::assignOperator()
-{
- QAudioDeviceInfo dev;
- QVERIFY(dev.deviceName() == NULL);
- QVERIFY(dev.isNull() == true);
-
- if (available) {
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
- QVERIFY(devices.size() > 0);
- QAudioDeviceInfo dev1(devices.at(0));
- dev = dev1;
- QVERIFY(dev.isNull() == false);
- QVERIFY(dev.deviceName() == dev1.deviceName());
- }
-}
-
-// Returns human readable name of audio device
-void tst_QAudioDeviceInfo::deviceName()
-{
- if (available) {
- QVERIFY(device->deviceName() != NULL);
- QVERIFY(device->deviceName() == QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).at(0).deviceName());
- }
-}
-
-// QAudioDeviceInfo's defaultConstructor method
-void tst_QAudioDeviceInfo::defaultConstructor()
-{
- QAudioDeviceInfo dev;
- QVERIFY(dev.isNull() == true);
- QVERIFY(dev.deviceName() == NULL);
-}
-
-QTEST_MAIN(tst_QAudioDeviceInfo)
-
-#include "tst_qaudiodeviceinfo.moc"
diff --git a/tests/auto/qaudioformat/qaudioformat.pro b/tests/auto/qaudioformat/qaudioformat.pro
deleted file mode 100644
index 59ba5c3..0000000
--- a/tests/auto/qaudioformat/qaudioformat.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qaudioformat
-
-QT += core multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qaudioformat.cpp
-
diff --git a/tests/auto/qaudioformat/tst_qaudioformat.cpp b/tests/auto/qaudioformat/tst_qaudioformat.cpp
deleted file mode 100644
index 4685805..0000000
--- a/tests/auto/qaudioformat/tst_qaudioformat.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include <QtCore/qlocale.h>
-#include <qaudioformat.h>
-
-#include <QStringList>
-#include <QList>
-
-//TESTED_COMPONENT=src/multimedia
-
-class tst_QAudioFormat : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QAudioFormat(QObject* parent=0) : QObject(parent) {}
-
-private slots:
- void checkNull();
- void checkFrequency();
- void checkSampleSize();
- void checkCodec();
- void checkByteOrder();
- void checkSampleType();
- void checkEquality();
- void checkAssignment();
- void checkSampleRate();
- void checkChannelCount();
-};
-
-void tst_QAudioFormat::checkNull()
-{
- // Default constructed QAudioFormat is invalid.
- QAudioFormat audioFormat0;
- QVERIFY(!audioFormat0.isValid());
-
- // validity is transferred
- QAudioFormat audioFormat1(audioFormat0);
- QVERIFY(!audioFormat1.isValid());
-
- audioFormat0.setFrequency(44100);
- audioFormat0.setChannels(2);
- audioFormat0.setSampleSize(16);
- audioFormat0.setCodec("audio/pcm");
- audioFormat0.setSampleType(QAudioFormat::SignedInt);
- QVERIFY(audioFormat0.isValid());
-}
-
-void tst_QAudioFormat::checkFrequency()
-{
- QAudioFormat audioFormat;
- audioFormat.setFrequency(44100);
- QVERIFY(audioFormat.frequency() == 44100);
-}
-
-void tst_QAudioFormat::checkSampleSize()
-{
- QAudioFormat audioFormat;
- audioFormat.setSampleSize(16);
- QVERIFY(audioFormat.sampleSize() == 16);
-}
-
-void tst_QAudioFormat::checkCodec()
-{
- QAudioFormat audioFormat;
- audioFormat.setCodec(QString::fromLatin1("audio/pcm"));
- QVERIFY(audioFormat.codec() == QString::fromLatin1("audio/pcm"));
-}
-
-void tst_QAudioFormat::checkByteOrder()
-{
- QAudioFormat audioFormat;
- audioFormat.setByteOrder(QAudioFormat::LittleEndian);
- QVERIFY(audioFormat.byteOrder() == QAudioFormat::LittleEndian);
-
- audioFormat.setByteOrder(QAudioFormat::BigEndian);
- QVERIFY(audioFormat.byteOrder() == QAudioFormat::BigEndian);
-}
-
-void tst_QAudioFormat::checkSampleType()
-{
- QAudioFormat audioFormat;
- audioFormat.setSampleType(QAudioFormat::SignedInt);
- QVERIFY(audioFormat.sampleType() == QAudioFormat::SignedInt);
-
- audioFormat.setSampleType(QAudioFormat::Unknown);
- QVERIFY(audioFormat.sampleType() == QAudioFormat::Unknown);
-
- audioFormat.setSampleType(QAudioFormat::Float);
- QVERIFY(audioFormat.sampleType() == QAudioFormat::Float);
-}
-
-void tst_QAudioFormat::checkEquality()
-{
- QAudioFormat audioFormat0;
- QAudioFormat audioFormat1;
-
- // Null formats are equivalent
- QVERIFY(audioFormat0 == audioFormat1);
- QVERIFY(!(audioFormat0 != audioFormat1));
-
- // on filled formats
- audioFormat0.setFrequency(8000);
- audioFormat0.setChannels(1);
- audioFormat0.setSampleSize(8);
- audioFormat0.setCodec("audio/pcm");
- audioFormat0.setByteOrder(QAudioFormat::LittleEndian);
- audioFormat0.setSampleType(QAudioFormat::UnSignedInt);
-
- audioFormat1.setFrequency(8000);
- audioFormat1.setChannels(1);
- audioFormat1.setSampleSize(8);
- audioFormat1.setCodec("audio/pcm");
- audioFormat1.setByteOrder(QAudioFormat::LittleEndian);
- audioFormat1.setSampleType(QAudioFormat::UnSignedInt);
-
- QVERIFY(audioFormat0 == audioFormat1);
- QVERIFY(!(audioFormat0 != audioFormat1));
-
- audioFormat0.setFrequency(44100);
- QVERIFY(audioFormat0 != audioFormat1);
- QVERIFY(!(audioFormat0 == audioFormat1));
-}
-
-void tst_QAudioFormat::checkAssignment()
-{
- QAudioFormat audioFormat0;
- QAudioFormat audioFormat1;
-
- audioFormat0.setFrequency(8000);
- audioFormat0.setChannels(1);
- audioFormat0.setSampleSize(8);
- audioFormat0.setCodec("audio/pcm");
- audioFormat0.setByteOrder(QAudioFormat::LittleEndian);
- audioFormat0.setSampleType(QAudioFormat::UnSignedInt);
-
- audioFormat1 = audioFormat0;
- QVERIFY(audioFormat1 == audioFormat0);
-
- QAudioFormat audioFormat2(audioFormat0);
- QVERIFY(audioFormat2 == audioFormat0);
-}
-
-/* sampleRate() API property test. */
-void tst_QAudioFormat::checkSampleRate()
-{
- QAudioFormat audioFormat;
- QVERIFY(audioFormat.sampleRate() == -1);
-
- audioFormat.setSampleRate(123);
- QVERIFY(audioFormat.sampleRate() == 123);
-}
-
-/* channelCount() API property test. */
-void tst_QAudioFormat::checkChannelCount()
-{
- // channels is the old name for channelCount, so
- // they should always be equal
- QAudioFormat audioFormat;
- QVERIFY(audioFormat.channelCount() == -1);
- QVERIFY(audioFormat.channels() == -1);
-
- audioFormat.setChannelCount(123);
- QVERIFY(audioFormat.channelCount() == 123);
- QVERIFY(audioFormat.channels() == 123);
-
- audioFormat.setChannels(5);
- QVERIFY(audioFormat.channelCount() == 5);
- QVERIFY(audioFormat.channels() == 5);
-}
-
-QTEST_MAIN(tst_QAudioFormat)
-
-#include "tst_qaudioformat.moc"
diff --git a/tests/auto/qaudioinput/qaudioinput.pro b/tests/auto/qaudioinput/qaudioinput.pro
deleted file mode 100644
index b70c6ee..0000000
--- a/tests/auto/qaudioinput/qaudioinput.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = tst_qaudioinput
-
-QT += core multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-# This is more of a system test
-# CONFIG += testcase
-
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
-
-HEADERS += wavheader.h
-SOURCES += wavheader.cpp tst_qaudioinput.cpp
diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp
deleted file mode 100755
index 4b6bb66..0000000
--- a/tests/auto/qaudioinput/tst_qaudioinput.cpp
+++ /dev/null
@@ -1,852 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include <QtCore/qlocale.h>
-
-#include <qaudioinput.h>
-#include <qaudiodeviceinfo.h>
-#include <qaudioformat.h>
-#include <qaudio.h>
-
-#include "wavheader.h"
-
-//TESTED_COMPONENT=src/multimedia
-
-#define AUDIO_BUFFER 192000
-
-#ifndef QTRY_VERIFY2
-#define QTRY_VERIFY2(__expr,__msg) \
- do { \
- const int __step = 50; \
- const int __timeout = 5000; \
- if (!(__expr)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QVERIFY2(__expr,__msg); \
- } while(0)
-#endif
-
-Q_DECLARE_METATYPE(QAudioFormat)
-
-class tst_QAudioInput : public QObject
-{
- Q_OBJECT
-public:
- tst_QAudioInput(QObject* parent=0) : QObject(parent) {}
-
-private slots:
- void initTestCase();
-
- void format();
- void invalidFormat_data();
- void invalidFormat();
-
- void bufferSize();
-
- void notifyInterval();
- void disableNotifyInterval();
-
- void stopWhileStopped();
- void suspendWhileStopped();
- void resumeWhileStopped();
-
- void pull();
- void pullSuspendResume();
-
- void push();
- void pushSuspendResume();
-
- void reset();
-
- void cleanupTestCase();
-
-private:
- QString formatToFileName(const QAudioFormat &format);
- QString workingDir();
-
- QAudioDeviceInfo audioDevice;
- QList<QAudioFormat> testFormats;
- QList<QFile*> audioFiles;
-
- QScopedPointer<QByteArray> m_byteArray;
- QScopedPointer<QBuffer> m_buffer;
-};
-
-QString tst_QAudioInput::formatToFileName(const QAudioFormat &format)
-{
- const QString formatEndian = (format.byteOrder() == QAudioFormat::LittleEndian)
- ? QString("LE") : QString("BE");
-
- const QString formatSigned = (format.sampleType() == QAudioFormat::SignedInt)
- ? QString("signed") : QString("unsigned");
-
- return QString("%1_%2_%3_%4_%5")
- .arg(format.frequency())
- .arg(format.sampleSize())
- .arg(formatSigned)
- .arg(formatEndian)
- .arg(format.channels());
-}
-
-
-QString tst_QAudioInput::workingDir()
-{
- QDir working(QString(SRCDIR));
-
- if (working.exists())
- return QString(SRCDIR);
-
- return QDir::currentPath();
-}
-
-void tst_QAudioInput::initTestCase()
-{
- qRegisterMetaType<QAudioFormat>();
-
- // Only perform tests if audio output device exists
- const QList<QAudioDeviceInfo> devices =
- QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
-
- if (devices.size() <= 0)
- QSKIP("No audio backend", SkipAll);
-
- audioDevice = QAudioDeviceInfo::defaultInputDevice();
-
-
- QAudioFormat format;
-
- format.setCodec("audio/pcm");
-
- if (audioDevice.isFormatSupported(audioDevice.preferredFormat()))
- testFormats.append(audioDevice.preferredFormat());
-
- // PCM 8000 mono S8
- format.setFrequency(8000);
- format.setSampleSize(8);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setChannels(1);
- if (audioDevice.isFormatSupported(format))
- testFormats.append(format);
-
- // PCM 11025 mono S16LE
- format.setFrequency(11025);
- format.setSampleSize(16);
- if (audioDevice.isFormatSupported(format))
- testFormats.append(format);
-
- // PCM 22050 mono S16LE
- format.setFrequency(22050);
- if (audioDevice.isFormatSupported(format))
- testFormats.append(format);
-
- // PCM 22050 stereo S16LE
- format.setChannels(2);
- if (audioDevice.isFormatSupported(format))
- testFormats.append(format);
-
- // PCM 44100 stereo S16LE
- format.setFrequency(44100);
- if (audioDevice.isFormatSupported(format))
- testFormats.append(format);
-
- // PCM 48000 stereo S16LE
- format.setFrequency(48000);
- if (audioDevice.isFormatSupported(format))
- testFormats.append(format);
-
- QVERIFY(testFormats.size());
-
- foreach (const QAudioFormat &format, testFormats) {
- QFile* file = new QFile(workingDir() + formatToFileName(format) + QString(".wav"));
- audioFiles.append(file);
- }
-}
-
-void tst_QAudioInput::format()
-{
- QAudioInput audioInput(audioDevice.preferredFormat(), this);
-
- QAudioFormat requested = audioDevice.preferredFormat();
- QAudioFormat actual = audioInput.format();
-
- QVERIFY2((requested.channels() == actual.channels()),
- QString("channels: requested=%1, actual=%2").arg(requested.channels()).arg(actual.channels()).toLocal8Bit().constData());
- QVERIFY2((requested.frequency() == actual.frequency()),
- QString("frequency: requested=%1, actual=%2").arg(requested.frequency()).arg(actual.frequency()).toLocal8Bit().constData());
- QVERIFY2((requested.sampleSize() == actual.sampleSize()),
- QString("sampleSize: requested=%1, actual=%2").arg(requested.sampleSize()).arg(actual.sampleSize()).toLocal8Bit().constData());
- QVERIFY2((requested.codec() == actual.codec()),
- QString("codec: requested=%1, actual=%2").arg(requested.codec()).arg(actual.codec()).toLocal8Bit().constData());
- QVERIFY2((requested.byteOrder() == actual.byteOrder()),
- QString("byteOrder: requested=%1, actual=%2").arg(requested.byteOrder()).arg(actual.byteOrder()).toLocal8Bit().constData());
- QVERIFY2((requested.sampleType() == actual.sampleType()),
- QString("sampleType: requested=%1, actual=%2").arg(requested.sampleType()).arg(actual.sampleType()).toLocal8Bit().constData());
-}
-
-void tst_QAudioInput::invalidFormat_data()
-{
- QTest::addColumn<QAudioFormat>("invalidFormat");
-
- QAudioFormat format;
-
- QTest::newRow("Null Format")
- << format;
-
- format = audioDevice.preferredFormat();
- format.setChannelCount(0);
- QTest::newRow("Channel count 0")
- << format;
-
- format = audioDevice.preferredFormat();
- format.setSampleRate(0);
- QTest::newRow("Sample rate 0")
- << format;
-
- format = audioDevice.preferredFormat();
- format.setSampleSize(0);
- QTest::newRow("Sample size 0")
- << format;
-}
-
-void tst_QAudioInput::invalidFormat()
-{
- QFETCH(QAudioFormat, invalidFormat);
-
- QVERIFY2(!audioDevice.isFormatSupported(invalidFormat),
- "isFormatSupported() is returning true on an invalid format");
-
- QAudioInput audioInput(invalidFormat, this);
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
-
- audioInput.start();
-
- // Check that error is raised
- QTRY_VERIFY2((audioInput.error() == QAudio::OpenError),"error() was not set to QAudio::OpenError after start()");
-}
-
-void tst_QAudioInput::bufferSize()
-{
- QAudioInput audioInput(audioDevice.preferredFormat(), this);
-
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError on creation");
-
- audioInput.setBufferSize(512);
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after setBufferSize(512)");
- QVERIFY2((audioInput.bufferSize() == 512),
- QString("bufferSize: requested=512, actual=%2").arg(audioInput.bufferSize()).toLocal8Bit().constData());
-
- audioInput.setBufferSize(4096);
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after setBufferSize(4096)");
- QVERIFY2((audioInput.bufferSize() == 4096),
- QString("bufferSize: requested=4096, actual=%2").arg(audioInput.bufferSize()).toLocal8Bit().constData());
-
- audioInput.setBufferSize(8192);
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after setBufferSize(8192)");
- QVERIFY2((audioInput.bufferSize() == 8192),
- QString("bufferSize: requested=8192, actual=%2").arg(audioInput.bufferSize()).toLocal8Bit().constData());
-}
-
-void tst_QAudioInput::notifyInterval()
-{
- QAudioInput audioInput(audioDevice.preferredFormat(), this);
-
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError on creation");
-
- audioInput.setNotifyInterval(50);
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after setNotifyInterval(50)");
- QVERIFY2((audioInput.notifyInterval() == 50),
- QString("notifyInterval: requested=50, actual=%2").arg(audioInput.notifyInterval()).toLocal8Bit().constData());
-
- audioInput.setNotifyInterval(100);
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after setNotifyInterval(100)");
- QVERIFY2((audioInput.notifyInterval() == 100),
- QString("notifyInterval: requested=100, actual=%2").arg(audioInput.notifyInterval()).toLocal8Bit().constData());
-
- audioInput.setNotifyInterval(250);
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after setNotifyInterval(250)");
- QVERIFY2((audioInput.notifyInterval() == 250),
- QString("notifyInterval: requested=250, actual=%2").arg(audioInput.notifyInterval()).toLocal8Bit().constData());
-
- audioInput.setNotifyInterval(1000);
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after setNotifyInterval(1000)");
- QVERIFY2((audioInput.notifyInterval() == 1000),
- QString("notifyInterval: requested=1000, actual=%2").arg(audioInput.notifyInterval()).toLocal8Bit().constData());
-}
-
-void tst_QAudioInput::disableNotifyInterval()
-{
- // Sets an invalid notification interval (QAudioInput::setNotifyInterval(0))
- // Checks that
- // - No error is raised (QAudioInput::error() returns QAudio::NoError)
- // - if <= 0, set to zero and disable notify signal
-
- QAudioInput audioInput(audioDevice.preferredFormat(), this);
-
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError on creation");
-
- audioInput.setNotifyInterval(0);
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after setNotifyInterval(0)");
- QVERIFY2((audioInput.notifyInterval() == 0),
- "notifyInterval() is not zero after setNotifyInterval(0)");
-
- audioInput.setNotifyInterval(-1);
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after setNotifyInterval(-1)");
- QVERIFY2((audioInput.notifyInterval() == 0),
- "notifyInterval() is not zero after setNotifyInterval(-1)");
-
- //start and run to check if notify() is emitted
- if (audioFiles.size() > 0) {
- QAudioInput audioInputCheck(testFormats.at(0), this);
- audioInputCheck.setNotifyInterval(0);
- QSignalSpy notifySignal(&audioInputCheck, SIGNAL(notify()));
- audioFiles.at(0)->open(QIODevice::WriteOnly);
- audioInputCheck.start(audioFiles.at(0));
- QTest::qWait(3000); // 3 seconds should be plenty
- audioInputCheck.stop();
- QVERIFY2((notifySignal.count() == 0),
- QString("didn't disable notify interval: shouldn't have got any but got %1").arg(notifySignal.count()).toLocal8Bit().constData());
- audioFiles.at(0)->close();
- }
-}
-
-void tst_QAudioInput::stopWhileStopped()
-{
- // Calls QAudioInput::stop() when object is already in StoppedState
- // Checks that
- // - No state change occurs
- // - No error is raised (QAudioInput::error() returns QAudio::NoError)
-
- QAudioInput audioInput(audioDevice.preferredFormat(), this);
-
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
-
- QSignalSpy stateSignal(&audioInput, SIGNAL(stateChanged(QAudio::State)));
- audioInput.stop();
-
- // Check that no state transition occurred
- QVERIFY2((stateSignal.count() == 0), "stop() while stopped is emitting a signal and it shouldn't");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError after stop()");
-}
-
-void tst_QAudioInput::suspendWhileStopped()
-{
- // Calls QAudioInput::suspend() when object is already in StoppedState
- // Checks that
- // - No state change occurs
- // - No error is raised (QAudioInput::error() returns QAudio::NoError)
-
- QAudioInput audioInput(audioDevice.preferredFormat(), this);
-
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
-
- QSignalSpy stateSignal(&audioInput, SIGNAL(stateChanged(QAudio::State)));
- audioInput.suspend();
-
- // Check that no state transition occurred
- QVERIFY2((stateSignal.count() == 0), "stop() while suspended is emitting a signal and it shouldn't");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError after stop()");
-}
-
-void tst_QAudioInput::resumeWhileStopped()
-{
- // Calls QAudioInput::resume() when object is already in StoppedState
- // Checks that
- // - No state change occurs
- // - No error is raised (QAudioInput::error() returns QAudio::NoError)
-
- QAudioInput audioInput(audioDevice.preferredFormat(), this);
-
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
-
- QSignalSpy stateSignal(&audioInput, SIGNAL(stateChanged(QAudio::State)));
- audioInput.resume();
-
- // Check that no state transition occurred
- QVERIFY2((stateSignal.count() == 0), "resume() while stopped is emitting a signal and it shouldn't");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError after resume()");
-}
-
-void tst_QAudioInput::pull()
-{
- for(int i=0; i<audioFiles.count(); i++) {
- QAudioInput audioInput(testFormats.at(i), this);
-
- audioInput.setNotifyInterval(100);
-
- QSignalSpy notifySignal(&audioInput, SIGNAL(notify()));
- QSignalSpy stateSignal(&audioInput, SIGNAL(stateChanged(QAudio::State)));
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
- QVERIFY2((audioInput.elapsedUSecs() == qint64(0)),"elapsedUSecs() not zero on creation");
-
- audioFiles.at(i)->close();
- audioFiles.at(i)->open(QIODevice::WriteOnly);
- WavHeader wavHeader(testFormats.at(i));
- QVERIFY(wavHeader.write(*audioFiles.at(i)));
-
- audioInput.start(audioFiles.at(i));
-
- // Check that QAudioInput immediately transitions to ActiveState or IdleState
- QTRY_VERIFY2((stateSignal.count() > 0),"didn't emit signals on start()");
- QVERIFY2((audioInput.state() == QAudio::ActiveState || audioInput.state() == QAudio::IdleState),
- "didn't transition to ActiveState or IdleState after start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- QVERIFY(audioInput.periodSize() > 0);
- stateSignal.clear();
-
- // Check that 'elapsed' increases
- QTest::qWait(40);
- QVERIFY2((audioInput.elapsedUSecs() > 0), "elapsedUSecs() is still zero after start()");
-
- // Allow some recording to happen
- QTest::qWait(3000); // 3 seconds should be plenty
-
- stateSignal.clear();
-
- qint64 processedUs = audioInput.processedUSecs();
-
- audioInput.stop();
- QTest::qWait(40);
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit StoppedState signal after stop(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "didn't transitions to StoppedState after stop()");
-
- QVERIFY2((processedUs > 2800000 && processedUs < 3200000),
- QString("processedUSecs() doesn't fall in acceptable range, should be 3040000 (%1)").arg(processedUs).toLocal8Bit().constData());
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after stop()");
- QVERIFY2((audioInput.elapsedUSecs() == (qint64)0), "elapsedUSecs() not equal to zero in StoppedState");
- QVERIFY2((notifySignal.count() > 20 && notifySignal.count() < 40),
- QString("notify() signals emitted (%1) should be 30").arg(notifySignal.count()).toLocal8Bit().constData());
-
- WavHeader::writeDataLength(*audioFiles.at(i),audioFiles.at(i)->pos()-WavHeader::headerLength());
- audioFiles.at(i)->close();
- }
-}
-
-void tst_QAudioInput::pullSuspendResume()
-{
- for(int i=0; i<audioFiles.count(); i++) {
- QAudioInput audioInput(testFormats.at(i), this);
-
- audioInput.setNotifyInterval(100);
-
- QSignalSpy notifySignal(&audioInput, SIGNAL(notify()));
- QSignalSpy stateSignal(&audioInput, SIGNAL(stateChanged(QAudio::State)));
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
- QVERIFY2((audioInput.elapsedUSecs() == qint64(0)),"elapsedUSecs() not zero on creation");
-
- audioFiles.at(i)->close();
- audioFiles.at(i)->open(QIODevice::WriteOnly);
- WavHeader wavHeader(testFormats.at(i));
- QVERIFY(wavHeader.write(*audioFiles.at(i)));
-
- audioInput.start(audioFiles.at(i));
-
- // Check that QAudioInput immediately transitions to ActiveState or IdleState
- QTRY_VERIFY2((stateSignal.count() > 0),"didn't emit signals on start()");
- QVERIFY2((audioInput.state() == QAudio::ActiveState || audioInput.state() == QAudio::IdleState),
- "didn't transition to ActiveState or IdleState after start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- QVERIFY(audioInput.periodSize() > 0);
- stateSignal.clear();
-
- // Check that 'elapsed' increases
- QTest::qWait(40);
- QVERIFY2((audioInput.elapsedUSecs() > 0), "elapsedUSecs() is still zero after start()");
-
- // Allow some recording to happen
- QTest::qWait(3000); // 3 seconds should be plenty
-
- QVERIFY2((audioInput.state() == QAudio::ActiveState),
- "didn't transition to ActiveState after some recording");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after some recording");
-
- stateSignal.clear();
-
- audioInput.suspend();
-
- // Give backends running in separate threads a chance to suspend.
- QTest::qWait(100);
-
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit SuspendedState signal after suspend(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioInput.state() == QAudio::SuspendedState), "didn't transitions to SuspendedState after stop()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after stop()");
- stateSignal.clear();
-
- // Check that only 'elapsed', and not 'processed' increases while suspended
- qint64 elapsedUs = audioInput.elapsedUSecs();
- qint64 processedUs = audioInput.processedUSecs();
- QTest::qWait(1000);
- QVERIFY(audioInput.elapsedUSecs() > elapsedUs);
- QVERIFY(audioInput.processedUSecs() == processedUs);
-
- audioInput.resume();
-
- // Give backends running in separate threads a chance to resume.
- QTest::qWait(100);
-
- // Check that QAudioInput immediately transitions to ActiveState
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit signal after resume(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioInput.state() == QAudio::ActiveState), "didn't transition to ActiveState after resume()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after resume()");
- stateSignal.clear();
-
- processedUs = audioInput.processedUSecs();
-
- audioInput.stop();
- QTest::qWait(40);
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit StoppedState signal after stop(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "didn't transitions to StoppedState after stop()");
-
- QVERIFY2((processedUs > 2800000 && processedUs < 3200000),
- QString("processedUSecs() doesn't fall in acceptable range, should be 3040000 (%1)").arg(processedUs).toLocal8Bit().constData());
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after stop()");
- QVERIFY2((audioInput.elapsedUSecs() == (qint64)0), "elapsedUSecs() not equal to zero in StoppedState");
- QVERIFY2((notifySignal.count() > 20 && notifySignal.count() < 40),
- QString("notify() signals emitted (%1) should be 30").arg(notifySignal.count()).toLocal8Bit().constData());
-
- WavHeader::writeDataLength(*audioFiles.at(i),audioFiles.at(i)->pos()-WavHeader::headerLength());
- audioFiles.at(i)->close();
- }
-}
-
-void tst_QAudioInput::push()
-{
- for(int i=0; i<audioFiles.count(); i++) {
- QAudioInput audioInput(testFormats.at(i), this);
-
- audioInput.setNotifyInterval(100);
-
- QSignalSpy notifySignal(&audioInput, SIGNAL(notify()));
- QSignalSpy stateSignal(&audioInput, SIGNAL(stateChanged(QAudio::State)));
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
- QVERIFY2((audioInput.elapsedUSecs() == qint64(0)),"elapsedUSecs() not zero on creation");
-
- audioFiles.at(i)->close();
- audioFiles.at(i)->open(QIODevice::WriteOnly);
- WavHeader wavHeader(testFormats.at(i));
- QVERIFY(wavHeader.write(*audioFiles.at(i)));
-
- QIODevice* feed = audioInput.start();
-
- // Check that QAudioInput immediately transitions to IdleState
- QTRY_VERIFY2((stateSignal.count() == 1),"didn't emit IdleState signal on start()");
- QVERIFY2((audioInput.state() == QAudio::IdleState),
- "didn't transition to IdleState after start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- QVERIFY(audioInput.periodSize() > 0);
- stateSignal.clear();
-
- // Check that 'elapsed' increases
- QTest::qWait(40);
- QVERIFY2((audioInput.elapsedUSecs() > 0), "elapsedUSecs() is still zero after start()");
-
- qint64 totalBytesRead = 0;
- bool firstBuffer = true;
- QByteArray buffer(AUDIO_BUFFER, 0);
- qint64 len = (testFormats.at(i).frequency()*testFormats.at(i).channels()*(testFormats.at(i).sampleSize()/8)*2); // 2 seconds
- while (totalBytesRead < len) {
- if (audioInput.bytesReady() >= audioInput.periodSize()) {
- qint64 bytesRead = feed->read(buffer.data(), audioInput.periodSize());
- audioFiles.at(i)->write(buffer.constData(),bytesRead);
- totalBytesRead+=bytesRead;
- if (firstBuffer && bytesRead) {
- // Check for transition to ActiveState when data is provided
- QVERIFY2((stateSignal.count() == 1),"didn't emit ActiveState signal on data");
- QVERIFY2((audioInput.state() == QAudio::ActiveState),
- "didn't transition to ActiveState after data");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- firstBuffer = false;
- }
- } else
- QTest::qWait(20);
- }
-
- QTest::qWait(1000);
-
- stateSignal.clear();
-
- qint64 processedUs = audioInput.processedUSecs();
-
- audioInput.stop();
- QTest::qWait(40);
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit StoppedState signal after stop(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "didn't transitions to StoppedState after stop()");
-
- QVERIFY2((processedUs > 1800000 && processedUs < 2200000),
- QString("processedUSecs() doesn't fall in acceptable range, should be 2040000 (%1)").arg(processedUs).toLocal8Bit().constData());
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after stop()");
- QVERIFY2((audioInput.elapsedUSecs() == (qint64)0), "elapsedUSecs() not equal to zero in StoppedState");
- QVERIFY2((notifySignal.count() > 20 && notifySignal.count() < 40),
- QString("notify() signals emitted (%1) should be 30").arg(notifySignal.count()).toLocal8Bit().constData());
-
- WavHeader::writeDataLength(*audioFiles.at(i),audioFiles.at(i)->pos()-WavHeader::headerLength());
- audioFiles.at(i)->close();
- }
-}
-
-void tst_QAudioInput::pushSuspendResume()
-{
- for(int i=0; i<audioFiles.count(); i++) {
- QAudioInput audioInput(testFormats.at(i), this);
-
- audioInput.setNotifyInterval(100);
-
- QSignalSpy notifySignal(&audioInput, SIGNAL(notify()));
- QSignalSpy stateSignal(&audioInput, SIGNAL(stateChanged(QAudio::State)));
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
- QVERIFY2((audioInput.elapsedUSecs() == qint64(0)),"elapsedUSecs() not zero on creation");
-
- audioFiles.at(i)->close();
- audioFiles.at(i)->open(QIODevice::WriteOnly);
- WavHeader wavHeader(testFormats.at(i));
- QVERIFY(wavHeader.write(*audioFiles.at(i)));
-
- QIODevice* feed = audioInput.start();
-
- // Check that QAudioInput immediately transitions to IdleState
- QTRY_VERIFY2((stateSignal.count() == 1),"didn't emit IdleState signal on start()");
- QVERIFY2((audioInput.state() == QAudio::IdleState),
- "didn't transition to IdleState after start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- QVERIFY(audioInput.periodSize() > 0);
- stateSignal.clear();
-
- // Check that 'elapsed' increases
- QTest::qWait(40);
- QVERIFY2((audioInput.elapsedUSecs() > 0), "elapsedUSecs() is still zero after start()");
-
- qint64 totalBytesRead = 0;
- bool firstBuffer = true;
- QByteArray buffer(AUDIO_BUFFER, 0);
- qint64 len = (testFormats.at(i).frequency()*testFormats.at(i).channels()*(testFormats.at(i).sampleSize()/8)); // 1 seconds
- while (totalBytesRead < len) {
- if (audioInput.bytesReady() >= audioInput.periodSize()) {
- qint64 bytesRead = feed->read(buffer.data(), audioInput.periodSize());
- audioFiles.at(i)->write(buffer.constData(),bytesRead);
- totalBytesRead+=bytesRead;
- if (firstBuffer && bytesRead) {
- // Check for transition to ActiveState when data is provided
- QVERIFY2((stateSignal.count() == 1),"didn't emit ActiveState signal on data");
- QVERIFY2((audioInput.state() == QAudio::ActiveState),
- "didn't transition to ActiveState after data");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- firstBuffer = false;
- }
- } else
- QTest::qWait(20);
- }
- stateSignal.clear();
-
- audioInput.suspend();
-
- // Give backends running in separate threads a chance to suspend
- QTest::qWait(100);
-
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit SuspendedState signal after suspend(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioInput.state() == QAudio::SuspendedState), "didn't transitions to SuspendedState after stop()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() is not QAudio::NoError after stop()");
- stateSignal.clear();
-
- // Check that only 'elapsed', and not 'processed' increases while suspended
- qint64 elapsedUs = audioInput.elapsedUSecs();
- qint64 processedUs = audioInput.processedUSecs();
- QTest::qWait(1000);
- QVERIFY(audioInput.elapsedUSecs() > elapsedUs);
- QVERIFY(audioInput.processedUSecs() == processedUs);
-
- audioInput.resume();
-
- // Give backends running in separate threads a chance to resume.
- QTest::qWait(100);
-
- // Check that QAudioInput immediately transitions to Active or IdleState
- QVERIFY2((stateSignal.count() > 0),"didn't emit signals on resume()");
- QVERIFY2((audioInput.state() == QAudio::ActiveState || audioInput.state() == QAudio::IdleState),
- "didn't transition to ActiveState or IdleState after resume()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after resume()");
- QVERIFY(audioInput.periodSize() > 0);
-
- // Let it play out what is in buffer and go to Idle before continue
- QTest::qWait(1000);
- stateSignal.clear();
-
- // Read another seconds worth
- totalBytesRead = 0;
- firstBuffer = true;
- while (totalBytesRead < len) {
- if (audioInput.bytesReady() >= audioInput.periodSize()) {
- qint64 bytesRead = feed->read(buffer.data(), audioInput.periodSize());
- audioFiles.at(i)->write(buffer.constData(),bytesRead);
- totalBytesRead+=bytesRead;
- } else
- QTest::qWait(20);
- }
- stateSignal.clear();
-
- processedUs = audioInput.processedUSecs();
-
- audioInput.stop();
- QTest::qWait(40);
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit StoppedState signal after stop(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "didn't transitions to StoppedState after stop()");
-
- QVERIFY2((processedUs > 1800000 && processedUs < 2200000),
- QString("processedUSecs() doesn't fall in acceptable range, should be 2040000 (%1)").arg(processedUs).toLocal8Bit().constData());
- QVERIFY2((audioInput.elapsedUSecs() == (qint64)0), "elapsedUSecs() not equal to zero in StoppedState");
-
- WavHeader::writeDataLength(*audioFiles.at(i),audioFiles.at(i)->pos()-WavHeader::headerLength());
- audioFiles.at(i)->close();
- }
-}
-
-void tst_QAudioInput::reset()
-{
- for(int i=0; i<audioFiles.count(); i++) {
-
- // Try both push/pull.. the vagaries of Active vs Idle are tested elsewhere
- {
- QAudioInput audioInput(testFormats.at(i), this);
-
- audioInput.setNotifyInterval(100);
-
- QSignalSpy notifySignal(&audioInput, SIGNAL(notify()));
- QSignalSpy stateSignal(&audioInput, SIGNAL(stateChanged(QAudio::State)));
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
- QVERIFY2((audioInput.elapsedUSecs() == qint64(0)),"elapsedUSecs() not zero on creation");
-
- QIODevice* device = audioInput.start();
- // Check that QAudioInput immediately transitions to IdleState
- QTRY_VERIFY2((stateSignal.count() == 1),"didn't emit IdleState signal on start()");
- QVERIFY2((audioInput.state() == QAudio::IdleState), "didn't transition to IdleState after start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- QVERIFY(audioInput.periodSize() > 0);
- QTRY_VERIFY2((audioInput.bytesReady() > 0), "no bytes available after starting");
-
- // Trigger a read
- QByteArray data = device->read(1);
-
- QTRY_VERIFY2((audioInput.state() == QAudio::ActiveState), "didn't transition to ActiveState after read()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- stateSignal.clear();
-
- audioInput.reset();
- QTRY_VERIFY2((stateSignal.count() == 1),"didn't emit StoppedState signal after reset()");
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "didn't transitions to StoppedState after reset()");
- QVERIFY2((audioInput.bytesReady() == 0), "buffer not cleared after reset()");
- }
-
- {
- QAudioInput audioInput(testFormats.at(i), this);
- QBuffer buffer;
-
- audioInput.setNotifyInterval(100);
-
- QSignalSpy notifySignal(&audioInput, SIGNAL(notify()));
- QSignalSpy stateSignal(&audioInput, SIGNAL(stateChanged(QAudio::State)));
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
- QVERIFY2((audioInput.elapsedUSecs() == qint64(0)),"elapsedUSecs() not zero on creation");
-
- audioInput.start(&buffer);
-
- // Check that QAudioInput immediately transitions to ActiveState
- QTRY_VERIFY2((stateSignal.count() >= 1),"didn't emit state changed signal on start()");
- QTRY_VERIFY2((audioInput.state() == QAudio::ActiveState), "didn't transition to ActiveState after start()");
- QVERIFY2((audioInput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- QVERIFY(audioInput.periodSize() > 0);
- QTRY_VERIFY2((audioInput.bytesReady() > 0), "no bytes available after starting");
- stateSignal.clear();
-
- audioInput.reset();
- QTRY_VERIFY2((stateSignal.count() == 1),"didn't emit StoppedState signal after reset()");
- QVERIFY2((audioInput.state() == QAudio::StoppedState), "didn't transitions to StoppedState after reset()");
- QVERIFY2((audioInput.bytesReady() == 0), "buffer not cleared after reset()");
- }
- }
-}
-
-void tst_QAudioInput::cleanupTestCase()
-{
- QFile* file;
-
- foreach (file, audioFiles) {
- file->remove();
- delete file;
- }
-}
-
-QTEST_MAIN(tst_QAudioInput)
-
-#include "tst_qaudioinput.moc"
diff --git a/tests/auto/qaudioinput/wavheader.cpp b/tests/auto/qaudioinput/wavheader.cpp
deleted file mode 100755
index 26fcd6f..0000000
--- a/tests/auto/qaudioinput/wavheader.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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/qendian.h>
-#include "wavheader.h"
-
-
-struct chunk
-{
- char id[4];
- quint32 size;
-};
-
-struct RIFFHeader
-{
- chunk descriptor; // "RIFF"
- char type[4]; // "WAVE"
-};
-
-struct WAVEHeader
-{
- chunk descriptor;
- quint16 audioFormat;
- quint16 numChannels;
- quint32 sampleRate;
- quint32 byteRate;
- quint16 blockAlign;
- quint16 bitsPerSample;
-};
-
-struct DATAHeader
-{
- chunk descriptor;
-};
-
-struct CombinedHeader
-{
- RIFFHeader riff;
- WAVEHeader wave;
- DATAHeader data;
-};
-
-static const int HeaderLength = sizeof(CombinedHeader);
-
-
-WavHeader::WavHeader(const QAudioFormat &format, qint64 dataLength)
- : m_format(format)
- , m_dataLength(dataLength)
-{
-
-}
-
-bool WavHeader::read(QIODevice &device)
-{
- bool result = true;
-
- if (!device.isSequential())
- result = device.seek(0);
- // else, assume that current position is the start of the header
-
- if (result) {
- CombinedHeader header;
- result = (device.read(reinterpret_cast<char *>(&header), HeaderLength) == HeaderLength);
- if (result) {
- if ((memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0
- || memcmp(&header.riff.descriptor.id, "RIFX", 4) == 0)
- && memcmp(&header.riff.type, "WAVE", 4) == 0
- && memcmp(&header.wave.descriptor.id, "fmt ", 4) == 0
- && header.wave.audioFormat == 1 // PCM
- ) {
- if (memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0)
- m_format.setByteOrder(QAudioFormat::LittleEndian);
- else
- m_format.setByteOrder(QAudioFormat::BigEndian);
-
- m_format.setChannels(qFromLittleEndian<quint16>(header.wave.numChannels));
- m_format.setCodec("audio/pcm");
- m_format.setFrequency(qFromLittleEndian<quint32>(header.wave.sampleRate));
- m_format.setSampleSize(qFromLittleEndian<quint16>(header.wave.bitsPerSample));
-
- switch(header.wave.bitsPerSample) {
- case 8:
- m_format.setSampleType(QAudioFormat::UnSignedInt);
- break;
- case 16:
- m_format.setSampleType(QAudioFormat::SignedInt);
- break;
- default:
- result = false;
- }
-
- m_dataLength = device.size() - HeaderLength;
- } else {
- result = false;
- }
- }
- }
-
- return result;
-}
-
-bool WavHeader::write(QIODevice &device)
-{
- CombinedHeader header;
-
- memset(&header, 0, HeaderLength);
-
- // RIFF header
- if (m_format.byteOrder() == QAudioFormat::LittleEndian)
- memcpy(header.riff.descriptor.id,"RIFF",4);
- else
- memcpy(header.riff.descriptor.id,"RIFX",4);
- qToLittleEndian<quint32>(quint32(m_dataLength + HeaderLength - 8),
- reinterpret_cast<unsigned char*>(&header.riff.descriptor.size));
- memcpy(header.riff.type, "WAVE",4);
-
- // WAVE header
- memcpy(header.wave.descriptor.id,"fmt ",4);
- qToLittleEndian<quint32>(quint32(16),
- reinterpret_cast<unsigned char*>(&header.wave.descriptor.size));
- qToLittleEndian<quint16>(quint16(1),
- reinterpret_cast<unsigned char*>(&header.wave.audioFormat));
- qToLittleEndian<quint16>(quint16(m_format.channels()),
- reinterpret_cast<unsigned char*>(&header.wave.numChannels));
- qToLittleEndian<quint32>(quint32(m_format.frequency()),
- reinterpret_cast<unsigned char*>(&header.wave.sampleRate));
- qToLittleEndian<quint32>(quint32(m_format.frequency() * m_format.channels() * m_format.sampleSize() / 8),
- reinterpret_cast<unsigned char*>(&header.wave.byteRate));
- qToLittleEndian<quint16>(quint16(m_format.channels() * m_format.sampleSize() / 8),
- reinterpret_cast<unsigned char*>(&header.wave.blockAlign));
- qToLittleEndian<quint16>(quint16(m_format.sampleSize()),
- reinterpret_cast<unsigned char*>(&header.wave.bitsPerSample));
-
- // DATA header
- memcpy(header.data.descriptor.id,"data",4);
- qToLittleEndian<quint32>(quint32(m_dataLength),
- reinterpret_cast<unsigned char*>(&header.data.descriptor.size));
-
- return (device.write(reinterpret_cast<const char *>(&header), HeaderLength) == HeaderLength);
-}
-
-const QAudioFormat& WavHeader::format() const
-{
- return m_format;
-}
-
-qint64 WavHeader::dataLength() const
-{
- return m_dataLength;
-}
-
-qint64 WavHeader::headerLength()
-{
- return HeaderLength;
-}
-
-bool WavHeader::writeDataLength(QIODevice &device, qint64 dataLength)
-{
- bool result = false;
- if (!device.isSequential()) {
- device.seek(40);
- unsigned char dataLengthLE[4];
- qToLittleEndian<quint32>(quint32(dataLength), dataLengthLE);
- result = (device.write(reinterpret_cast<const char *>(dataLengthLE), 4) == 4);
- }
- return result;
-}
diff --git a/tests/auto/qaudioinput/wavheader.h b/tests/auto/qaudioinput/wavheader.h
deleted file mode 100755
index 4136da0..0000000
--- a/tests/auto/qaudioinput/wavheader.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef WAVHEADER_H
-#define WAVHEADER_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qfile.h>
-#include <qaudioformat.h>
-
-/**
- * Helper class for parsing WAV file headers.
- *
- * See https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
- */
-class WavHeader
-{
-public:
- WavHeader(const QAudioFormat &format = QAudioFormat(),
- qint64 dataLength = 0);
-
- // Reads WAV header and seeks to start of data
- bool read(QIODevice &device);
-
- // Writes WAV header
- bool write(QIODevice &device);
-
- const QAudioFormat& format() const;
- qint64 dataLength() const;
-
- static qint64 headerLength();
-
- static bool writeDataLength(QIODevice &device, qint64 dataLength);
-
-private:
- QAudioFormat m_format;
- qint64 m_dataLength;
-};
-
-#endif
-
diff --git a/tests/auto/qaudiooutput/qaudiooutput.pro b/tests/auto/qaudiooutput/qaudiooutput.pro
deleted file mode 100644
index e3b5050..0000000
--- a/tests/auto/qaudiooutput/qaudiooutput.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = tst_qaudiooutput
-
-QT += core multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-# This is more of a system test
-# CONFIG += testcase
-
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
-
-HEADERS += wavheader.h
-SOURCES += wavheader.cpp tst_qaudiooutput.cpp
diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
deleted file mode 100755
index 18f28a2..0000000
--- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
+++ /dev/null
@@ -1,959 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include <QtCore/qlocale.h>
-
-#include <qaudiooutput.h>
-#include <qaudiodeviceinfo.h>
-#include <qaudioformat.h>
-#include <qaudio.h>
-
-#include "wavheader.h"
-
-#define AUDIO_BUFFER 192000
-
-#ifndef QTRY_VERIFY2
-#define QTRY_VERIFY2(__expr,__msg) \
- do { \
- const int __step = 50; \
- const int __timeout = 5000; \
- if (!(__expr)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QVERIFY2(__expr,__msg); \
- } while(0)
-#endif
-
-Q_DECLARE_METATYPE(QAudioFormat)
-
-class tst_QAudioOutput : public QObject
-{
- Q_OBJECT
-public:
- tst_QAudioOutput(QObject* parent=0) : QObject(parent) {}
-
-private slots:
- void initTestCase();
-
- void format();
- void invalidFormat_data();
- void invalidFormat();
-
- void bufferSize();
-
- void notifyInterval();
- void disableNotifyInterval();
-
- void stopWhileStopped();
- void suspendWhileStopped();
- void resumeWhileStopped();
-
- void pull();
- void pullSuspendResume();
-
- void push();
- void pushSuspendResume();
- void pushUnderrun();
-
- void cleanupTestCase();
-
-private:
- QString formatToFileName(const QAudioFormat &format);
- QString workingDir();
- void createSineWaveData(const QAudioFormat &format, qint64 length, int frequency = 440);
-
- QAudioDeviceInfo audioDevice;
- QList<QAudioFormat> testFormats;
- QList<QFile*> audioFiles;
-
- QScopedPointer<QByteArray> m_byteArray;
- QScopedPointer<QBuffer> m_buffer;
-};
-
-QString tst_QAudioOutput::formatToFileName(const QAudioFormat &format)
-{
- const QString formatEndian = (format.byteOrder() == QAudioFormat::LittleEndian)
- ? QString("LE") : QString("BE");
-
- const QString formatSigned = (format.sampleType() == QAudioFormat::SignedInt)
- ? QString("signed") : QString("unsigned");
-
- return QString("%1_%2_%3_%4_%5")
- .arg(format.frequency())
- .arg(format.sampleSize())
- .arg(formatSigned)
- .arg(formatEndian)
- .arg(format.channels());
-}
-
-
-QString tst_QAudioOutput::workingDir()
-{
- QDir working(QString(SRCDIR));
-
- if (working.exists())
- return QString(SRCDIR);
-
- return QDir::currentPath();
-}
-
-void tst_QAudioOutput::createSineWaveData(const QAudioFormat &format, qint64 length, int frequency)
-{
- const int channelBytes = format.sampleSize() / 8;
- const int sampleBytes = format.channels() * channelBytes;
-
- Q_ASSERT(length % sampleBytes == 0);
- Q_UNUSED(sampleBytes) // suppress warning in release builds
-
- m_byteArray.reset(new QByteArray(length, 0));
- unsigned char *ptr = reinterpret_cast<unsigned char *>(m_byteArray->data());
- int sampleIndex = 0;
-
- while (length) {
- const qreal x = qSin(2 * M_PI * frequency * qreal(sampleIndex % format.frequency()) / format.frequency());
- for (int i=0; i<format.channels(); ++i) {
- if (format.sampleSize() == 8 && format.sampleType() == QAudioFormat::UnSignedInt) {
- const quint8 value = static_cast<quint8>((1.0 + x) / 2 * 255);
- *reinterpret_cast<quint8*>(ptr) = value;
- } else if (format.sampleSize() == 8 && format.sampleType() == QAudioFormat::SignedInt) {
- const qint8 value = static_cast<qint8>(x * 127);
- *reinterpret_cast<quint8*>(ptr) = value;
- } else if (format.sampleSize() == 16 && format.sampleType() == QAudioFormat::UnSignedInt) {
- quint16 value = static_cast<quint16>((1.0 + x) / 2 * 65535);
- if (format.byteOrder() == QAudioFormat::LittleEndian)
- qToLittleEndian<quint16>(value, ptr);
- else
- qToBigEndian<quint16>(value, ptr);
- } else if (format.sampleSize() == 16 && format.sampleType() == QAudioFormat::SignedInt) {
- qint16 value = static_cast<qint16>(x * 32767);
- if (format.byteOrder() == QAudioFormat::LittleEndian)
- qToLittleEndian<qint16>(value, ptr);
- else
- qToBigEndian<qint16>(value, ptr);
- }
-
- ptr += channelBytes;
- length -= channelBytes;
- }
- ++sampleIndex;
- }
-
- m_buffer.reset(new QBuffer(m_byteArray.data(), this));
- Q_ASSERT(m_buffer->open(QIODevice::ReadOnly));
-}
-
-void tst_QAudioOutput::initTestCase()
-{
- qRegisterMetaType<QAudioFormat>();
-
- // Only perform tests if audio output device exists
- const QList<QAudioDeviceInfo> devices =
- QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
-
- if (devices.size() <= 0)
- QSKIP("No audio backend", SkipAll);
-
- audioDevice = QAudioDeviceInfo::defaultOutputDevice();
-
-
- QAudioFormat format;
-
- format.setCodec("audio/pcm");
-
- if (audioDevice.isFormatSupported(audioDevice.preferredFormat()))
- testFormats.append(audioDevice.preferredFormat());
-
- // PCM 8000 mono S8
- format.setFrequency(8000);
- format.setSampleSize(8);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setChannels(1);
- if (audioDevice.isFormatSupported(format))
- testFormats.append(format);
-
- // PCM 11025 mono S16LE
- format.setFrequency(11025);
- format.setSampleSize(16);
- if (audioDevice.isFormatSupported(format))
- testFormats.append(format);
-
- // PCM 22050 mono S16LE
- format.setFrequency(22050);
- if (audioDevice.isFormatSupported(format))
- testFormats.append(format);
-
- // PCM 22050 stereo S16LE
- format.setChannels(2);
- if (audioDevice.isFormatSupported(format))
- testFormats.append(format);
-
- // PCM 44100 stereo S16LE
- format.setFrequency(44100);
- if (audioDevice.isFormatSupported(format))
- testFormats.append(format);
-
- // PCM 48000 stereo S16LE
- format.setFrequency(48000);
- if (audioDevice.isFormatSupported(format))
- testFormats.append(format);
-
- QVERIFY(testFormats.size());
-
- foreach (const QAudioFormat &format, testFormats) {
- qint64 len = (format.frequency()*format.channels()*(format.sampleSize()/8)*2); // 2 seconds
- createSineWaveData(format, len);
- // Write generate sine wave data to file
- QFile* file = new QFile(workingDir() + QString("generated") + formatToFileName(format) + QString(".wav"));
- if (file->open(QIODevice::WriteOnly)) {
- WavHeader wavHeader(format, len);
- wavHeader.write(*file);
- file->write(m_byteArray->data(), len);
- file->close();
- audioFiles.append(file);
- }
- }
-}
-
-void tst_QAudioOutput::format()
-{
- QAudioOutput audioOutput(audioDevice.preferredFormat(), this);
-
- QAudioFormat requested = audioDevice.preferredFormat();
- QAudioFormat actual = audioOutput.format();
-
- QVERIFY2((requested.channels() == actual.channels()),
- QString("channels: requested=%1, actual=%2").arg(requested.channels()).arg(actual.channels()).toLocal8Bit().constData());
- QVERIFY2((requested.frequency() == actual.frequency()),
- QString("frequency: requested=%1, actual=%2").arg(requested.frequency()).arg(actual.frequency()).toLocal8Bit().constData());
- QVERIFY2((requested.sampleSize() == actual.sampleSize()),
- QString("sampleSize: requested=%1, actual=%2").arg(requested.sampleSize()).arg(actual.sampleSize()).toLocal8Bit().constData());
- QVERIFY2((requested.codec() == actual.codec()),
- QString("codec: requested=%1, actual=%2").arg(requested.codec()).arg(actual.codec()).toLocal8Bit().constData());
- QVERIFY2((requested.byteOrder() == actual.byteOrder()),
- QString("byteOrder: requested=%1, actual=%2").arg(requested.byteOrder()).arg(actual.byteOrder()).toLocal8Bit().constData());
- QVERIFY2((requested.sampleType() == actual.sampleType()),
- QString("sampleType: requested=%1, actual=%2").arg(requested.sampleType()).arg(actual.sampleType()).toLocal8Bit().constData());
-}
-
-void tst_QAudioOutput::invalidFormat_data()
-{
- QTest::addColumn<QAudioFormat>("invalidFormat");
-
- QAudioFormat format;
-
- QTest::newRow("Null Format")
- << format;
-
- format = audioDevice.preferredFormat();
- format.setChannelCount(0);
- QTest::newRow("Channel count 0")
- << format;
-
- format = audioDevice.preferredFormat();
- format.setSampleRate(0);
- QTest::newRow("Sample rate 0")
- << format;
-
- format = audioDevice.preferredFormat();
- format.setSampleSize(0);
- QTest::newRow("Sample size 0")
- << format;
-}
-
-void tst_QAudioOutput::invalidFormat()
-{
- QFETCH(QAudioFormat, invalidFormat);
-
- QVERIFY2(!audioDevice.isFormatSupported(invalidFormat),
- "isFormatSupported() is returning true on an invalid format");
-
- QAudioOutput audioOutput(invalidFormat, this);
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
-
- audioOutput.start();
- // Check that error is raised
- QTRY_VERIFY2((audioOutput.error() == QAudio::OpenError),"error() was not set to QAudio::OpenError after start()");
-}
-
-void tst_QAudioOutput::bufferSize()
-{
- QAudioOutput audioOutput(audioDevice.preferredFormat(), this);
-
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError on creation");
-
- audioOutput.setBufferSize(512);
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after setBufferSize(512)");
- QVERIFY2((audioOutput.bufferSize() == 512),
- QString("bufferSize: requested=512, actual=%2").arg(audioOutput.bufferSize()).toLocal8Bit().constData());
-
- audioOutput.setBufferSize(4096);
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after setBufferSize(4096)");
- QVERIFY2((audioOutput.bufferSize() == 4096),
- QString("bufferSize: requested=4096, actual=%2").arg(audioOutput.bufferSize()).toLocal8Bit().constData());
-
- audioOutput.setBufferSize(8192);
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after setBufferSize(8192)");
- QVERIFY2((audioOutput.bufferSize() == 8192),
- QString("bufferSize: requested=8192, actual=%2").arg(audioOutput.bufferSize()).toLocal8Bit().constData());
-}
-
-void tst_QAudioOutput::notifyInterval()
-{
- QAudioOutput audioOutput(audioDevice.preferredFormat(), this);
-
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError on creation");
-
- audioOutput.setNotifyInterval(50);
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after setNotifyInterval(50)");
- QVERIFY2((audioOutput.notifyInterval() == 50),
- QString("notifyInterval: requested=50, actual=%2").arg(audioOutput.notifyInterval()).toLocal8Bit().constData());
-
- audioOutput.setNotifyInterval(100);
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after setNotifyInterval(100)");
- QVERIFY2((audioOutput.notifyInterval() == 100),
- QString("notifyInterval: requested=100, actual=%2").arg(audioOutput.notifyInterval()).toLocal8Bit().constData());
-
- audioOutput.setNotifyInterval(250);
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after setNotifyInterval(250)");
- QVERIFY2((audioOutput.notifyInterval() == 250),
- QString("notifyInterval: requested=250, actual=%2").arg(audioOutput.notifyInterval()).toLocal8Bit().constData());
-
- audioOutput.setNotifyInterval(1000);
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after setNotifyInterval(1000)");
- QVERIFY2((audioOutput.notifyInterval() == 1000),
- QString("notifyInterval: requested=1000, actual=%2").arg(audioOutput.notifyInterval()).toLocal8Bit().constData());
-}
-
-void tst_QAudioOutput::disableNotifyInterval()
-{
- // Sets an invalid notification interval (QAudioOutput::setNotifyInterval(0))
- // Checks that
- // - No error is raised (QAudioOutput::error() returns QAudio::NoError)
- // - if <= 0, set to zero and disable notify signal
-
- QAudioOutput audioOutput(audioDevice.preferredFormat(), this);
-
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError on creation");
-
- audioOutput.setNotifyInterval(0);
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after setNotifyInterval(0)");
- QVERIFY2((audioOutput.notifyInterval() == 0),
- "notifyInterval() is not zero after setNotifyInterval(0)");
-
- audioOutput.setNotifyInterval(-1);
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after setNotifyInterval(-1)");
- QVERIFY2((audioOutput.notifyInterval() == 0),
- "notifyInterval() is not zero after setNotifyInterval(-1)");
-
- //start and run to check if notify() is emitted
- if (audioFiles.size() > 0) {
- QAudioOutput audioOutputCheck(testFormats.at(0), this);
- audioOutputCheck.setNotifyInterval(0);
- QSignalSpy notifySignal(&audioOutputCheck, SIGNAL(notify()));
- audioFiles.at(0)->open(QIODevice::ReadOnly);
- audioOutputCheck.start(audioFiles.at(0));
- QTest::qWait(3000); // 3 seconds should be plenty
- audioOutputCheck.stop();
- QVERIFY2((notifySignal.count() == 0),
- QString("didn't disable notify interval: shouldn't have got any but got %1").arg(notifySignal.count()).toLocal8Bit().constData());
- audioFiles.at(0)->close();
- }
-}
-
-void tst_QAudioOutput::stopWhileStopped()
-{
- // Calls QAudioOutput::stop() when object is already in StoppedState
- // Checks that
- // - No state change occurs
- // - No error is raised (QAudioOutput::error() returns QAudio::NoError)
-
- QAudioOutput audioOutput(audioDevice.preferredFormat(), this);
-
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
-
- QSignalSpy stateSignal(&audioOutput, SIGNAL(stateChanged(QAudio::State)));
- audioOutput.stop();
-
- // Check that no state transition occurred
- QVERIFY2((stateSignal.count() == 0), "stop() while stopped is emitting a signal and it shouldn't");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError after stop()");
-}
-
-void tst_QAudioOutput::suspendWhileStopped()
-{
- // Calls QAudioOutput::suspend() when object is already in StoppedState
- // Checks that
- // - No state change occurs
- // - No error is raised (QAudioOutput::error() returns QAudio::NoError)
-
- QAudioOutput audioOutput(audioDevice.preferredFormat(), this);
-
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
-
- QSignalSpy stateSignal(&audioOutput, SIGNAL(stateChanged(QAudio::State)));
- audioOutput.suspend();
-
- // Check that no state transition occurred
- QVERIFY2((stateSignal.count() == 0), "stop() while suspended is emitting a signal and it shouldn't");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError after stop()");
-}
-
-void tst_QAudioOutput::resumeWhileStopped()
-{
- // Calls QAudioOutput::resume() when object is already in StoppedState
- // Checks that
- // - No state change occurs
- // - No error is raised (QAudioOutput::error() returns QAudio::NoError)
-
- QAudioOutput audioOutput(audioDevice.preferredFormat(), this);
-
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
-
- QSignalSpy stateSignal(&audioOutput, SIGNAL(stateChanged(QAudio::State)));
- audioOutput.resume();
-
- // Check that no state transition occurred
- QVERIFY2((stateSignal.count() == 0), "resume() while stopped is emitting a signal and it shouldn't");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError after resume()");
-}
-
-void tst_QAudioOutput::pull()
-{
- for(int i=0; i<audioFiles.count(); i++) {
- QAudioOutput audioOutput(testFormats.at(i), this);
-
- audioOutput.setNotifyInterval(100);
-
- QSignalSpy notifySignal(&audioOutput, SIGNAL(notify()));
- QSignalSpy stateSignal(&audioOutput, SIGNAL(stateChanged(QAudio::State)));
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
- QVERIFY2((audioOutput.elapsedUSecs() == qint64(0)),"elapsedUSecs() not zero on creation");
-
- audioFiles.at(i)->close();
- audioFiles.at(i)->open(QIODevice::ReadOnly);
- audioFiles.at(i)->seek(WavHeader::headerLength());
-
- audioOutput.start(audioFiles.at(i));
-
- // Check that QAudioOutput immediately transitions to ActiveState
- QTRY_VERIFY2((stateSignal.count() == 1),
- QString("didn't emit signal on start(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- QVERIFY(audioOutput.periodSize() > 0);
- stateSignal.clear();
-
- // Check that 'elapsed' increases
- QTest::qWait(40);
- QVERIFY2((audioOutput.elapsedUSecs() > 0), "elapsedUSecs() is still zero after start()");
-
- // Wait until playback finishes
- QTest::qWait(3000); // 3 seconds should be plenty
-
- QVERIFY2(audioFiles.at(i)->atEnd(), "didn't play to EOF");
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit IdleState signal when at EOF, got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::IdleState), "didn't transitions to IdleState when at EOF");
- stateSignal.clear();
-
- qint64 processedUs = audioOutput.processedUSecs();
-
- audioOutput.stop();
- QTest::qWait(40);
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit StoppedState signal after stop(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "didn't transitions to StoppedState after stop()");
-
- QVERIFY2((processedUs == 2000000),
- QString("processedUSecs() doesn't equal file duration in us (%1)").arg(processedUs).toLocal8Bit().constData());
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after stop()");
- QVERIFY2((audioOutput.elapsedUSecs() == (qint64)0), "elapsedUSecs() not equal to zero in StoppedState");
- QVERIFY2((notifySignal.count() > 15 && notifySignal.count() < 25),
- QString("too many notify() signals emitted (%1)").arg(notifySignal.count()).toLocal8Bit().constData());
-
- audioFiles.at(i)->close();
- }
-}
-
-void tst_QAudioOutput::pullSuspendResume()
-{
- for(int i=0; i<audioFiles.count(); i++) {
- QAudioOutput audioOutput(testFormats.at(i), this);
-
- audioOutput.setNotifyInterval(100);
-
- QSignalSpy notifySignal(&audioOutput, SIGNAL(notify()));
- QSignalSpy stateSignal(&audioOutput, SIGNAL(stateChanged(QAudio::State)));
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
- QVERIFY2((audioOutput.elapsedUSecs() == qint64(0)),"elapsedUSecs() not zero on creation");
-
- audioFiles.at(i)->close();
- audioFiles.at(i)->open(QIODevice::ReadOnly);
- audioFiles.at(i)->seek(WavHeader::headerLength());
-
- audioOutput.start(audioFiles.at(i));
- // Check that QAudioOutput immediately transitions to ActiveState
- QTRY_VERIFY2((stateSignal.count() == 1),
- QString("didn't emit signal on start(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- QVERIFY(audioOutput.periodSize() > 0);
- stateSignal.clear();
-
- // Wait for half of clip to play
- QTest::qWait(1000);
-
- audioOutput.suspend();
-
- // Give backends running in separate threads a chance to suspend.
- QTest::qWait(100);
-
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit SuspendedState signal after suspend(), got %1 signals instead")
- .arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::SuspendedState), "didn't transition to SuspendedState after suspend()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after suspend()");
- stateSignal.clear();
-
- // Check that only 'elapsed', and not 'processed' increases while suspended
- qint64 elapsedUs = audioOutput.elapsedUSecs();
- qint64 processedUs = audioOutput.processedUSecs();
- QTest::qWait(1000);
- QVERIFY(audioOutput.elapsedUSecs() > elapsedUs);
- QVERIFY(audioOutput.processedUSecs() == processedUs);
-
- audioOutput.resume();
-
- // Give backends running in separate threads a chance to suspend.
- QTest::qWait(100);
-
- // Check that QAudioOutput immediately transitions to ActiveState
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit signal after resume(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after resume()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after resume()");
- stateSignal.clear();
-
- // Wait until playback finishes
- QTest::qWait(3000); // 3 seconds should be plenty
-
- QVERIFY2(audioFiles.at(i)->atEnd(), "didn't play to EOF");
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit IdleState signal when at EOF, got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::IdleState), "didn't transitions to IdleState when at EOF");
- stateSignal.clear();
-
- processedUs = audioOutput.processedUSecs();
-
- audioOutput.stop();
- QTest::qWait(40);
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit StoppedState signal after stop(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "didn't transitions to StoppedState after stop()");
-
- QVERIFY2((processedUs == 2000000),
- QString("processedUSecs() doesn't equal file duration in us (%1)").arg(processedUs).toLocal8Bit().constData());
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after stop()");
- QVERIFY2((audioOutput.elapsedUSecs() == (qint64)0), "elapsedUSecs() not equal to zero in StoppedState");
-
- audioFiles.at(i)->close();
- }
-}
-
-void tst_QAudioOutput::push()
-{
- for(int i=0; i<audioFiles.count(); i++) {
- QAudioOutput audioOutput(testFormats.at(i), this);
-
- audioOutput.setNotifyInterval(100);
-
- QSignalSpy notifySignal(&audioOutput, SIGNAL(notify()));
- QSignalSpy stateSignal(&audioOutput, SIGNAL(stateChanged(QAudio::State)));
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
- QVERIFY2((audioOutput.elapsedUSecs() == qint64(0)),"elapsedUSecs() not zero on creation");
-
- audioFiles.at(i)->close();
- audioFiles.at(i)->open(QIODevice::ReadOnly);
- audioFiles.at(i)->seek(WavHeader::headerLength());
-
- QIODevice* feed = audioOutput.start();
-
- // Check that QAudioOutput immediately transitions to IdleState
- QTRY_VERIFY2((stateSignal.count() == 1),
- QString("didn't emit signal on start(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::IdleState), "didn't transition to IdleState after start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- QVERIFY(audioOutput.periodSize() > 0);
- stateSignal.clear();
-
- // Check that 'elapsed' increases
- QTest::qWait(40);
- QVERIFY2((audioOutput.elapsedUSecs() > 0), "elapsedUSecs() is still zero after start()");
- QVERIFY2((audioOutput.processedUSecs() == qint64(0)), "processedUSecs() is not zero after start()");
-
- qint64 written = 0;
- bool firstBuffer = true;
- QByteArray buffer(AUDIO_BUFFER, 0);
-
- while (written < audioFiles.at(i)->size()-WavHeader::headerLength()) {
-
- if (audioOutput.bytesFree() >= audioOutput.periodSize()) {
- qint64 len = audioFiles.at(i)->read(buffer.data(),audioOutput.periodSize());
- written += feed->write(buffer.constData(), len);
-
- if (firstBuffer) {
- // Check for transition to ActiveState when data is provided
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit signal after receiving data, got %1 signals instead")
- .arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after receiving data");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after receiving data");
- firstBuffer = false;
- }
- } else
- QTest::qWait(20);
- }
- stateSignal.clear();
-
- // Wait until playback finishes
- QTest::qWait(3000); // 3 seconds should be plenty
-
- QVERIFY2(audioFiles.at(i)->atEnd(), "didn't play to EOF");
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit IdleState signal when at EOF, got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::IdleState), "didn't transitions to IdleState when at EOF");
- stateSignal.clear();
-
- qint64 processedUs = audioOutput.processedUSecs();
-
- audioOutput.stop();
- QTest::qWait(40);
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit StoppedState signal after stop(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "didn't transitions to StoppedState after stop()");
-
- QVERIFY2((processedUs == 2000000),
- QString("processedUSecs() doesn't equal file duration in us (%1)").arg(processedUs).toLocal8Bit().constData());
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after stop()");
- QVERIFY2((audioOutput.elapsedUSecs() == (qint64)0), "elapsedUSecs() not equal to zero in StoppedState");
- QVERIFY2((notifySignal.count() > 15 && notifySignal.count() < 25),
- QString("too many notify() signals emitted (%1)").arg(notifySignal.count()).toLocal8Bit().constData());
-
- audioFiles.at(i)->close();
- }
-}
-
-void tst_QAudioOutput::pushSuspendResume()
-{
- for(int i=0; i<audioFiles.count(); i++) {
- QAudioOutput audioOutput(testFormats.at(i), this);
-
- audioOutput.setNotifyInterval(100);
-
- QSignalSpy notifySignal(&audioOutput, SIGNAL(notify()));
- QSignalSpy stateSignal(&audioOutput, SIGNAL(stateChanged(QAudio::State)));
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
- QVERIFY2((audioOutput.elapsedUSecs() == qint64(0)),"elapsedUSecs() not zero on creation");
-
- audioFiles.at(i)->close();
- audioFiles.at(i)->open(QIODevice::ReadOnly);
- audioFiles.at(i)->seek(WavHeader::headerLength());
-
- QIODevice* feed = audioOutput.start();
-
- // Check that QAudioOutput immediately transitions to IdleState
- QTRY_VERIFY2((stateSignal.count() == 1),
- QString("didn't emit signal on start(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::IdleState), "didn't transition to IdleState after start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- QVERIFY(audioOutput.periodSize() > 0);
- stateSignal.clear();
-
- // Check that 'elapsed' increases
- QTest::qWait(40);
- QVERIFY2((audioOutput.elapsedUSecs() > 0), "elapsedUSecs() is still zero after start()");
- QVERIFY2((audioOutput.processedUSecs() == qint64(0)), "processedUSecs() is not zero after start()");
-
- qint64 written = 0;
- bool firstBuffer = true;
- QByteArray buffer(AUDIO_BUFFER, 0);
-
- // Play half of the clip
- while (written < (audioFiles.at(i)->size()-WavHeader::headerLength())/2) {
-
- if (audioOutput.bytesFree() >= audioOutput.periodSize()) {
- qint64 len = audioFiles.at(i)->read(buffer.data(),audioOutput.periodSize());
- written += feed->write(buffer.constData(), len);
-
- if (firstBuffer) {
- // Check for transition to ActiveState when data is provided
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit signal after receiving data, got %1 signals instead")
- .arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after receiving data");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after receiving data");
- firstBuffer = false;
- }
- } else
- QTest::qWait(20);
- }
- stateSignal.clear();
-
- audioOutput.suspend();
-
- // Give backends running in separate threads a chance to suspend.
- QTest::qWait(100);
-
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit SuspendedState signal after suspend(), got %1 signals instead")
- .arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::SuspendedState), "didn't transition to SuspendedState after suspend()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after suspend()");
- stateSignal.clear();
-
- // Check that only 'elapsed', and not 'processed' increases while suspended
- qint64 elapsedUs = audioOutput.elapsedUSecs();
- qint64 processedUs = audioOutput.processedUSecs();
- QTest::qWait(1000);
- QVERIFY(audioOutput.elapsedUSecs() > elapsedUs);
- QVERIFY(audioOutput.processedUSecs() == processedUs);
-
- audioOutput.resume();
-
- // Give backends running in separate threads a chance to suspend.
- QTest::qWait(100);
-
- // Check that QAudioOutput immediately transitions to ActiveState
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit signal after resume(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after resume()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after resume()");
- stateSignal.clear();
-
- // Play rest of the clip
- while (!audioFiles.at(i)->atEnd()) {
- if (audioOutput.bytesFree() >= audioOutput.periodSize()) {
- qint64 len = audioFiles.at(i)->read(buffer.data(),audioOutput.periodSize());
- written += feed->write(buffer.constData(), len);
- } else
- QTest::qWait(20);
- }
- stateSignal.clear();
-
- // Wait until playback finishes
- QTest::qWait(1000); // 1 seconds should be plenty
-
- QVERIFY2(audioFiles.at(i)->atEnd(), "didn't play to EOF");
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit IdleState signal when at EOF, got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::IdleState), "didn't transitions to IdleState when at EOF");
- stateSignal.clear();
-
- processedUs = audioOutput.processedUSecs();
-
- audioOutput.stop();
- QTest::qWait(40);
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit StoppedState signal after stop(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "didn't transitions to StoppedState after stop()");
-
- QVERIFY2((processedUs == 2000000),
- QString("processedUSecs() doesn't equal file duration in us (%1)").arg(processedUs).toLocal8Bit().constData());
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after stop()");
- QVERIFY2((audioOutput.elapsedUSecs() == (qint64)0), "elapsedUSecs() not equal to zero in StoppedState");
-
- audioFiles.at(i)->close();
- }
-}
-
-void tst_QAudioOutput::pushUnderrun()
-{
- for(int i=0; i<audioFiles.count(); i++) {
- QAudioOutput audioOutput(testFormats.at(i), this);
-
- audioOutput.setNotifyInterval(100);
-
- QSignalSpy notifySignal(&audioOutput, SIGNAL(notify()));
- QSignalSpy stateSignal(&audioOutput, SIGNAL(stateChanged(QAudio::State)));
-
- // Check that we are in the default state before calling start
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
- QVERIFY2((audioOutput.elapsedUSecs() == qint64(0)),"elapsedUSecs() not zero on creation");
-
- audioFiles.at(i)->close();
- audioFiles.at(i)->open(QIODevice::ReadOnly);
- audioFiles.at(i)->seek(WavHeader::headerLength());
-
- QIODevice* feed = audioOutput.start();
-
- // Check that QAudioOutput immediately transitions to IdleState
- QTRY_VERIFY2((stateSignal.count() == 1),
- QString("didn't emit signal on start(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::IdleState), "didn't transition to IdleState after start()");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after start()");
- QVERIFY(audioOutput.periodSize() > 0);
- stateSignal.clear();
-
- // Check that 'elapsed' increases
- QTest::qWait(40);
- QVERIFY2((audioOutput.elapsedUSecs() > 0), "elapsedUSecs() is still zero after start()");
- QVERIFY2((audioOutput.processedUSecs() == qint64(0)), "processedUSecs() is not zero after start()");
-
- qint64 written = 0;
- bool firstBuffer = true;
- QByteArray buffer(AUDIO_BUFFER, 0);
-
- // Play half of the clip
- while (written < (audioFiles.at(i)->size()-WavHeader::headerLength())/2) {
-
- if (audioOutput.bytesFree() >= audioOutput.periodSize()) {
- qint64 len = audioFiles.at(i)->read(buffer.data(),audioOutput.periodSize());
- written += feed->write(buffer.constData(), len);
-
- if (firstBuffer) {
- // Check for transition to ActiveState when data is provided
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit signal after receiving data, got %1 signals instead")
- .arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after receiving data");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after receiving data");
- firstBuffer = false;
- }
- } else
- QTest::qWait(20);
- }
- stateSignal.clear();
-
- // Wait for data to be played
- QTest::qWait(1000);
-
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit IdleState signal after suspend(), got %1 signals instead")
- .arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::IdleState), "didn't transition to IdleState, no data");
- QVERIFY2((audioOutput.error() == QAudio::UnderrunError), "error state is not equal to QAudio::UnderrunError, no data");
- stateSignal.clear();
-
- firstBuffer = true;
- // Play rest of the clip
- while (!audioFiles.at(i)->atEnd()) {
- if (audioOutput.bytesFree() >= audioOutput.periodSize()) {
- qint64 len = audioFiles.at(i)->read(buffer.data(),audioOutput.periodSize());
- written += feed->write(buffer.constData(), len);
- if (firstBuffer) {
- // Check for transition to ActiveState when data is provided
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit signal after receiving data, got %1 signals instead")
- .arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after receiving data");
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after receiving data");
- firstBuffer = false;
- }
- } else
- QTest::qWait(20);
- }
- stateSignal.clear();
-
- // Wait until playback finishes
- QTest::qWait(1000); // 1 seconds should be plenty
-
- QVERIFY2(audioFiles.at(i)->atEnd(), "didn't play to EOF");
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit IdleState signal when at EOF, got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::IdleState), "didn't transitions to IdleState when at EOF");
- stateSignal.clear();
-
- qint64 processedUs = audioOutput.processedUSecs();
-
- audioOutput.stop();
- QTest::qWait(40);
- QVERIFY2((stateSignal.count() == 1),
- QString("didn't emit StoppedState signal after stop(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
- QVERIFY2((audioOutput.state() == QAudio::StoppedState), "didn't transitions to StoppedState after stop()");
-
- QVERIFY2((processedUs == 2000000),
- QString("processedUSecs() doesn't equal file duration in us (%1)").arg(processedUs).toLocal8Bit().constData());
- QVERIFY2((audioOutput.error() == QAudio::NoError), "error() is not QAudio::NoError after stop()");
- QVERIFY2((audioOutput.elapsedUSecs() == (qint64)0), "elapsedUSecs() not equal to zero in StoppedState");
-
- audioFiles.at(i)->close();
- }
-}
-
-void tst_QAudioOutput::cleanupTestCase()
-{
- QFile* file;
-
- foreach (file, audioFiles) {
- file->remove();
- delete file;
- }
-}
-
-QTEST_MAIN(tst_QAudioOutput)
-
-#include "tst_qaudiooutput.moc"
diff --git a/tests/auto/qaudiooutput/wavheader.cpp b/tests/auto/qaudiooutput/wavheader.cpp
deleted file mode 100755
index 26fcd6f..0000000
--- a/tests/auto/qaudiooutput/wavheader.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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/qendian.h>
-#include "wavheader.h"
-
-
-struct chunk
-{
- char id[4];
- quint32 size;
-};
-
-struct RIFFHeader
-{
- chunk descriptor; // "RIFF"
- char type[4]; // "WAVE"
-};
-
-struct WAVEHeader
-{
- chunk descriptor;
- quint16 audioFormat;
- quint16 numChannels;
- quint32 sampleRate;
- quint32 byteRate;
- quint16 blockAlign;
- quint16 bitsPerSample;
-};
-
-struct DATAHeader
-{
- chunk descriptor;
-};
-
-struct CombinedHeader
-{
- RIFFHeader riff;
- WAVEHeader wave;
- DATAHeader data;
-};
-
-static const int HeaderLength = sizeof(CombinedHeader);
-
-
-WavHeader::WavHeader(const QAudioFormat &format, qint64 dataLength)
- : m_format(format)
- , m_dataLength(dataLength)
-{
-
-}
-
-bool WavHeader::read(QIODevice &device)
-{
- bool result = true;
-
- if (!device.isSequential())
- result = device.seek(0);
- // else, assume that current position is the start of the header
-
- if (result) {
- CombinedHeader header;
- result = (device.read(reinterpret_cast<char *>(&header), HeaderLength) == HeaderLength);
- if (result) {
- if ((memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0
- || memcmp(&header.riff.descriptor.id, "RIFX", 4) == 0)
- && memcmp(&header.riff.type, "WAVE", 4) == 0
- && memcmp(&header.wave.descriptor.id, "fmt ", 4) == 0
- && header.wave.audioFormat == 1 // PCM
- ) {
- if (memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0)
- m_format.setByteOrder(QAudioFormat::LittleEndian);
- else
- m_format.setByteOrder(QAudioFormat::BigEndian);
-
- m_format.setChannels(qFromLittleEndian<quint16>(header.wave.numChannels));
- m_format.setCodec("audio/pcm");
- m_format.setFrequency(qFromLittleEndian<quint32>(header.wave.sampleRate));
- m_format.setSampleSize(qFromLittleEndian<quint16>(header.wave.bitsPerSample));
-
- switch(header.wave.bitsPerSample) {
- case 8:
- m_format.setSampleType(QAudioFormat::UnSignedInt);
- break;
- case 16:
- m_format.setSampleType(QAudioFormat::SignedInt);
- break;
- default:
- result = false;
- }
-
- m_dataLength = device.size() - HeaderLength;
- } else {
- result = false;
- }
- }
- }
-
- return result;
-}
-
-bool WavHeader::write(QIODevice &device)
-{
- CombinedHeader header;
-
- memset(&header, 0, HeaderLength);
-
- // RIFF header
- if (m_format.byteOrder() == QAudioFormat::LittleEndian)
- memcpy(header.riff.descriptor.id,"RIFF",4);
- else
- memcpy(header.riff.descriptor.id,"RIFX",4);
- qToLittleEndian<quint32>(quint32(m_dataLength + HeaderLength - 8),
- reinterpret_cast<unsigned char*>(&header.riff.descriptor.size));
- memcpy(header.riff.type, "WAVE",4);
-
- // WAVE header
- memcpy(header.wave.descriptor.id,"fmt ",4);
- qToLittleEndian<quint32>(quint32(16),
- reinterpret_cast<unsigned char*>(&header.wave.descriptor.size));
- qToLittleEndian<quint16>(quint16(1),
- reinterpret_cast<unsigned char*>(&header.wave.audioFormat));
- qToLittleEndian<quint16>(quint16(m_format.channels()),
- reinterpret_cast<unsigned char*>(&header.wave.numChannels));
- qToLittleEndian<quint32>(quint32(m_format.frequency()),
- reinterpret_cast<unsigned char*>(&header.wave.sampleRate));
- qToLittleEndian<quint32>(quint32(m_format.frequency() * m_format.channels() * m_format.sampleSize() / 8),
- reinterpret_cast<unsigned char*>(&header.wave.byteRate));
- qToLittleEndian<quint16>(quint16(m_format.channels() * m_format.sampleSize() / 8),
- reinterpret_cast<unsigned char*>(&header.wave.blockAlign));
- qToLittleEndian<quint16>(quint16(m_format.sampleSize()),
- reinterpret_cast<unsigned char*>(&header.wave.bitsPerSample));
-
- // DATA header
- memcpy(header.data.descriptor.id,"data",4);
- qToLittleEndian<quint32>(quint32(m_dataLength),
- reinterpret_cast<unsigned char*>(&header.data.descriptor.size));
-
- return (device.write(reinterpret_cast<const char *>(&header), HeaderLength) == HeaderLength);
-}
-
-const QAudioFormat& WavHeader::format() const
-{
- return m_format;
-}
-
-qint64 WavHeader::dataLength() const
-{
- return m_dataLength;
-}
-
-qint64 WavHeader::headerLength()
-{
- return HeaderLength;
-}
-
-bool WavHeader::writeDataLength(QIODevice &device, qint64 dataLength)
-{
- bool result = false;
- if (!device.isSequential()) {
- device.seek(40);
- unsigned char dataLengthLE[4];
- qToLittleEndian<quint32>(quint32(dataLength), dataLengthLE);
- result = (device.write(reinterpret_cast<const char *>(dataLengthLE), 4) == 4);
- }
- return result;
-}
diff --git a/tests/auto/qaudiooutput/wavheader.h b/tests/auto/qaudiooutput/wavheader.h
deleted file mode 100755
index 5212eca..0000000
--- a/tests/auto/qaudiooutput/wavheader.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef WAVHEADER_H
-#define WAVHEADER_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qfile.h>
-#include <qaudioformat.h>
-
-/**
- * Helper class for parsing WAV file headers.
- *
- * See https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
- */
-class WavHeader
-{
-public:
- WavHeader(const QAudioFormat &format = QAudioFormat(),
- qint64 dataLength = 0);
-
- // Reads WAV header and seeks to start of data
- bool read(QIODevice &device);
-
- // Writes WAV header
- bool write(QIODevice &device);
-
- const QAudioFormat& format() const;
- qint64 dataLength() const;
-
- static qint64 headerLength();
-
- static bool writeDataLength(QIODevice &device, qint64 dataLength);
-
-private:
- QAudioFormat m_format;
- qint64 m_dataLength;
-};
-
-#endif
-
diff --git a/tests/auto/qcamera/qcamera.pro b/tests/auto/qcamera/qcamera.pro
deleted file mode 100644
index c697545..0000000
--- a/tests/auto/qcamera/qcamera.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qcamera
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-include (../qmultimedia_common/mock.pri)
-include (../qmultimedia_common/mockcamera.pri)
-
-SOURCES += tst_qcamera.cpp
-
-maemo*:CONFIG += insignificant_test
diff --git a/tests/auto/qcamera/tst_qcamera.cpp b/tests/auto/qcamera/tst_qcamera.cpp
deleted file mode 100644
index de44ae0..0000000
--- a/tests/auto/qcamera/tst_qcamera.cpp
+++ /dev/null
@@ -1,1956 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-#include <QtTest/QtTest>
-#include <QDebug>
-
-#include <qabstractvideosurface.h>
-#include <qcameracontrol.h>
-#include <qcameralockscontrol.h>
-#include <qcameraexposurecontrol.h>
-#include <qcameraflashcontrol.h>
-#include <qcamerafocuscontrol.h>
-#include <qcameraimagecapturecontrol.h>
-#include <qimageencodercontrol.h>
-#include <qcameraimageprocessingcontrol.h>
-#include <qcameracapturebufferformatcontrol.h>
-#include <qcameracapturedestinationcontrol.h>
-#include <qmediaservice.h>
-#include <qcamera.h>
-#include <qcameraimagecapture.h>
-#include <qvideorenderercontrol.h>
-
-#include "mockcameraservice.h"
-
-#include "mockmediaserviceprovider.h"
-#include "mockvideosurface.h"
-#include "mockvideorenderercontrol.h"
-#include "mockvideowindowcontrol.h"
-
-QT_USE_NAMESPACE
-
-
-class tst_QCamera: public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- void testAvailableDevices();
- void testDeviceDescription();
- void testCtorWithDevice();
- void testSimpleCamera();
- void testSimpleCameraWhiteBalance();
- void testSimpleCameraExposure();
- void testSimpleCameraFocus();
- void testSimpleCameraCapture();
- void testSimpleCameraLock();
- void testSimpleCaptureDestination();
- void testSimpleCaptureFormat();
-
- void testCameraWhiteBalance();
- void testCameraExposure();
- void testCameraFocus();
- void testCameraCapture();
- void testCameraCaptureMetadata();
- void testImageSettings();
- void testCameraLock();
- void testCameraLockCancel();
- void testCameraEncodingProperyChange();
- void testCaptureDestination();
- void testCaptureFormat();
-
- void testConstructorWithDefaultProvider();
- void testCaptureMode();
- void testIsCaptureModeSupported();
- void testRequestedLocks();
- void testSupportedLocks();
- void testQCameraIsAvailable();
- void testAvailabilityError();
- void testSearchAndLockWithLockTypes();
- void testSetCaptureMode();
- void testUnlockWithType();
- void testCaptureModeChangedSignal();
- void testLockStatusChangedWithTypesSignal();
- void testErrorSignal();
- void testError();
- void testErrorString();
- void testStatus();
- void testLockType();
- void testLockChangeReason();
-
-
- // Test cases to for QCameraFocus
- void testCameraFocusIsAvailable();
- void testFocusModes();
- void testOpticalAndDigitalZoomChanged();
- void testMaxOpticalZoomChangedSignal();
- void testMaxDigitalZoomChangedSignal();
- void testfocusZonesChangedSignal();
-
- // Test cases for QCameraControl class.
- void testCameraControl();
- void testCaptureModeChanged_signal();
- void testEnumsOfQCameraControl();
-
- // Test case for QCameraImageProcessing class
- void testContrast();
- void testDenoisingLevel();
- void testIsAvailable();
- void testSaturation();
- void testSharpeningLevel();
- void testEnumOfQCameraImageProcessing();
-
- void testSetVideoOutput();
- void testSetVideoOutputNoService();
- void testSetVideoOutputNoControl();
- void testSetVideoOutputDestruction();
-
- void testEnumDebug();
-
- // constructor for QCameraImageProceesing
- void testImageProcessingControl();
-
- // Signals test cases for QCameraExposure
- void testSignalApertureChanged();
- void testSignalExposureCompensationChanged();
- void testSignalIsoSensitivityChanged();
- void testSignalShutterSpeedChanged();
- void testSignalFlashReady();
-
- // test constructor
- void testExposureControlConstructor();
-
-private:
- MockSimpleCameraService *mockSimpleCameraService;
- MockMediaServiceProvider *provider;
-};
-
-void tst_QCamera::initTestCase()
-{
- provider = new MockMediaServiceProvider;
- mockSimpleCameraService = new MockSimpleCameraService;
- provider->service = mockSimpleCameraService;
- qRegisterMetaType<QtMultimedia::MetaData>("QtMultimedia::MetaData");
-}
-
-void tst_QCamera::cleanupTestCase()
-{
- delete mockSimpleCameraService;
- delete provider;
-}
-
-void tst_QCamera::testAvailableDevices()
-{
- int deviceCount = QMediaServiceProvider::defaultServiceProvider()->devices(QByteArray(Q_MEDIASERVICE_CAMERA)).count();
-
- QVERIFY(QCamera::availableDevices().count() == deviceCount);
-}
-
-void tst_QCamera::testDeviceDescription()
-{
- int deviceCount = QMediaServiceProvider::defaultServiceProvider()->devices(QByteArray(Q_MEDIASERVICE_CAMERA)).count();
-
- if (deviceCount == 0)
- QVERIFY(QCamera::deviceDescription(QByteArray("random")).isNull());
- else {
- foreach (const QByteArray &device, QCamera::availableDevices())
- QVERIFY(QCamera::deviceDescription(device).length() > 0);
- }
-}
-
-void tst_QCamera::testCtorWithDevice()
-{
- int deviceCount = QMediaServiceProvider::defaultServiceProvider()->devices(QByteArray(Q_MEDIASERVICE_CAMERA)).count();
- QCamera *camera = 0;
-
- if (deviceCount == 0) {
- camera = new QCamera("random");
- QVERIFY(camera->error() == QCamera::ServiceMissingError);
- }
- else {
- camera = new QCamera(QCamera::availableDevices().first());
- QVERIFY(camera->error() == QCamera::NoError);
- }
-
- delete camera;
-}
-
-void tst_QCamera::testSimpleCamera()
-{
- QCamera camera(0, provider);
- QCOMPARE(camera.service(), (QMediaService*)mockSimpleCameraService);
-
- QCOMPARE(camera.state(), QCamera::UnloadedState);
- camera.start();
- QCOMPARE(camera.state(), QCamera::ActiveState);
- camera.stop();
- QCOMPARE(camera.state(), QCamera::LoadedState);
- camera.unload();
- QCOMPARE(camera.state(), QCamera::UnloadedState);
- camera.load();
- QCOMPARE(camera.state(), QCamera::LoadedState);
-}
-
-void tst_QCamera::testSimpleCameraWhiteBalance()
-{
- QCamera camera(0, provider);
-
- //only WhiteBalanceAuto is supported
- QVERIFY(!camera.imageProcessing()->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceAuto));
- QVERIFY(!camera.imageProcessing()->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceCloudy));
- QCOMPARE(camera.imageProcessing()->whiteBalanceMode(), QCameraImageProcessing::WhiteBalanceAuto);
- camera.imageProcessing()->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceCloudy);
- QCOMPARE(camera.imageProcessing()->whiteBalanceMode(), QCameraImageProcessing::WhiteBalanceAuto);
- QCOMPARE(camera.imageProcessing()->manualWhiteBalance(), 0);
- camera.imageProcessing()->setManualWhiteBalance(5000);
- QCOMPARE(camera.imageProcessing()->manualWhiteBalance(), 0);
-}
-
-void tst_QCamera::testSimpleCameraExposure()
-{
- QCamera camera(0, provider);
- QCameraExposure *cameraExposure = camera.exposure();
- QVERIFY(cameraExposure != 0);
-
- QVERIFY(!cameraExposure->isExposureModeSupported(QCameraExposure::ExposureAuto));
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureAuto);
- cameraExposure->setExposureMode(QCameraExposure::ExposureManual);//should be ignored
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureAuto);
-
- QVERIFY(!cameraExposure->isFlashModeSupported(QCameraExposure::FlashOff));
- QCOMPARE(cameraExposure->flashMode(), QCameraExposure::FlashOff);
- QCOMPARE(cameraExposure->isFlashReady(), false);
- cameraExposure->setFlashMode(QCameraExposure::FlashOn);
- QCOMPARE(cameraExposure->flashMode(), QCameraExposure::FlashOff);
-
- QVERIFY(!cameraExposure->isMeteringModeSupported(QCameraExposure::MeteringAverage));
- QVERIFY(!cameraExposure->isMeteringModeSupported(QCameraExposure::MeteringSpot));
- QVERIFY(!cameraExposure->isMeteringModeSupported(QCameraExposure::MeteringMatrix));
- QCOMPARE(cameraExposure->meteringMode(), QCameraExposure::MeteringMatrix);
- cameraExposure->setMeteringMode(QCameraExposure::MeteringSpot);
- QCOMPARE(cameraExposure->meteringMode(), QCameraExposure::MeteringMatrix);
-
- QCOMPARE(cameraExposure->exposureCompensation(), 0.0);
- cameraExposure->setExposureCompensation(2.0);
- QCOMPARE(cameraExposure->exposureCompensation(), 0.0);
-
- QCOMPARE(cameraExposure->isoSensitivity(), -1);
- QVERIFY(cameraExposure->supportedIsoSensitivities().isEmpty());
- cameraExposure->setManualIsoSensitivity(100);
- QCOMPARE(cameraExposure->isoSensitivity(), -1);
- cameraExposure->setAutoIsoSensitivity();
- QCOMPARE(cameraExposure->isoSensitivity(), -1);
-
- QVERIFY(cameraExposure->aperture() < 0);
- QVERIFY(cameraExposure->supportedApertures().isEmpty());
- cameraExposure->setAutoAperture();
- QVERIFY(cameraExposure->aperture() < 0);
- cameraExposure->setManualAperture(5.6);
- QVERIFY(cameraExposure->aperture() < 0);
-
- QVERIFY(cameraExposure->shutterSpeed() < 0);
- QVERIFY(cameraExposure->supportedShutterSpeeds().isEmpty());
- cameraExposure->setAutoShutterSpeed();
- QVERIFY(cameraExposure->shutterSpeed() < 0);
- cameraExposure->setManualShutterSpeed(1/128.0);
- QVERIFY(cameraExposure->shutterSpeed() < 0);
-}
-
-void tst_QCamera::testSimpleCameraFocus()
-{
- QCamera camera(0, provider);
-
- QCameraFocus *cameraFocus = camera.focus();
- QVERIFY(cameraFocus != 0);
-
- QVERIFY(!cameraFocus->isFocusModeSupported(QCameraFocus::AutoFocus));
- QVERIFY(!cameraFocus->isFocusModeSupported(QCameraFocus::ContinuousFocus));
- QVERIFY(!cameraFocus->isFocusModeSupported(QCameraFocus::InfinityFocus));
-
- QCOMPARE(cameraFocus->focusMode(), QCameraFocus::AutoFocus);
- QTest::ignoreMessage(QtWarningMsg, "Focus points mode selection is not supported");
- cameraFocus->setFocusMode(QCameraFocus::ContinuousFocus);
- QCOMPARE(cameraFocus->focusMode(), QCameraFocus::AutoFocus);
-
- QCOMPARE(cameraFocus->maximumOpticalZoom(), 1.0);
- QCOMPARE(cameraFocus->maximumDigitalZoom(), 1.0);
- QCOMPARE(cameraFocus->opticalZoom(), 1.0);
- QCOMPARE(cameraFocus->digitalZoom(), 1.0);
-
- QTest::ignoreMessage(QtWarningMsg, "The camera doesn't support zooming.");
- cameraFocus->zoomTo(100.0, 100.0);
- QCOMPARE(cameraFocus->opticalZoom(), 1.0);
- QCOMPARE(cameraFocus->digitalZoom(), 1.0);
-
-
- QVERIFY(!cameraFocus->isFocusPointModeSupported(QCameraFocus::FocusPointAuto));
- QCOMPARE(cameraFocus->focusPointMode(), QCameraFocus::FocusPointAuto);
-
-
- cameraFocus->setFocusPointMode( QCameraFocus::FocusPointCenter );
- QCOMPARE(cameraFocus->focusPointMode(), QCameraFocus::FocusPointAuto);
-
- QCOMPARE(cameraFocus->customFocusPoint(), QPointF(0.5, 0.5));
- QTest::ignoreMessage(QtWarningMsg, "Focus points selection is not supported");
- cameraFocus->setCustomFocusPoint(QPointF(1.0, 1.0));
- QCOMPARE(cameraFocus->customFocusPoint(), QPointF(0.5, 0.5));
-}
-
-void tst_QCamera::testSimpleCameraCapture()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
-
- QVERIFY(!imageCapture.isReadyForCapture());
- QVERIFY(!imageCapture.isAvailable());
-
- QCOMPARE(imageCapture.error(), QCameraImageCapture::NoError);
- QVERIFY(imageCapture.errorString().isEmpty());
-
- QSignalSpy errorSignal(&imageCapture, SIGNAL(error(int, QCameraImageCapture::Error,QString)));
- imageCapture.capture(QString::fromLatin1("/dev/null"));
- QCOMPARE(errorSignal.size(), 1);
- QCOMPARE(imageCapture.error(), QCameraImageCapture::NotSupportedFeatureError);
- QVERIFY(!imageCapture.errorString().isEmpty());
-}
-
-void tst_QCamera::testSimpleCameraLock()
-{
- QCamera camera(0, provider);
- QCOMPARE(camera.lockStatus(), QCamera::Unlocked);
- QCOMPARE(camera.lockStatus(QCamera::LockExposure), QCamera::Unlocked);
- QCOMPARE(camera.lockStatus(QCamera::LockFocus), QCamera::Unlocked);
- QCOMPARE(camera.lockStatus(QCamera::LockWhiteBalance), QCamera::Unlocked);
-
- QSignalSpy lockedSignal(&camera, SIGNAL(locked()));
- QSignalSpy lockFailedSignal(&camera, SIGNAL(lockFailed()));
- QSignalSpy lockStatusChangedSignal(&camera, SIGNAL(lockStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)));
-
- camera.searchAndLock();
- QCOMPARE(camera.lockStatus(), QCamera::Locked);
- QCOMPARE(camera.lockStatus(QCamera::LockExposure), QCamera::Locked);
- QCOMPARE(camera.lockStatus(QCamera::LockFocus), QCamera::Locked);
- QCOMPARE(camera.lockStatus(QCamera::LockWhiteBalance), QCamera::Locked);
- QCOMPARE(lockedSignal.count(), 1);
- QCOMPARE(lockFailedSignal.count(), 0);
- QCOMPARE(lockStatusChangedSignal.count(), 1);
-
- lockedSignal.clear();
- lockFailedSignal.clear();
- lockStatusChangedSignal.clear();
-
- camera.unlock();
- QCOMPARE(camera.lockStatus(), QCamera::Unlocked);
- QCOMPARE(camera.lockStatus(QCamera::LockExposure), QCamera::Unlocked);
- QCOMPARE(camera.lockStatus(QCamera::LockFocus), QCamera::Unlocked);
- QCOMPARE(camera.lockStatus(QCamera::LockWhiteBalance), QCamera::Unlocked);
-
- QCOMPARE(lockedSignal.count(), 0);
- QCOMPARE(lockFailedSignal.count(), 0);
- QCOMPARE(lockStatusChangedSignal.count(), 1);
-}
-
-void tst_QCamera::testSimpleCaptureDestination()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
-
- QVERIFY(imageCapture.isCaptureDestinationSupported(QCameraImageCapture::CaptureToFile));
- QVERIFY(!imageCapture.isCaptureDestinationSupported(QCameraImageCapture::CaptureToBuffer));
- QVERIFY(!imageCapture.isCaptureDestinationSupported(
- QCameraImageCapture::CaptureToBuffer | QCameraImageCapture::CaptureToFile));
-
- QCOMPARE(imageCapture.captureDestination(), QCameraImageCapture::CaptureToFile);
- imageCapture.setCaptureDestination(QCameraImageCapture::CaptureToBuffer);
- QCOMPARE(imageCapture.captureDestination(), QCameraImageCapture::CaptureToFile);
-}
-
-void tst_QCamera::testSimpleCaptureFormat()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
-
- QCOMPARE(imageCapture.bufferFormat(), QVideoFrame::Format_Invalid);
- QVERIFY(imageCapture.supportedBufferFormats().isEmpty());
-
- imageCapture.setBufferFormat(QVideoFrame::Format_AdobeDng);
- QCOMPARE(imageCapture.bufferFormat(), QVideoFrame::Format_Invalid);
-}
-
-void tst_QCamera::testCaptureDestination()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
-
- QVERIFY(imageCapture.isCaptureDestinationSupported(QCameraImageCapture::CaptureToFile));
- QVERIFY(imageCapture.isCaptureDestinationSupported(QCameraImageCapture::CaptureToBuffer));
- QVERIFY(!imageCapture.isCaptureDestinationSupported(
- QCameraImageCapture::CaptureToBuffer | QCameraImageCapture::CaptureToFile));
-
- QSignalSpy destinationChangedSignal(&imageCapture, SIGNAL(captureDestinationChanged(QCameraImageCapture::CaptureDestinations)));
-
- QCOMPARE(imageCapture.captureDestination(), QCameraImageCapture::CaptureToFile);
- imageCapture.setCaptureDestination(QCameraImageCapture::CaptureToBuffer);
- QCOMPARE(imageCapture.captureDestination(), QCameraImageCapture::CaptureToBuffer);
- QCOMPARE(destinationChangedSignal.size(), 1);
- QCOMPARE(destinationChangedSignal.first().first().value<QCameraImageCapture::CaptureDestinations>(),
- QCameraImageCapture::CaptureToBuffer);
-
- //not supported combination
- imageCapture.setCaptureDestination(QCameraImageCapture::CaptureToBuffer | QCameraImageCapture::CaptureToFile);
- QCOMPARE(imageCapture.captureDestination(), QCameraImageCapture::CaptureToBuffer);
- QCOMPARE(destinationChangedSignal.size(), 1);
-}
-
-void tst_QCamera::testCaptureFormat()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
-
- QSignalSpy formatChangedSignal(&imageCapture, SIGNAL(bufferFormatChanged(QVideoFrame::PixelFormat)));
-
- QCOMPARE(imageCapture.bufferFormat(), QVideoFrame::Format_Jpeg);
- QCOMPARE(imageCapture.supportedBufferFormats().size(), 3);
-
- imageCapture.setBufferFormat(QVideoFrame::Format_AdobeDng);
- QCOMPARE(imageCapture.bufferFormat(), QVideoFrame::Format_AdobeDng);
-
- QCOMPARE(formatChangedSignal.size(), 1);
- QCOMPARE(formatChangedSignal.first().first().value<QVideoFrame::PixelFormat>(),
- QVideoFrame::Format_AdobeDng);
-
- imageCapture.setBufferFormat(QVideoFrame::Format_Y16);
- QCOMPARE(imageCapture.bufferFormat(), QVideoFrame::Format_AdobeDng);
-
- QCOMPARE(formatChangedSignal.size(), 1);
-}
-
-
-void tst_QCamera::testCameraCapture()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
-
- QVERIFY(!imageCapture.isReadyForCapture());
-
- QSignalSpy capturedSignal(&imageCapture, SIGNAL(imageCaptured(int,QImage)));
- QSignalSpy errorSignal(&imageCapture, SIGNAL(error(int, QCameraImageCapture::Error,QString)));
-
- imageCapture.capture(QString::fromLatin1("/dev/null"));
- QCOMPARE(capturedSignal.size(), 0);
- QCOMPARE(errorSignal.size(), 1);
- QCOMPARE(imageCapture.error(), QCameraImageCapture::NotReadyError);
-
- errorSignal.clear();
-
- camera.start();
- QVERIFY(imageCapture.isReadyForCapture());
- QCOMPARE(errorSignal.size(), 0);
-
- imageCapture.capture(QString::fromLatin1("/dev/null"));
-
- for (int i=0; i<100 && capturedSignal.isEmpty(); i++)
- QTest::qWait(10);
-
- QCOMPARE(capturedSignal.size(), 1);
- QCOMPARE(errorSignal.size(), 0);
- QCOMPARE(imageCapture.error(), QCameraImageCapture::NoError);
-}
-
-void tst_QCamera::testCameraCaptureMetadata()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
-
- QSignalSpy metadataSignal(&imageCapture, SIGNAL(imageMetadataAvailable(int,QtMultimedia::MetaData,QVariant)));
- QSignalSpy extendedMetadataSignal(&imageCapture, SIGNAL(imageMetadataAvailable(int,QString,QVariant)));
- QSignalSpy savedSignal(&imageCapture, SIGNAL(imageSaved(int,QString)));
-
- camera.start();
- int id = imageCapture.capture(QString::fromLatin1("/dev/null"));
-
- for (int i=0; i<100 && savedSignal.isEmpty(); i++)
- QTest::qWait(10);
-
- QCOMPARE(savedSignal.size(), 1);
-
- QCOMPARE(metadataSignal.size(), 2);
-
- QVariantList metadata = metadataSignal[0];
- QCOMPARE(metadata[0].toInt(), id);
- QCOMPARE(metadata[1].value<QtMultimedia::MetaData>(), QtMultimedia::FocalLengthIn35mmFilm);
- QCOMPARE(metadata[2].value<QVariant>().toInt(), 50);
-
- metadata = metadataSignal[1];
- QCOMPARE(metadata[0].toInt(), id);
- QCOMPARE(metadata[1].value<QtMultimedia::MetaData>(), QtMultimedia::DateTimeOriginal);
- QDateTime captureTime = metadata[2].value<QVariant>().value<QDateTime>();
- QVERIFY(qAbs(captureTime.secsTo(QDateTime::currentDateTime()) < 5)); //it should not takes more than 5 seconds for signal to arrive here
-
- QCOMPARE(extendedMetadataSignal.size(), 1);
- metadata = extendedMetadataSignal.first();
- QCOMPARE(metadata[0].toInt(), id);
- QCOMPARE(metadata[1].toString(), QLatin1String("Answer to the Ultimate Question of Life, the Universe, and Everything"));
- QCOMPARE(metadata[2].value<QVariant>().toInt(), 42);
-}
-
-
-void tst_QCamera::testCameraWhiteBalance()
-{
- QSet<QCameraImageProcessing::WhiteBalanceMode> whiteBalanceModes;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceAuto;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceFlash;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceTungsten;
-
- MockCameraService service;
- service.mockImageProcessingControl->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceFlash);
- service.mockImageProcessingControl->setSupportedWhiteBalanceModes(whiteBalanceModes);
- service.mockImageProcessingControl->setProcessingParameter(
- QCameraImageProcessingControl::ColorTemperature,
- QVariant(34));
-
- MockMediaServiceProvider provider;
- provider.service = &service;
-
- QCamera camera(0, &provider);
- QCameraImageProcessing *cameraImageProcessing = camera.imageProcessing();
-
- QCOMPARE(cameraImageProcessing->whiteBalanceMode(), QCameraImageProcessing::WhiteBalanceFlash);
- QVERIFY(camera.imageProcessing()->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceAuto));
- QVERIFY(camera.imageProcessing()->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceFlash));
- QVERIFY(camera.imageProcessing()->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceTungsten));
- QVERIFY(!camera.imageProcessing()->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceCloudy));
-
- cameraImageProcessing->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceTungsten);
- QCOMPARE(cameraImageProcessing->whiteBalanceMode(), QCameraImageProcessing::WhiteBalanceTungsten);
-
- cameraImageProcessing->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceManual);
- QCOMPARE(cameraImageProcessing->whiteBalanceMode(), QCameraImageProcessing::WhiteBalanceManual);
- QCOMPARE(cameraImageProcessing->manualWhiteBalance(), 34);
-
- cameraImageProcessing->setManualWhiteBalance(432);
- QCOMPARE(cameraImageProcessing->manualWhiteBalance(), 432);
-}
-
-void tst_QCamera::testCameraExposure()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- QCameraExposure *cameraExposure = camera.exposure();
- QVERIFY(cameraExposure != 0);
-
- QVERIFY(cameraExposure->isExposureModeSupported(QCameraExposure::ExposureAuto));
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureAuto);
-
- // Test Cases For QCameraExposure
- QVERIFY(cameraExposure->isExposureModeSupported(QCameraExposure::ExposureManual));
- cameraExposure->setExposureMode(QCameraExposure::ExposureManual);
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureManual);
-
- QVERIFY(cameraExposure->isExposureModeSupported(QCameraExposure::ExposureNight));
- cameraExposure->setExposureMode(QCameraExposure::ExposureNight);
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureNight);
-
- QVERIFY(cameraExposure->isExposureModeSupported(QCameraExposure::ExposureBacklight));
- cameraExposure->setExposureMode(QCameraExposure::ExposureBacklight);
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureBacklight);
-
-
- QVERIFY(cameraExposure->isExposureModeSupported(QCameraExposure::ExposureSpotlight ));
- cameraExposure->setExposureMode(QCameraExposure::ExposureSpotlight);
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureSpotlight);
-
- QVERIFY(cameraExposure->isExposureModeSupported(QCameraExposure::ExposureSports ));
- cameraExposure->setExposureMode(QCameraExposure::ExposureSports);
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureSports);
-
- QVERIFY(cameraExposure->isExposureModeSupported(QCameraExposure::ExposureSnow ));
- cameraExposure->setExposureMode(QCameraExposure::ExposureSnow);
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureSnow);
-
- QVERIFY(cameraExposure->isExposureModeSupported(QCameraExposure::ExposureBeach ));
- cameraExposure->setExposureMode(QCameraExposure::ExposureBeach);
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureBeach);
-
- QVERIFY(cameraExposure->isExposureModeSupported(QCameraExposure::ExposureLargeAperture ));
- cameraExposure->setExposureMode(QCameraExposure::ExposureLargeAperture);
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureLargeAperture);
-
- QVERIFY(cameraExposure->isExposureModeSupported(QCameraExposure::ExposureSmallAperture ));
- cameraExposure->setExposureMode(QCameraExposure::ExposureSmallAperture);
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureSmallAperture);
-
- QVERIFY(cameraExposure->isExposureModeSupported(QCameraExposure::ExposurePortrait ));
- cameraExposure->setExposureMode(QCameraExposure::ExposurePortrait);
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposurePortrait);
-
- QVERIFY(cameraExposure->isExposureModeSupported(QCameraExposure::ExposureModeVendor ));
- cameraExposure->setExposureMode(QCameraExposure::ExposureModeVendor);
- QCOMPARE(cameraExposure->exposureMode(), QCameraExposure::ExposureModeVendor);
-
-
- cameraExposure->setFlashMode(QCameraExposure::FlashAuto);
- QCOMPARE(cameraExposure->flashMode(), QCameraExposure::FlashAuto);
- QCOMPARE(cameraExposure->isFlashReady(), true);
- cameraExposure->setFlashMode(QCameraExposure::FlashRedEyeReduction);
- QCOMPARE(cameraExposure->flashMode(), QCameraExposure::FlashRedEyeReduction);
- cameraExposure->setFlashMode(QCameraExposure::FlashOn);
- QCOMPARE(cameraExposure->flashMode(), QCameraExposure::FlashOn);
- cameraExposure->setFlashMode(QCameraExposure::FlashFill);
- QCOMPARE(cameraExposure->flashMode(), QCameraExposure::FlashFill);
- cameraExposure->setFlashMode(QCameraExposure::FlashTorch);
- QCOMPARE(cameraExposure->flashMode(), QCameraExposure::FlashTorch);
- cameraExposure->setFlashMode(QCameraExposure::FlashSlowSyncFrontCurtain);
- QCOMPARE(cameraExposure->flashMode(), QCameraExposure::FlashSlowSyncFrontCurtain);
-
-
- cameraExposure->setMeteringMode(QCameraExposure::MeteringMatrix);
- QCOMPARE(cameraExposure->meteringMode(), QCameraExposure::MeteringMatrix);
- cameraExposure->setMeteringMode(QCameraExposure::MeteringAverage);
- QCOMPARE(cameraExposure->meteringMode(), QCameraExposure::MeteringAverage);
- cameraExposure->setMeteringMode(QCameraExposure::MeteringSpot);
- QCOMPARE(cameraExposure->meteringMode(), QCameraExposure::MeteringSpot);
-
- QCOMPARE(cameraExposure->exposureCompensation(), 0.0);
- cameraExposure->setExposureCompensation(2.0);
- QCOMPARE(cameraExposure->exposureCompensation(), 2.0);
-
- int minIso = cameraExposure->supportedIsoSensitivities().first();
- int maxIso = cameraExposure->supportedIsoSensitivities().last();
- QVERIFY(cameraExposure->isoSensitivity() > 0);
- QVERIFY(minIso > 0);
- QVERIFY(maxIso > 0);
- cameraExposure->setManualIsoSensitivity(minIso);
- QCOMPARE(cameraExposure->isoSensitivity(), minIso);
- cameraExposure->setManualIsoSensitivity(maxIso*10);
- QCOMPARE(cameraExposure->isoSensitivity(), maxIso);
- cameraExposure->setManualIsoSensitivity(-10);
- QCOMPARE(cameraExposure->isoSensitivity(), minIso);
- cameraExposure->setAutoIsoSensitivity();
- QCOMPARE(cameraExposure->isoSensitivity(), 100);
-
- qreal minAperture = cameraExposure->supportedApertures().first();
- qreal maxAperture = cameraExposure->supportedApertures().last();
- QVERIFY(minAperture > 0);
- QVERIFY(maxAperture > 0);
- QVERIFY(cameraExposure->aperture() >= minAperture);
- QVERIFY(cameraExposure->aperture() <= maxAperture);
-
- cameraExposure->setAutoAperture();
- QVERIFY(cameraExposure->aperture() >= minAperture);
- QVERIFY(cameraExposure->aperture() <= maxAperture);
-
- cameraExposure->setManualAperture(0);
- QCOMPARE(cameraExposure->aperture(), minAperture);
-
- cameraExposure->setManualAperture(10000);
- QCOMPARE(cameraExposure->aperture(), maxAperture);
-
-
- qreal minShutterSpeed = cameraExposure->supportedShutterSpeeds().first();
- qreal maxShutterSpeed = cameraExposure->supportedShutterSpeeds().last();
- QVERIFY(minShutterSpeed > 0);
- QVERIFY(maxShutterSpeed > 0);
- QVERIFY(cameraExposure->shutterSpeed() >= minShutterSpeed);
- QVERIFY(cameraExposure->shutterSpeed() <= maxShutterSpeed);
-
- cameraExposure->setAutoShutterSpeed();
- QVERIFY(cameraExposure->shutterSpeed() >= minShutterSpeed);
- QVERIFY(cameraExposure->shutterSpeed() <= maxShutterSpeed);
-
- cameraExposure->setManualShutterSpeed(0);
- QCOMPARE(cameraExposure->shutterSpeed(), minShutterSpeed);
-
- cameraExposure->setManualShutterSpeed(10000);
- QCOMPARE(cameraExposure->shutterSpeed(), maxShutterSpeed);
-}
-
-void tst_QCamera::testCameraFocus()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- QCameraFocus *cameraFocus = camera.focus();
- QVERIFY(cameraFocus != 0);
-
- QVERIFY(cameraFocus->isFocusModeSupported(QCameraFocus::AutoFocus));
- QVERIFY(cameraFocus->isFocusModeSupported(QCameraFocus::ContinuousFocus));
- QVERIFY(!cameraFocus->isFocusModeSupported(QCameraFocus::InfinityFocus));
-
- QCOMPARE(cameraFocus->focusMode(), QCameraFocus::AutoFocus);
- cameraFocus->setFocusMode(QCameraFocus::ManualFocus);
- QCOMPARE(cameraFocus->focusMode(), QCameraFocus::AutoFocus);
- cameraFocus->setFocusMode(QCameraFocus::ContinuousFocus);
- QCOMPARE(cameraFocus->focusMode(), QCameraFocus::ContinuousFocus);
-
- QVERIFY(cameraFocus->maximumOpticalZoom() >= 1.0);
- QVERIFY(cameraFocus->maximumDigitalZoom() >= 1.0);
- QCOMPARE(cameraFocus->opticalZoom(), 1.0);
- QCOMPARE(cameraFocus->digitalZoom(), 1.0);
- cameraFocus->zoomTo(0.5, 1.0);
- QCOMPARE(cameraFocus->opticalZoom(), 1.0);
- QCOMPARE(cameraFocus->digitalZoom(), 1.0);
- cameraFocus->zoomTo(2.0, 0.5);
- QCOMPARE(cameraFocus->opticalZoom(), 2.0);
- QCOMPARE(cameraFocus->digitalZoom(), 1.0);
- cameraFocus->zoomTo(2.0, 2.5);
- QCOMPARE(cameraFocus->opticalZoom(), 2.0);
- QCOMPARE(cameraFocus->digitalZoom(), 2.5);
- cameraFocus->zoomTo(2000000.0, 1000000.0);
- QVERIFY(qFuzzyCompare(cameraFocus->opticalZoom(), cameraFocus->maximumOpticalZoom()));
- QVERIFY(qFuzzyCompare(cameraFocus->digitalZoom(), cameraFocus->maximumDigitalZoom()));
-
- QVERIFY(cameraFocus->isFocusPointModeSupported(QCameraFocus::FocusPointAuto));
- QVERIFY(cameraFocus->isFocusPointModeSupported(QCameraFocus::FocusPointCenter));
- QVERIFY(cameraFocus->isFocusPointModeSupported(QCameraFocus::FocusPointCustom));
- QCOMPARE(cameraFocus->focusPointMode(), QCameraFocus::FocusPointAuto);
-
- cameraFocus->setFocusPointMode( QCameraFocus::FocusPointCenter );
- QCOMPARE(cameraFocus->focusPointMode(), QCameraFocus::FocusPointCenter);
-
- cameraFocus->setFocusPointMode( QCameraFocus::FocusPointFaceDetection );
- QCOMPARE(cameraFocus->focusPointMode(), QCameraFocus::FocusPointCenter);
-
- QCOMPARE(cameraFocus->customFocusPoint(), QPointF(0.5, 0.5));
- cameraFocus->setCustomFocusPoint(QPointF(1.0, 1.0));
- QCOMPARE(cameraFocus->customFocusPoint(), QPointF(1.0, 1.0));
-}
-
-void tst_QCamera::testImageSettings()
-{
- QImageEncoderSettings settings;
- QVERIFY(settings.isNull());
- QVERIFY(settings == QImageEncoderSettings());
-
- QCOMPARE(settings.codec(), QString());
- settings.setCodec(QLatin1String("codecName"));
- QCOMPARE(settings.codec(), QLatin1String("codecName"));
- QVERIFY(!settings.isNull());
- QVERIFY(settings != QImageEncoderSettings());
-
- settings = QImageEncoderSettings();
- QCOMPARE(settings.quality(), QtMultimedia::NormalQuality);
- settings.setQuality(QtMultimedia::HighQuality);
- QCOMPARE(settings.quality(), QtMultimedia::HighQuality);
- QVERIFY(!settings.isNull());
-
- settings = QImageEncoderSettings();
- QCOMPARE(settings.resolution(), QSize());
- settings.setResolution(QSize(320,240));
- QCOMPARE(settings.resolution(), QSize(320,240));
- settings.setResolution(800,600);
- QCOMPARE(settings.resolution(), QSize(800,600));
- QVERIFY(!settings.isNull());
-
- settings = QImageEncoderSettings();
- QVERIFY(settings.isNull());
- QCOMPARE(settings.codec(), QString());
- QCOMPARE(settings.quality(), QtMultimedia::NormalQuality);
- QCOMPARE(settings.resolution(), QSize());
-
- {
- QImageEncoderSettings settings1;
- QImageEncoderSettings settings2;
- QCOMPARE(settings2, settings1);
-
- settings2 = settings1;
- QCOMPARE(settings2, settings1);
- QVERIFY(settings2.isNull());
-
- settings1.setQuality(QtMultimedia::HighQuality);
-
- QVERIFY(settings2.isNull());
- QVERIFY(!settings1.isNull());
- QVERIFY(settings1 != settings2);
- }
-
- {
- QImageEncoderSettings settings1;
- QImageEncoderSettings settings2(settings1);
- QCOMPARE(settings2, settings1);
-
- settings2 = settings1;
- QCOMPARE(settings2, settings1);
- QVERIFY(settings2.isNull());
-
- settings1.setQuality(QtMultimedia::HighQuality);
-
- QVERIFY(settings2.isNull());
- QVERIFY(!settings1.isNull());
- QVERIFY(settings1 != settings2);
- }
-
- QImageEncoderSettings settings1;
- QImageEncoderSettings settings2;
-
- settings1 = QImageEncoderSettings();
- settings1.setResolution(800,600);
- settings2 = QImageEncoderSettings();
- settings2.setResolution(QSize(800,600));
- QVERIFY(settings1 == settings2);
- settings2.setResolution(QSize(400,300));
- QVERIFY(settings1 != settings2);
-
- settings1 = QImageEncoderSettings();
- settings1.setCodec("codec1");
- settings2 = QImageEncoderSettings();
- settings2.setCodec("codec1");
- QVERIFY(settings1 == settings2);
- settings2.setCodec("codec2");
- QVERIFY(settings1 != settings2);
-
- settings1 = QImageEncoderSettings();
- settings1.setQuality(QtMultimedia::NormalQuality);
- settings2 = QImageEncoderSettings();
- settings2.setQuality(QtMultimedia::NormalQuality);
- QVERIFY(settings1 == settings2);
- settings2.setQuality(QtMultimedia::LowQuality);
- QVERIFY(settings1 != settings2);
-}
-
-void tst_QCamera::testCameraLock()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- camera.focus()->setFocusMode(QCameraFocus::AutoFocus);
-
- QCOMPARE(camera.lockStatus(), QCamera::Unlocked);
-
- QSignalSpy lockedSignal(&camera, SIGNAL(locked()));
- QSignalSpy lockFailedSignal(&camera, SIGNAL(lockFailed()));
- QSignalSpy lockStatusChangedSignal(&camera, SIGNAL(lockStatusChanged(QCamera::LockStatus,QCamera::LockChangeReason)));
-
- camera.searchAndLock();
- QCOMPARE(camera.lockStatus(), QCamera::Searching);
- QCOMPARE(lockedSignal.count(), 0);
- QCOMPARE(lockFailedSignal.count(), 0);
- QCOMPARE(lockStatusChangedSignal.count(), 1);
-
- lockedSignal.clear();
- lockFailedSignal.clear();
- lockStatusChangedSignal.clear();
-
- for (int i=0; i<200 && camera.lockStatus() == QCamera::Searching; i++)
- QTest::qWait(10);
-
- QCOMPARE(camera.lockStatus(), QCamera::Locked);
- QCOMPARE(lockedSignal.count(), 1);
- QCOMPARE(lockFailedSignal.count(), 0);
- QCOMPARE(lockStatusChangedSignal.count(), 1);
-
- lockedSignal.clear();
- lockFailedSignal.clear();
- lockStatusChangedSignal.clear();
-
- camera.searchAndLock();
- QCOMPARE(camera.lockStatus(), QCamera::Searching);
- QCOMPARE(lockedSignal.count(), 0);
- QCOMPARE(lockFailedSignal.count(), 0);
- QCOMPARE(lockStatusChangedSignal.count(), 1);
-
- lockedSignal.clear();
- lockFailedSignal.clear();
- lockStatusChangedSignal.clear();
-
- camera.unlock();
- QCOMPARE(camera.lockStatus(), QCamera::Unlocked);
- QCOMPARE(lockedSignal.count(), 0);
- QCOMPARE(lockFailedSignal.count(), 0);
- QCOMPARE(lockStatusChangedSignal.count(), 1);
-}
-
-void tst_QCamera::testCameraLockCancel()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- camera.focus()->setFocusMode(QCameraFocus::AutoFocus);
-
- QCOMPARE(camera.lockStatus(), QCamera::Unlocked);
-
- QSignalSpy lockedSignal(&camera, SIGNAL(locked()));
- QSignalSpy lockFailedSignal(&camera, SIGNAL(lockFailed()));
- QSignalSpy lockStatusChangedSignal(&camera, SIGNAL(lockStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)));
- camera.searchAndLock();
- QCOMPARE(camera.lockStatus(), QCamera::Searching);
- QCOMPARE(lockedSignal.count(), 0);
- QCOMPARE(lockFailedSignal.count(), 0);
- QCOMPARE(lockStatusChangedSignal.count(), 1);
-
- lockedSignal.clear();
- lockFailedSignal.clear();
- lockStatusChangedSignal.clear();
-
- camera.unlock();
- QCOMPARE(camera.lockStatus(), QCamera::Unlocked);
- QCOMPARE(lockedSignal.count(), 0);
- QCOMPARE(lockFailedSignal.count(), 0);
- QCOMPARE(lockStatusChangedSignal.count(), 1);
-}
-
-void tst_QCamera::testCameraEncodingProperyChange()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
-
- QSignalSpy stateChangedSignal(&camera, SIGNAL(stateChanged(QCamera::State)));
- QSignalSpy statusChangedSignal(&camera, SIGNAL(statusChanged(QCamera::Status)));
-
- camera.start();
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::ActiveStatus);
-
- QCOMPARE(stateChangedSignal.count(), 1);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
-
- camera.setCaptureMode(QCamera::CaptureVideo);
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::LoadedStatus);
-
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- QTest::qWait(10);
-
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::ActiveStatus);
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- //backens should not be stopped since the capture mode is Video
- imageCapture.setEncodingSettings(QImageEncoderSettings());
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 0);
-
- camera.setCaptureMode(QCamera::CaptureStillImage);
- QTest::qWait(10);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- //the settings change should trigger camera stop/start
- imageCapture.setEncodingSettings(QImageEncoderSettings());
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::LoadedStatus);
-
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- QTest::qWait(10);
-
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::ActiveStatus);
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- //the settings change should trigger camera stop/start only once
- camera.setCaptureMode(QCamera::CaptureVideo);
- camera.setCaptureMode(QCamera::CaptureStillImage);
- imageCapture.setEncodingSettings(QImageEncoderSettings());
- imageCapture.setEncodingSettings(QImageEncoderSettings());
-
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::LoadedStatus);
-
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- QTest::qWait(10);
-
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::ActiveStatus);
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
-}
-
-void tst_QCamera::testSetVideoOutput()
-{
- MockVideoSurface surface;
-
- MockCameraService service;
- MockMediaServiceProvider provider;
- provider.service = &service;
- QCamera camera(0, &provider);
-
- camera.setViewfinder(reinterpret_cast<QVideoWidget *>(0));
-
- camera.setViewfinder(reinterpret_cast<QGraphicsVideoItem *>(0));
-
- camera.setViewfinder(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
-
- camera.setViewfinder(reinterpret_cast<QAbstractVideoSurface *>(0));
- QVERIFY(service.rendererControl->surface() == 0);
-
- camera.setViewfinder(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
-
- camera.setViewfinder(reinterpret_cast<QVideoWidget *>(0));
- QVERIFY(service.rendererControl->surface() == 0);
-
- camera.setViewfinder(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
-}
-
-
-void tst_QCamera::testSetVideoOutputNoService()
-{
- MockVideoSurface surface;
-
- MockMediaServiceProvider provider;
- provider.service = 0;
- QCamera camera(0, &provider);
-
- camera.setViewfinder(&surface);
- // Nothing we can verify here other than it doesn't assert.
-}
-
-void tst_QCamera::testSetVideoOutputNoControl()
-{
- MockVideoSurface surface;
-
- MockCameraService service;
- service.rendererRef = 1;
-
- MockMediaServiceProvider provider;
- provider.service = &service;
- QCamera camera(0, &provider);
-
- camera.setViewfinder(&surface);
- QVERIFY(service.rendererControl->surface() == 0);
-}
-
-void tst_QCamera::testSetVideoOutputDestruction()
-{
- MockVideoSurface surface;
-
- MockCameraService service;
- MockMediaServiceProvider provider;
- provider.service = &service;
-
- {
- QCamera camera(0, &provider);
- camera.setViewfinder(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
- QCOMPARE(service.rendererRef, 1);
- }
- QVERIFY(service.rendererControl->surface() == 0);
- QCOMPARE(service.rendererRef, 0);
-}
-
-void tst_QCamera::testEnumDebug()
-{
- QTest::ignoreMessage(QtDebugMsg, "QCamera::ActiveState ");
- qDebug() << QCamera::ActiveState;
- QTest::ignoreMessage(QtDebugMsg, "QCamera::ActiveStatus ");
- qDebug() << QCamera::ActiveStatus;
- QTest::ignoreMessage(QtDebugMsg, "QCamera::CaptureVideo ");
- qDebug() << QCamera::CaptureVideo;
- QTest::ignoreMessage(QtDebugMsg, "QCamera::CameraError ");
- qDebug() << QCamera::CameraError;
- QTest::ignoreMessage(QtDebugMsg, "QCamera::Unlocked ");
- qDebug() << QCamera::Unlocked;
- QTest::ignoreMessage(QtDebugMsg, "QCamera::LockAcquired ");
- qDebug() << QCamera::LockAcquired;
- QTest::ignoreMessage(QtDebugMsg, "QCamera::NoLock ");
- qDebug() << QCamera::NoLock;
- QTest::ignoreMessage(QtDebugMsg, "QCamera::LockExposure ");
- qDebug() << QCamera::LockExposure;
-}
-
-void tst_QCamera::testCameraControl()
-{
- MockCameraControl *m_cameraControl=new MockCameraControl(this);
- QVERIFY(m_cameraControl != NULL);
-}
-
-/* Test case for constructor with default provider */
-void tst_QCamera::testConstructorWithDefaultProvider()
-{
- QCamera *camera = new QCamera(0);
- QVERIFY(camera != NULL);
- QCOMPARE(camera->state(), QCamera::UnloadedState);
- delete camera;
-}
-
-/* captureModeChanged Signal test case. */
-void tst_QCamera::testCaptureModeChanged_signal()
-{
- MockCameraControl *m_cameraControl= new MockCameraControl(this);
- QSignalSpy spy(m_cameraControl, SIGNAL(captureModeChanged(QCamera::CaptureMode)));
- QVERIFY(spy.size() == 0);
-
- m_cameraControl->setCaptureMode(QCamera::CaptureVideo);
- QVERIFY(spy.size() == 1);
-
- m_cameraControl->setCaptureMode(QCamera::CaptureStillImage);
- QVERIFY(spy.size() == 2);
-}
-
-/* Test case for captureMode */
-void tst_QCamera::testCaptureMode()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QVERIFY(camera.captureMode() == QCamera::CaptureStillImage);
-
- camera.setCaptureMode(QCamera::CaptureVideo);
- QVERIFY(camera.captureMode() == QCamera::CaptureVideo);
-}
-
-/* Test case for isCaptureModeSupported */
-void tst_QCamera::testIsCaptureModeSupported()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QVERIFY(camera.isCaptureModeSupported(QCamera::CaptureStillImage) == true);
- QVERIFY(camera.isCaptureModeSupported(QCamera::CaptureVideo) == true);
-}
-
-/* Test case for requestedLocks. LockType is stored in OR combination so all
- types of combinations are verified here.*/
-void tst_QCamera::testRequestedLocks()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- QCOMPARE(camera.requestedLocks(),QCamera::NoLock);
-
- camera.searchAndLock(QCamera::LockExposure);
- QCOMPARE(camera.requestedLocks(),QCamera::LockExposure);
-
- camera.unlock();
- camera.searchAndLock(QCamera::LockFocus);
- QCOMPARE(camera.requestedLocks(),QCamera::LockFocus );
-
- camera.unlock();
- camera.searchAndLock(QCamera::LockWhiteBalance);
- QCOMPARE(camera.requestedLocks(),QCamera::LockWhiteBalance);
-
- camera.unlock();
- camera.searchAndLock(QCamera::LockExposure |QCamera::LockFocus );
- QCOMPARE(camera.requestedLocks(),QCamera::LockExposure |QCamera::LockFocus );
- camera.searchAndLock(QCamera::LockWhiteBalance);
- QCOMPARE(camera.requestedLocks(),QCamera::LockExposure |QCamera::LockFocus|QCamera::LockWhiteBalance );
- camera.unlock(QCamera::LockExposure);
- QCOMPARE(camera.requestedLocks(),QCamera::LockFocus|QCamera::LockWhiteBalance );
- camera.unlock(QCamera::LockFocus);
- camera.searchAndLock(QCamera::LockExposure |QCamera::LockWhiteBalance );
- QCOMPARE(camera.requestedLocks(),QCamera::LockExposure|QCamera::LockWhiteBalance );
-}
-
-/* Test case for supportedLocks() */
-void tst_QCamera::testSupportedLocks()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- QCOMPARE(camera.supportedLocks(),QCamera::LockExposure | QCamera::LockFocus);
-}
-
-/* Test case for isAvailable */
-void tst_QCamera::testQCameraIsAvailable()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QVERIFY(camera.isAvailable());
-
- QCamera *camera1 = new QCamera("random");
-
- QVERIFY(camera1->error() == QCamera::ServiceMissingError);
- QVERIFY(!camera1->isAvailable());
- delete camera1;
-}
-
-/* Test case for availabilityError */
-void tst_QCamera::testAvailabilityError()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QVERIFY(camera.availabilityError() == QtMultimedia::NoError);
-
- QCamera *camera1 = new QCamera("random");
- QVERIFY(camera1->availabilityError() == QtMultimedia::ServiceMissingError);
- delete camera1;
-}
-
-/* Test case for searchAndLock ( QCamera::LockTypes locks ) */
-void tst_QCamera::testSearchAndLockWithLockTypes()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- QCOMPARE(camera.lockStatus(), QCamera::Unlocked);
-
- /* Spy the signals */
- QSignalSpy lockedSignal(&camera, SIGNAL(locked()));
- QSignalSpy lockFailedSignal(&camera, SIGNAL(lockFailed()));
- QSignalSpy lockStatusChangedSignal(&camera, SIGNAL(lockStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)));
- QSignalSpy lockStatusChangedSignalWithType(&camera, SIGNAL(lockStatusChanged(QCamera::LockType,QCamera::LockStatus, QCamera::LockChangeReason)));
-
- /* search and lock the camera with QCamera::LockExposure and verify if the signal is emitted correctly */
- camera.searchAndLock(QCamera::LockExposure);
- QCOMPARE(camera.lockStatus(), QCamera::Locked);
- QCOMPARE(lockedSignal.count(), 1);
- QCOMPARE(lockFailedSignal.count(), 0);
- QCOMPARE(lockStatusChangedSignal.count(), 1);
- QCOMPARE(lockStatusChangedSignalWithType.count(), 1);
-}
-
-/* Test case for setCaptureMode() */
-void tst_QCamera::testSetCaptureMode()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- /* Set the capture mode and verify if it set correctly */
- camera.setCaptureMode(QCamera::CaptureVideo);
- QVERIFY(camera.captureMode() == QCamera::CaptureVideo);
-
- camera.setCaptureMode(QCamera::CaptureStillImage);
- QVERIFY(camera.captureMode() == QCamera::CaptureStillImage);
-}
-
-/* Test case for unlock (QCamera::LockTypes) */
-void tst_QCamera::testUnlockWithType()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- QCOMPARE(camera.lockStatus(), QCamera::Unlocked);
-
- /* Spy the signal */
- QSignalSpy lockedSignal(&camera, SIGNAL(locked()));
- QSignalSpy lockFailedSignal(&camera, SIGNAL(lockFailed()));
- QSignalSpy lockStatusChangedSignal(&camera, SIGNAL(lockStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)));
- QSignalSpy lockStatusChangedSignalWithType(&camera, SIGNAL(lockStatusChanged(QCamera::LockType,QCamera::LockStatus, QCamera::LockChangeReason)));
-
- /* lock the camera with QCamera::LockExposure and Verify if the signal is emitted correctly */
- camera.searchAndLock(QCamera::LockExposure);
- QCOMPARE(camera.lockStatus(), QCamera::Locked);
- QCOMPARE(lockedSignal.count(), 1);
- QCOMPARE(lockFailedSignal.count(), 0);
- QCOMPARE(lockStatusChangedSignal.count(), 1);
- QCOMPARE(lockStatusChangedSignalWithType.count(), 1);
-
- /* Clear the signal */
- lockedSignal.clear();
- lockFailedSignal.clear();
- lockStatusChangedSignal.clear();
- lockStatusChangedSignalWithType.clear();
-
- /* Unlock the camera and verify if the signal is emitted correctly */
- camera.unlock(QCamera::LockExposure);
- QCOMPARE(camera.lockStatus(), QCamera::Unlocked);
- QCOMPARE(lockedSignal.count(), 0);
- QCOMPARE(lockFailedSignal.count(), 0);
- QCOMPARE(lockStatusChangedSignal.count(), 1);
- QCOMPARE(lockStatusChangedSignalWithType.count(), 1);
- QCamera::LockType lockType = qvariant_cast<QCamera::LockType >(lockStatusChangedSignalWithType.at(0).at(0));
- QCamera::LockStatus lockStatus = qvariant_cast<QCamera::LockStatus >(lockStatusChangedSignalWithType.at(0).at(1));
- QVERIFY(lockType == QCamera::LockExposure);
- QVERIFY(lockStatus == QCamera::Unlocked);
-
- lockedSignal.clear();
- lockFailedSignal.clear();
- lockStatusChangedSignal.clear();
- lockStatusChangedSignalWithType.clear();
-
- /* Lock the camera with QCamera::LockFocus */
- camera.searchAndLock(QCamera::LockFocus);
- lockedSignal.clear();
- lockFailedSignal.clear();
- lockStatusChangedSignal.clear();
- lockStatusChangedSignalWithType.clear();
-
- /* Unlock the camera and Verify if the signal is emitted correctly */
- camera.unlock(QCamera::LockFocus);
- QCOMPARE(camera.lockStatus(), QCamera::Unlocked);
- QCOMPARE(lockedSignal.count(), 0);
- QCOMPARE(lockFailedSignal.count(), 0);
- QCOMPARE(lockStatusChangedSignal.count(), 1);
- QCOMPARE(lockStatusChangedSignalWithType.count(), 1);
- lockType = qvariant_cast<QCamera::LockType >(lockStatusChangedSignalWithType.at(0).at(0));
- lockStatus = qvariant_cast<QCamera::LockStatus >(lockStatusChangedSignalWithType.at(0).at(1));
- QVERIFY(lockType == QCamera::LockFocus);
- QVERIFY(lockStatus == QCamera::Unlocked);
-}
-
-/* Test case for signal captureModeChanged(QCamera::CaptureMode) */
-void tst_QCamera::testCaptureModeChangedSignal()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QVERIFY(camera.captureMode() == QCamera::CaptureStillImage);
-
- qRegisterMetaType<QCamera::CaptureMode>("QCamera::CaptureMode");
-
- /* Spy the signal */
- QSignalSpy lockCaptureModeChangedSignal(&camera, SIGNAL(captureModeChanged(QCamera::CaptureMode)));
-
- /* set the capture mode and Verify if the signal is emitted */
- camera.setCaptureMode(QCamera::CaptureVideo);
- QVERIFY(camera.captureMode() == QCamera::CaptureVideo);
- QCOMPARE(lockCaptureModeChangedSignal.count(), 1);
- QCamera::CaptureMode lockCaptureMode = qvariant_cast<QCamera::CaptureMode >(lockCaptureModeChangedSignal.at(0).at(0));
- QVERIFY(lockCaptureMode == QCamera::CaptureVideo);
-}
-
-/* Test case for signal lockStatusChanged(QCamera::LockType,QCamera::LockStatus, QCamera::LockChangeReason) */
-void tst_QCamera::testLockStatusChangedWithTypesSignal()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- QCOMPARE(camera.lockStatus(), QCamera::Unlocked);
-
- /* Spy the signal lockStatusChanged(QCamera::LockType,QCamera::LockStatus, QCamera::LockChangeReason) */
- QSignalSpy lockStatusChangedSignalWithType(&camera, SIGNAL(lockStatusChanged(QCamera::LockType,QCamera::LockStatus, QCamera::LockChangeReason)));
-
- /* Lock the camera with type QCamera::LockExposure */
- camera.searchAndLock(QCamera::LockExposure);
-
- /* Verify if the signal is emitted and lock status is set correclty */
- QCOMPARE(camera.lockStatus(), QCamera::Locked);
- QCOMPARE(lockStatusChangedSignalWithType.count(), 1);
- QCamera::LockType lockType = qvariant_cast<QCamera::LockType >(lockStatusChangedSignalWithType.at(0).at(0));
- QCamera::LockStatus lockStatus = qvariant_cast<QCamera::LockStatus >(lockStatusChangedSignalWithType.at(0).at(1));
- QVERIFY(lockType == QCamera::LockExposure);
- QVERIFY(lockStatus == QCamera::Locked);
-
- lockStatusChangedSignalWithType.clear();
-
- /* Unlock the camera */
- camera.unlock();
-
- /* Verify if the signal is emitted and lock status is set correclty */
- QCOMPARE(camera.lockStatus(), QCamera::Unlocked);
- QCOMPARE(lockStatusChangedSignalWithType.count(), 1);
- lockType = qvariant_cast<QCamera::LockType >(lockStatusChangedSignalWithType.at(0).at(0));
- lockStatus = qvariant_cast<QCamera::LockStatus >(lockStatusChangedSignalWithType.at(0).at(1));
- QVERIFY(lockType == QCamera::LockExposure);
- QVERIFY(lockStatus == QCamera::Unlocked);
-}
-
-/* Test case for verifying if error signal generated correctly */
-void tst_QCamera::testErrorSignal()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- QSignalSpy spyError(&camera, SIGNAL(error(QCamera::Error)));
-
- /* Set the QCameraControl error and verify if the signal is emitted correctly in QCamera */
- service.mockControl->setError(QCamera::CameraError,QString("Camera Error"));
-
- QVERIFY(spyError.count() == 1);
- QCamera::Error err = qvariant_cast<QCamera::Error >(spyError.at(0).at(0));
- QVERIFY(err == QCamera::CameraError);
-
- spyError.clear();
-
- /* Set the QCameraControl error and verify if the signal is emitted correctly in QCamera */
- service.mockControl->setError(QCamera::InvalidRequestError,QString("InvalidRequestError Error"));
- QVERIFY(spyError.count() == 1);
- err = qvariant_cast<QCamera::Error >(spyError.at(0).at(0));
- QVERIFY(err == QCamera::InvalidRequestError);
-
- spyError.clear();
-
- /* Set the QCameraControl error and verify if the signal is emitted correctly in QCamera */
- service.mockControl->setError(QCamera::NotSupportedFeatureError,QString("NotSupportedFeatureError Error"));
- QVERIFY(spyError.count() == 1);
- err = qvariant_cast<QCamera::Error >(spyError.at(0).at(0));
- QVERIFY(err == QCamera::NotSupportedFeatureError);
-
-}
-
-/* Test case for verifying the QCamera error */
-void tst_QCamera::testError()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- /* Set the QCameraControl error and verify if it is set correctly in QCamera */
- service.mockControl->setError(QCamera::CameraError,QString("Camera Error"));
- QVERIFY(camera.error() == QCamera::CameraError);
-
- /* Set the QCameraControl error and verify if it is set correctly in QCamera */
- service.mockControl->setError(QCamera::InvalidRequestError,QString("InvalidRequestError Error"));
- QVERIFY(camera.error() == QCamera::InvalidRequestError);
-
- /* Set the QCameraControl error and verify if it is set correctly in QCamera */
- service.mockControl->setError(QCamera::NotSupportedFeatureError,QString("NotSupportedFeatureError Error"));
- QVERIFY(camera.error() == QCamera::NotSupportedFeatureError);
-
-}
-
-/* Test the error strings for QCamera class */
-void tst_QCamera::testErrorString()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- /* Set the QCameraControl error and verify if it is set correctly in QCamera */
- service.mockControl->setError(QCamera::CameraError,QString("Camera Error"));
- QVERIFY(camera.errorString() == QString("Camera Error"));
-
- /* Set the QCameraControl error and verify if it is set correctly in QCamera */
- service.mockControl->setError(QCamera::InvalidRequestError,QString("InvalidRequestError Error"));
- QVERIFY(camera.errorString() == QString("InvalidRequestError Error"));
-
- /* Set the QCameraControl error and verify if it is set correctly in QCamera */
- service.mockControl->setError(QCamera::NotSupportedFeatureError,QString("NotSupportedFeatureError Error"));
- QVERIFY(camera.errorString() == QString("NotSupportedFeatureError Error"));
-}
-
-/* Test case for verifying Status of QCamera. */
-void tst_QCamera::testStatus()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- /* Set the QCameraControl status and verify if it is set correctly in QCamera */
- service.mockControl->setStatus(QCamera::StartingStatus);
- QVERIFY(camera.status() == QCamera::StartingStatus);
-
- /* Set the QCameraControl status and verify if it is set correctly in QCamera */
- service.mockControl->setStatus(QCamera::StandbyStatus);
- QVERIFY(camera.status() == QCamera::StandbyStatus);
-
- /* Set the QCameraControl status and verify if it is set correctly in QCamera */
- service.mockControl->setStatus(QCamera::LoadingStatus);
- QVERIFY(camera.status() == QCamera::LoadingStatus);
-
- /* Set the QCameraControl status and verify if it is set correctly in QCamera */
- service.mockControl->setStatus(QCamera::UnavailableStatus);
- QVERIFY(camera.status() == QCamera::UnavailableStatus);
-}
-
-/* Test case for verifying default locktype QCamera::NoLock */
-void tst_QCamera::testLockType()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- QCOMPARE(camera.requestedLocks(),QCamera::NoLock);
-}
-
-/* Test case for QCamera::LockChangeReason with QCamera::LockAcquired */
-void tst_QCamera::testLockChangeReason()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
-
- QSignalSpy lockStatusChangedSignalWithType(&camera, SIGNAL(lockStatusChanged(QCamera::LockType,QCamera::LockStatus, QCamera::LockChangeReason)));
-
- /* Set the lockChangeReason */
- service.mockLocksControl->setLockChangeReason(QCamera::LockAcquired);
-
- /* Verify if lockChangeReson is eqaul toQCamera::LockAcquired */
- QCOMPARE(lockStatusChangedSignalWithType.count(), 1);
- QCamera::LockChangeReason LockChangeReason = qvariant_cast<QCamera::LockChangeReason >(lockStatusChangedSignalWithType.at(0).at(2));
- QVERIFY(LockChangeReason == QCamera::LockAcquired);
-
-}
-/* All the enums test case for QCameraControl class*/
-void tst_QCamera::testEnumsOfQCameraControl()
-{
- MockCameraControl *m_cameraControl = new MockCameraControl(this);
- bool result;
-
- // In still mode, can't change much
- QVERIFY(m_cameraControl->captureMode() == QCamera::CaptureStillImage);
- result = m_cameraControl->canChangeProperty(MockCameraControl::CaptureMode, QCamera::ActiveStatus);
- QVERIFY(!result);
- result = m_cameraControl->canChangeProperty(MockCameraControl::ImageEncodingSettings, QCamera::ActiveStatus);
- QVERIFY(!result);
- result = m_cameraControl->canChangeProperty(MockCameraControl::VideoEncodingSettings, QCamera::ActiveStatus);
- QVERIFY(result);
- result = m_cameraControl->canChangeProperty(MockCameraControl::Viewfinder, QCamera::ActiveStatus);
- QVERIFY(!result);
-
- // In video mode can change image encoding settings
- m_cameraControl->setCaptureMode(QCamera::CaptureVideo);
- result = m_cameraControl->canChangeProperty(MockCameraControl::ImageEncodingSettings, QCamera::ActiveStatus);
- QVERIFY(result);
- result = m_cameraControl->canChangeProperty(MockCameraControl::VideoEncodingSettings, QCamera::ActiveStatus);
- QVERIFY(result);
- result = m_cameraControl->canChangeProperty(MockCameraControl::Viewfinder, QCamera::ActiveStatus);
- QVERIFY(!result);
-
- // Flip the allow everything bit
- m_cameraControl->m_propertyChangesSupported = true;
- result = m_cameraControl->canChangeProperty(MockCameraControl::CaptureMode, QCamera::ActiveStatus);
- QVERIFY(result);
- result = m_cameraControl->canChangeProperty(MockCameraControl::ImageEncodingSettings, QCamera::ActiveStatus);
- QVERIFY(result);
- result = m_cameraControl->canChangeProperty(MockCameraControl::VideoEncodingSettings, QCamera::ActiveStatus);
- QVERIFY(result);
- result = m_cameraControl->canChangeProperty(MockCameraControl::Viewfinder, QCamera::ActiveStatus);
- QVERIFY(result);
-}
-
-// Test case for QCameraImageProcessing class
-void tst_QCamera::testContrast()
-{
- MockCameraService service;
- MockMediaServiceProvider provider;
- provider.service = &service;
-
- QCamera camera(0, &provider);
- QCameraImageProcessing *cameraImageProcessing = camera.imageProcessing();
- QVERIFY(cameraImageProcessing->contrast() ==0);
-
- cameraImageProcessing->setContrast(123);
- QVERIFY(cameraImageProcessing->contrast() ==123);
-
- cameraImageProcessing->setContrast(4.56);
- QVERIFY(cameraImageProcessing->contrast() ==4);
-}
-
-void tst_QCamera::testDenoisingLevel()
-{
- MockCameraService service;
- MockMediaServiceProvider provider;
- provider.service = &service;
-
- QCamera camera(0, &provider);
- QCameraImageProcessing *cameraImageProcessing = camera.imageProcessing();
-
- if (cameraImageProcessing->isDenoisingSupported())
- {
- QVERIFY(cameraImageProcessing->denoisingLevel() == -1);
-
- cameraImageProcessing->setDenoisingLevel(0);
- QVERIFY(cameraImageProcessing->denoisingLevel() == 0);
-
- cameraImageProcessing->setDenoisingLevel(12);
- QVERIFY(cameraImageProcessing->denoisingLevel() == 12);
- }
- else
- QVERIFY(cameraImageProcessing->denoisingLevel() == -1);
-}
-
-void tst_QCamera::testIsAvailable()
-{
- MockCameraService service;
- MockMediaServiceProvider provider;
- provider.service = &service;
-
- QCamera camera(0, &provider);
- QCameraImageProcessing *cameraImageProcessing = camera.imageProcessing();
- QVERIFY(cameraImageProcessing->isAvailable() == true);
-}
-
-void tst_QCamera::testSaturation()
-{
- MockCameraService service;
- MockMediaServiceProvider provider;
- provider.service = &service;
-
- QCamera camera(0, &provider);
- QCameraImageProcessing *cameraImageProcessing = camera.imageProcessing();
- QVERIFY(cameraImageProcessing->saturation() == 0);
-
- cameraImageProcessing->setSaturation(50);
- QVERIFY(cameraImageProcessing->saturation() == 50);
-
- cameraImageProcessing->setSaturation(-50);
- QVERIFY(cameraImageProcessing->saturation() == -50);
-
- cameraImageProcessing->setSaturation(100);
- QVERIFY(cameraImageProcessing->saturation() == 100);
-
- cameraImageProcessing->setSaturation(-100);
- QVERIFY(cameraImageProcessing->saturation() == -100);
-}
-
-void tst_QCamera::testSharpeningLevel()
-{
- MockCameraService service;
- MockMediaServiceProvider provider;
- provider.service = &service;
-
- QCamera camera(0, &provider);
- QCameraImageProcessing *cameraImageProcessing = camera.imageProcessing();
- QVERIFY(cameraImageProcessing->isSharpeningSupported());
- QVERIFY(cameraImageProcessing->sharpeningLevel() == -1);
-
- cameraImageProcessing->setSharpeningLevel(123);
- QVERIFY(cameraImageProcessing->sharpeningLevel() == 123);
-
- cameraImageProcessing->setSharpeningLevel(4.67);
- QVERIFY(cameraImageProcessing->sharpeningLevel() == 4);
-}
-
-void tst_QCamera::testEnumOfQCameraImageProcessing()
-{
- QSet<QCameraImageProcessing::WhiteBalanceMode> whiteBalanceModes;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceManual;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceAuto;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceSunlight;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceCloudy;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceShade;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceTungsten;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceFluorescent;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceFlash;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceSunset;
- whiteBalanceModes << QCameraImageProcessing::WhiteBalanceVendor;
-
- MockCameraService service;
- service.mockImageProcessingControl->setSupportedWhiteBalanceModes(whiteBalanceModes);
-
- service.mockImageProcessingControl->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceManual);
- QVERIFY(service.mockImageProcessingControl->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceManual));
- QVERIFY(service.mockImageProcessingControl->whiteBalanceMode() == QCameraImageProcessing::WhiteBalanceManual);
-
- service.mockImageProcessingControl->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceAuto);
- QVERIFY(service.mockImageProcessingControl->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceAuto));
- QVERIFY(service.mockImageProcessingControl->whiteBalanceMode() == QCameraImageProcessing::WhiteBalanceAuto);
-
- service.mockImageProcessingControl->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceSunlight);
- QVERIFY(service.mockImageProcessingControl->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceSunlight));
- QVERIFY(service.mockImageProcessingControl->whiteBalanceMode() == QCameraImageProcessing::WhiteBalanceSunlight);
-
- service.mockImageProcessingControl->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceCloudy);
- QVERIFY(service.mockImageProcessingControl->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceCloudy));
- QVERIFY(service.mockImageProcessingControl->whiteBalanceMode() == QCameraImageProcessing::WhiteBalanceCloudy);
-
- service.mockImageProcessingControl->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceShade);
- QVERIFY(service.mockImageProcessingControl->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceShade));
- QVERIFY(service.mockImageProcessingControl->whiteBalanceMode() == QCameraImageProcessing::WhiteBalanceShade);
-
- service.mockImageProcessingControl->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceTungsten);
- QVERIFY(service.mockImageProcessingControl->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceTungsten));
- QVERIFY(service.mockImageProcessingControl->whiteBalanceMode() == QCameraImageProcessing::WhiteBalanceTungsten);
-
- service.mockImageProcessingControl->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceFluorescent);
- QVERIFY(service.mockImageProcessingControl->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceFluorescent));
- QVERIFY(service.mockImageProcessingControl->whiteBalanceMode() == QCameraImageProcessing::WhiteBalanceFluorescent);
-
- service.mockImageProcessingControl->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceFlash);
- QVERIFY(service.mockImageProcessingControl->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceFlash));
- QVERIFY(service.mockImageProcessingControl->whiteBalanceMode() == QCameraImageProcessing::WhiteBalanceFlash);
-
- service.mockImageProcessingControl->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceSunset);
- QVERIFY(service.mockImageProcessingControl->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceSunset));
- QVERIFY(service.mockImageProcessingControl->whiteBalanceMode() == QCameraImageProcessing::WhiteBalanceSunset);
-
- service.mockImageProcessingControl->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceVendor);
- QVERIFY(service.mockImageProcessingControl->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceVendor));
- QVERIFY(service.mockImageProcessingControl->whiteBalanceMode() == QCameraImageProcessing::WhiteBalanceVendor);
-}
-
-//Added test cases for QCameraFocus
-void tst_QCamera::testCameraFocusIsAvailable()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QCameraFocus *cameraFocus = camera.focus();
- QVERIFY(cameraFocus != 0);
- QVERIFY(cameraFocus->isAvailable());
-}
-
-//Added this code to cover QCameraFocus::HyperfocalFocus and QCameraFocus::MacroFocus
-//As the HyperfocalFocus and MacroFocus are not supported we can not set the focus mode to these Focus Modes
-void tst_QCamera::testFocusModes()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QCameraFocus *cameraFocus = camera.focus();
- QVERIFY(cameraFocus != 0);
- QVERIFY(!cameraFocus->isFocusModeSupported(QCameraFocus::HyperfocalFocus));
- QVERIFY(!cameraFocus->isFocusModeSupported(QCameraFocus::MacroFocus));
- QCOMPARE(cameraFocus->focusMode(), QCameraFocus::AutoFocus);
- cameraFocus->setFocusMode(QCameraFocus::HyperfocalFocus);
- QVERIFY(cameraFocus->focusMode()!= QCameraFocus::HyperfocalFocus);
- QCOMPARE(cameraFocus->focusMode(), QCameraFocus::AutoFocus);
- cameraFocus->setFocusMode(QCameraFocus::MacroFocus);
- QVERIFY(cameraFocus->focusMode()!= QCameraFocus::MacroFocus);
- QCOMPARE(cameraFocus->focusMode(), QCameraFocus::AutoFocus);
-}
-
-void tst_QCamera::testOpticalAndDigitalZoomChanged()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QCameraFocus *cameraFocus = camera.focus();
- QVERIFY(cameraFocus != 0);
- QSignalSpy spy1(cameraFocus,SIGNAL(digitalZoomChanged(qreal)));
- QSignalSpy spy2(cameraFocus,SIGNAL(opticalZoomChanged(qreal)));
- QVERIFY(spy1.count() == 0);
- QVERIFY(spy2.count() == 0);
- cameraFocus->zoomTo(2.0,3.0);
- QVERIFY(spy1.count() == 1);
- QVERIFY(spy2.count() == 1);
-}
-
-void tst_QCamera::testMaxDigitalZoomChangedSignal()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QCameraFocus *cameraFocus = camera.focus();
- QVERIFY(cameraFocus != 0);
- QSignalSpy spy(cameraFocus,SIGNAL(maximumDigitalZoomChanged(qreal)));
- QVERIFY(spy.count() == 0);
- cameraFocus->zoomTo(5.0,6.0);
- QVERIFY(spy.count() == 1);
-}
-
-void tst_QCamera::testMaxOpticalZoomChangedSignal()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QCameraFocus *cameraFocus = camera.focus();
- QVERIFY(cameraFocus != 0);
- QSignalSpy spy(cameraFocus,SIGNAL(maximumOpticalZoomChanged(qreal)));
- QVERIFY(spy.count() == 0);
- cameraFocus->zoomTo(5.0,6.0);
- QVERIFY(spy.count() == 1);
-}
-
-void tst_QCamera::testfocusZonesChangedSignal()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QCameraFocus *cameraFocus = camera.focus();
- QVERIFY(cameraFocus != 0);
-
- QSignalSpy spy(cameraFocus,SIGNAL(focusZonesChanged()));
- cameraFocus->zoomTo(5.0,6.0);
- QVERIFY(spy.count() == 1);
-}
-
-// test constructor for abstract class of ImageProcessingControl
-void tst_QCamera :: testImageProcessingControl()
-{
- QObject parent;
- MockImageProcessingControl processCtrl(&parent);
-}
-
-void tst_QCamera::testSignalApertureChanged()
-{
- MockMediaServiceProvider provider1;
- MockCameraService service;
- provider1.service = &service;
- QCamera camera(0, &provider1);
-
- QCameraExposure *cameraExposure = camera.exposure(); //create camera expose instance
- QVERIFY(cameraExposure != 0);
-
- QSignalSpy spyApertureChanged(cameraExposure , SIGNAL(apertureChanged(qreal)));
- QSignalSpy spyApertureRangeChanged(cameraExposure , SIGNAL(apertureRangeChanged()));
-
-
- QVERIFY(spyApertureChanged.count() ==0);
- cameraExposure->setManualAperture(10.0);//set the ManualAperture to 10.0
-
- QTest::qWait(100);
- QVERIFY(spyApertureChanged.count() ==1);
- QVERIFY(spyApertureRangeChanged.count() ==1);
-}
-
-void tst_QCamera::testSignalExposureCompensationChanged()
-{
- MockMediaServiceProvider provider1;
- MockCameraService service;
- provider1.service = &service;
- QCamera camera(0, &provider1);
-
- QCameraExposure *cameraExposure = camera.exposure(); //create camera expose instance
- QVERIFY(cameraExposure != 0);
-
- QSignalSpy spyExposureCompensationChanged(cameraExposure , SIGNAL(exposureCompensationChanged(qreal)));
-
- QVERIFY(spyExposureCompensationChanged.count() ==0);
-
- QVERIFY(cameraExposure->exposureCompensation() != 800);
- cameraExposure->setExposureCompensation(2.0);
-
- QTest::qWait(100);
-
- QVERIFY(cameraExposure->exposureCompensation() == 2.0);
-
- QCOMPARE(spyExposureCompensationChanged.count(),1);
-
- // Setting the same should not result in a signal
- cameraExposure->setExposureCompensation(2.0);
- QTest::qWait(100);
-
- QVERIFY(cameraExposure->exposureCompensation() == 2.0);
- QCOMPARE(spyExposureCompensationChanged.count(),1);
-}
-
-void tst_QCamera::testSignalIsoSensitivityChanged()
-{
-
- MockMediaServiceProvider provider1;
- MockCameraService service;
- provider1.service = &service;
- QCamera camera(0, &provider1);
-
- QCameraExposure *cameraExposure = camera.exposure(); //create camera expose instance
- QVERIFY(cameraExposure != 0);
-
- QSignalSpy spyisoSensitivityChanged(cameraExposure , SIGNAL(isoSensitivityChanged(int)));
-
- QVERIFY(spyisoSensitivityChanged.count() ==0);
-
- cameraExposure->setManualIsoSensitivity(800); //set the manualiso sentivity to 800
- QTest::qWait(100);
- QVERIFY(spyisoSensitivityChanged.count() ==1);
-
-}
-void tst_QCamera::testSignalShutterSpeedChanged()
-{
-
- MockMediaServiceProvider provider1;
- MockCameraService service;
- provider1.service = &service;
- QCamera camera(0, &provider1);
-
- QCameraExposure *cameraExposure = camera.exposure(); //create camera expose instance
- QVERIFY(cameraExposure != 0);
-
- QSignalSpy spySignalShutterSpeedChanged(cameraExposure , SIGNAL(shutterSpeedChanged(qreal)));
- QSignalSpy spySignalShutterSpeedRangeChanged(cameraExposure , SIGNAL(shutterSpeedRangeChanged()));
-
- QVERIFY(spySignalShutterSpeedChanged.count() ==0);
-
- cameraExposure->setManualShutterSpeed(2.0);//set the ManualShutterSpeed to 2.0
- QTest::qWait(100);
-
- QVERIFY(spySignalShutterSpeedChanged.count() ==1);
- QVERIFY(spySignalShutterSpeedRangeChanged.count() ==1);
-}
-
-void tst_QCamera::testSignalFlashReady()
-{
- MockMediaServiceProvider provider1;
- MockCameraService service;
- provider1.service = &service;
- QCamera camera(0, &provider1);
-
- QCameraExposure *cameraExposure = camera.exposure(); //create camera expose instance
- QVERIFY(cameraExposure != 0);
-
-
- QSignalSpy spyflashReady(cameraExposure,SIGNAL(flashReady(bool)));
-
- QVERIFY(spyflashReady.count() ==0);
-
- QVERIFY(cameraExposure->flashMode() ==QCameraExposure::FlashAuto);
-
- cameraExposure->setFlashMode(QCameraExposure::FlashOff);//set theFlashMode to QCameraExposure::FlashOff
-
- QVERIFY(cameraExposure->flashMode() ==QCameraExposure::FlashOff);
-
- QVERIFY(spyflashReady.count() ==1);
-}
-
-// test constructor
-void tst_QCamera::testExposureControlConstructor()
-{
- // To check changes in abstract classes's pure virtual functions
- MockCameraExposureControl obj;
-}
-
-QTEST_MAIN(tst_QCamera)
-
-#include "tst_qcamera.moc"
diff --git a/tests/auto/qcamerabackend/qcamerabackend.pro b/tests/auto/qcamerabackend/qcamerabackend.pro
deleted file mode 100644
index 147885f..0000000
--- a/tests/auto/qcamerabackend/qcamerabackend.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qcamerabackend
-
-QT += multimedia-private multimediawidgets-private testlib
-CONFIG += no_private_qt_headers_warning
-
-# This is more of a system test
-# CONFIG += testcase
-
-SOURCES += tst_qcamerabackend.cpp
diff --git a/tests/auto/qcamerabackend/tst_qcamerabackend.cpp b/tests/auto/qcamerabackend/tst_qcamerabackend.cpp
deleted file mode 100644
index eabf703..0000000
--- a/tests/auto/qcamerabackend/tst_qcamerabackend.cpp
+++ /dev/null
@@ -1,624 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-#include <QtTest/QtTest>
-#include <QtGui/QImageReader>
-#include <QDebug>
-
-#include <qabstractvideosurface.h>
-#include <qcameracontrol.h>
-#include <qcameralockscontrol.h>
-#include <qcameraexposurecontrol.h>
-#include <qcameraflashcontrol.h>
-#include <qcamerafocuscontrol.h>
-#include <qcameraimagecapturecontrol.h>
-#include <qimageencodercontrol.h>
-#include <qcameraimageprocessingcontrol.h>
-#include <qcameracapturebufferformatcontrol.h>
-#include <qcameracapturedestinationcontrol.h>
-#include <qmediaservice.h>
-#include <qcamera.h>
-#include <qcameraimagecapture.h>
-#include <qgraphicsvideoitem.h>
-#include <qvideorenderercontrol.h>
-#include <qvideowidget.h>
-#include <qvideowindowcontrol.h>
-
-QT_USE_NAMESPACE
-
-// Eventually these will make it into qtestcase.h
-// but we might need to tweak the timeout values here.
-#ifndef QTRY_COMPARE
-#define QTRY_COMPARE(__expr, __expected) \
- do { \
- const int __step = 50; \
- const int __timeout = 10000; \
- if ((__expr) != (__expected)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QCOMPARE(__expr, __expected); \
- } while(0)
-#endif
-
-#ifndef QTRY_VERIFY
-#define QTRY_VERIFY(__expr) \
- do { \
- const int __step = 50; \
- const int __timeout = 10000; \
- if (!(__expr)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QVERIFY(__expr); \
- } while(0)
-#endif
-
-
-#define QTRY_WAIT(code, __expr) \
- do { \
- const int __step = 50; \
- const int __timeout = 10000; \
- if (!(__expr)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
- do { code } while(0); \
- QTest::qWait(__step); \
- } \
- } while(0)
-
-
-/*
- This is the backend conformance test.
-
- Since it relies on platform media framework and sound hardware
- it may be less stable.
-*/
-
-
-Q_DECLARE_METATYPE(QVideoFrame)
-
-class tst_QCameraBackend: public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- void testAvailableDevices();
- void testDeviceDescription();
- void testCtorWithDevice();
-
- void testCameraStates();
- void testCaptureMode();
- void testCameraCapture();
- void testCaptureToBuffer();
- void testCameraCaptureMetadata();
- void testExposureCompensation();
- void testExposureMode();
-private:
-};
-
-void tst_QCameraBackend::initTestCase()
-{
- qRegisterMetaType<QtMultimedia::MetaData>("QtMultimedia::MetaData");
-
- QCamera camera;
- if (!camera.isAvailable())
- QSKIP("Camera is not available", SkipAll);
-}
-
-void tst_QCameraBackend::cleanupTestCase()
-{
-}
-
-void tst_QCameraBackend::testAvailableDevices()
-{
- int deviceCount = QMediaServiceProvider::defaultServiceProvider()->devices(QByteArray(Q_MEDIASERVICE_CAMERA)).count();
- QCOMPARE(QCamera::availableDevices().count(), deviceCount);
-}
-
-void tst_QCameraBackend::testDeviceDescription()
-{
- int deviceCount = QMediaServiceProvider::defaultServiceProvider()->devices(QByteArray(Q_MEDIASERVICE_CAMERA)).count();
-
- if (deviceCount == 0)
- QVERIFY(QCamera::deviceDescription(QByteArray("random")).isNull());
- else {
- foreach (const QByteArray &device, QCamera::availableDevices())
- QVERIFY(QCamera::deviceDescription(device).length() > 0);
- }
-}
-
-void tst_QCameraBackend::testCtorWithDevice()
-{
- int deviceCount = QMediaServiceProvider::defaultServiceProvider()->devices(QByteArray(Q_MEDIASERVICE_CAMERA)).count();
- QCamera *camera = 0;
-
- if (deviceCount == 0) {
- camera = new QCamera("random");
- QCOMPARE(camera->error(), QCamera::ServiceMissingError);
- }
- else {
- camera = new QCamera(QCamera::availableDevices().first());
- QCOMPARE(camera->error(), QCamera::NoError);
- }
-
- delete camera;
-}
-
-void tst_QCameraBackend::testCameraStates()
-{
- QCamera camera;
- QCameraImageCapture imageCapture(&camera);
-
- QSignalSpy errorSignal(&camera, SIGNAL(error(QCamera::Error)));
- QSignalSpy stateChangedSignal(&camera, SIGNAL(stateChanged(QCamera::State)));
- QSignalSpy statusChangedSignal(&camera, SIGNAL(statusChanged(QCamera::Status)));
-
- QCOMPARE(camera.state(), QCamera::UnloadedState);
- QCOMPARE(camera.status(), QCamera::UnloadedStatus);
-
- camera.load();
- QCOMPARE(camera.state(), QCamera::LoadedState);
- QCOMPARE(stateChangedSignal.count(), 1);
- QCOMPARE(stateChangedSignal.last().first().value<QCamera::State>(), QCamera::LoadedState);
- QVERIFY(stateChangedSignal.count() > 0);
-
- QTRY_COMPARE(camera.status(), QCamera::LoadedStatus);
- QCOMPARE(statusChangedSignal.last().first().value<QCamera::Status>(), QCamera::LoadedStatus);
-
- camera.unload();
- QCOMPARE(camera.state(), QCamera::UnloadedState);
- QCOMPARE(stateChangedSignal.last().first().value<QCamera::State>(), QCamera::UnloadedState);
- QTRY_COMPARE(camera.status(), QCamera::UnloadedStatus);
- QCOMPARE(statusChangedSignal.last().first().value<QCamera::Status>(), QCamera::UnloadedStatus);
-
-#ifdef Q_WS_MAEMO_6
- //resource policy doesn't work correctly when resource is released and immediately requested again.
- QTest::qWait(250);
-#endif
-
- camera.start();
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(stateChangedSignal.last().first().value<QCamera::State>(), QCamera::ActiveState);
- QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
- QCOMPARE(statusChangedSignal.last().first().value<QCamera::Status>(), QCamera::ActiveStatus);
-
- camera.stop();
- QCOMPARE(camera.state(), QCamera::LoadedState);
- QCOMPARE(stateChangedSignal.last().first().value<QCamera::State>(), QCamera::LoadedState);
- QTRY_COMPARE(camera.status(), QCamera::LoadedStatus);
- QCOMPARE(statusChangedSignal.last().first().value<QCamera::Status>(), QCamera::LoadedStatus);
-
- camera.unload();
- QCOMPARE(camera.state(), QCamera::UnloadedState);
- QCOMPARE(stateChangedSignal.last().first().value<QCamera::State>(), QCamera::UnloadedState);
- QTRY_COMPARE(camera.status(), QCamera::UnloadedStatus);
- QCOMPARE(statusChangedSignal.last().first().value<QCamera::Status>(), QCamera::UnloadedStatus);
-
- QCOMPARE(camera.errorString(), QString());
- QCOMPARE(errorSignal.count(), 0);
-}
-
-void tst_QCameraBackend::testCaptureMode()
-{
- QCamera camera;
-
- QSignalSpy errorSignal(&camera, SIGNAL(error(QCamera::Error)));
- QSignalSpy stateChangedSignal(&camera, SIGNAL(stateChanged(QCamera::State)));
- QSignalSpy captureModeSignal(&camera, SIGNAL(captureModeChanged(QCamera::CaptureMode)));
-
- QCOMPARE(camera.captureMode(), QCamera::CaptureStillImage);
-
- if (!camera.isCaptureModeSupported(QCamera::CaptureVideo)) {
- camera.setCaptureMode(QCamera::CaptureVideo);
- QCOMPARE(camera.captureMode(), QCamera::CaptureStillImage);
- QSKIP("Video capture not supported", SkipAll);
- }
-
- camera.setCaptureMode(QCamera::CaptureVideo);
- QCOMPARE(camera.captureMode(), QCamera::CaptureVideo);
- QTRY_COMPARE(captureModeSignal.size(), 1);
- QCOMPARE(captureModeSignal.last().first().value<QCamera::CaptureMode>(), QCamera::CaptureVideo);
- captureModeSignal.clear();
-
- camera.load();
- QTRY_COMPARE(camera.status(), QCamera::LoadedStatus);
- //capture mode should still be video
- QCOMPARE(camera.captureMode(), QCamera::CaptureVideo);
-
- //it should be possible to switch capture mode in Loaded state
- camera.setCaptureMode(QCamera::CaptureStillImage);
- QTRY_COMPARE(captureModeSignal.size(), 1);
- QCOMPARE(captureModeSignal.last().first().value<QCamera::CaptureMode>(), QCamera::CaptureStillImage);
- captureModeSignal.clear();
-
- camera.setCaptureMode(QCamera::CaptureVideo);
- QTRY_COMPARE(captureModeSignal.size(), 1);
- QCOMPARE(captureModeSignal.last().first().value<QCamera::CaptureMode>(), QCamera::CaptureVideo);
- captureModeSignal.clear();
-
- camera.start();
- QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
- //capture mode should still be video
- QCOMPARE(camera.captureMode(), QCamera::CaptureVideo);
-
- stateChangedSignal.clear();
- //it should be possible to switch capture mode in Active state
- camera.setCaptureMode(QCamera::CaptureStillImage);
- //camera may leave Active status, but should return to Active
- QTest::qWait(10); //camera may leave Active status async
- QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
- QCOMPARE(camera.captureMode(), QCamera::CaptureStillImage);
- QVERIFY2(stateChangedSignal.isEmpty(), "camera should not change the state during capture mode changes");
-
- QCOMPARE(captureModeSignal.size(), 1);
- QCOMPARE(captureModeSignal.last().first().value<QCamera::CaptureMode>(), QCamera::CaptureStillImage);
- captureModeSignal.clear();
-
- camera.setCaptureMode(QCamera::CaptureVideo);
- //camera may leave Active status, but should return to Active
- QTest::qWait(10); //camera may leave Active status async
- QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
- QCOMPARE(camera.captureMode(), QCamera::CaptureVideo);
-
- QVERIFY2(stateChangedSignal.isEmpty(), "camera should not change the state during capture mode changes");
-
- QCOMPARE(captureModeSignal.size(), 1);
- QCOMPARE(captureModeSignal.last().first().value<QCamera::CaptureMode>(), QCamera::CaptureVideo);
- captureModeSignal.clear();
-
- camera.stop();
- QCOMPARE(camera.captureMode(), QCamera::CaptureVideo);
- camera.unload();
- QCOMPARE(camera.captureMode(), QCamera::CaptureVideo);
-
- QVERIFY2(errorSignal.isEmpty(), QString("Camera error: %1").arg(camera.errorString()).toLocal8Bit());
-}
-
-void tst_QCameraBackend::testCameraCapture()
-{
- QCamera camera;
- QCameraImageCapture imageCapture(&camera);
- //prevents camera to flash during the test
- camera.exposure()->setFlashMode(QCameraExposure::FlashOff);
-
- QVERIFY(!imageCapture.isReadyForCapture());
-
- QSignalSpy capturedSignal(&imageCapture, SIGNAL(imageCaptured(int,QImage)));
- QSignalSpy savedSignal(&imageCapture, SIGNAL(imageSaved(int,QString)));
- QSignalSpy errorSignal(&imageCapture, SIGNAL(error(int, QCameraImageCapture::Error,QString)));
-
- imageCapture.capture();
- QTRY_COMPARE(errorSignal.size(), 1);
- QCOMPARE(imageCapture.error(), QCameraImageCapture::NotReadyError);
- QCOMPARE(capturedSignal.size(), 0);
- errorSignal.clear();
-
- camera.start();
-
- QTRY_VERIFY(imageCapture.isReadyForCapture());
- QCOMPARE(camera.status(), QCamera::ActiveStatus);
- QCOMPARE(errorSignal.size(), 0);
-
- int id = imageCapture.capture();
-
- QTRY_VERIFY(!savedSignal.isEmpty());
-
- QCOMPARE(capturedSignal.size(), 1);
- QCOMPARE(capturedSignal.last().first().toInt(), id);
- QCOMPARE(errorSignal.size(), 0);
- QCOMPARE(imageCapture.error(), QCameraImageCapture::NoError);
-
- QCOMPARE(savedSignal.last().first().toInt(), id);
- QString location = savedSignal.last().last().toString();
- QVERIFY(!location.isEmpty());
- QVERIFY(QFileInfo(location).exists());
- QImageReader reader(location);
- reader.setScaledSize(QSize(320,240));
- QVERIFY(!reader.read().isNull());
-
- QFile(location).remove();
-}
-
-
-void tst_QCameraBackend::testCaptureToBuffer()
-{
- QCamera camera;
- QCameraImageCapture imageCapture(&camera);
- camera.exposure()->setFlashMode(QCameraExposure::FlashOff);
-
- camera.load();
-
-#ifdef Q_WS_MAEMO_6
- QVERIFY(imageCapture.isCaptureDestinationSupported(QCameraImageCapture::CaptureToBuffer));
-#endif
-
- if (!imageCapture.isCaptureDestinationSupported(QCameraImageCapture::CaptureToBuffer))
- QSKIP("Buffer capture not supported", SkipAll);
-
- QTRY_COMPARE(camera.status(), QCamera::LoadedStatus);
-
- QCOMPARE(imageCapture.bufferFormat(), QVideoFrame::Format_Jpeg);
-
- QVERIFY(imageCapture.isCaptureDestinationSupported(QCameraImageCapture::CaptureToFile));
- QVERIFY(imageCapture.isCaptureDestinationSupported(QCameraImageCapture::CaptureToBuffer));
- QVERIFY(imageCapture.isCaptureDestinationSupported(
- QCameraImageCapture::CaptureToBuffer | QCameraImageCapture::CaptureToFile));
-
- QSignalSpy destinationChangedSignal(&imageCapture, SIGNAL(captureDestinationChanged(QCameraImageCapture::CaptureDestinations)));
-
- QCOMPARE(imageCapture.captureDestination(), QCameraImageCapture::CaptureToFile);
- imageCapture.setCaptureDestination(QCameraImageCapture::CaptureToBuffer);
- QCOMPARE(imageCapture.captureDestination(), QCameraImageCapture::CaptureToBuffer);
- QCOMPARE(destinationChangedSignal.size(), 1);
- QCOMPARE(destinationChangedSignal.first().first().value<QCameraImageCapture::CaptureDestinations>(),
- QCameraImageCapture::CaptureToBuffer);
-
- QSignalSpy capturedSignal(&imageCapture, SIGNAL(imageCaptured(int,QImage)));
- QSignalSpy imageAvailableSignal(&imageCapture, SIGNAL(imageAvailable(int,QVideoFrame)));
- QSignalSpy savedSignal(&imageCapture, SIGNAL(imageSaved(int,QString)));
- QSignalSpy errorSignal(&imageCapture, SIGNAL(error(int, QCameraImageCapture::Error,QString)));
-
- camera.start();
- QTRY_VERIFY(imageCapture.isReadyForCapture());
-
- int id = imageCapture.capture();
- QTRY_VERIFY(!imageAvailableSignal.isEmpty());
-
- QVERIFY(errorSignal.isEmpty());
- QVERIFY(!capturedSignal.isEmpty());
- QVERIFY(!imageAvailableSignal.isEmpty());
-
- QTest::qWait(2000);
- QVERIFY(savedSignal.isEmpty());
-
- QCOMPARE(capturedSignal.first().first().toInt(), id);
- QCOMPARE(imageAvailableSignal.first().first().toInt(), id);
-
- QVideoFrame frame = imageAvailableSignal.first().last().value<QVideoFrame>();
- QVERIFY(frame.isValid());
- QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_Jpeg);
- QVERIFY(!frame.size().isEmpty());
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadOnly));
- QByteArray data((const char *)frame.bits(), frame.mappedBytes());
- frame.unmap();
- frame = QVideoFrame();
-
- QVERIFY(!data.isEmpty());
- QBuffer buffer;
- buffer.setData(data);
- buffer.open(QIODevice::ReadOnly);
- QImageReader reader(&buffer, "JPG");
- reader.setScaledSize(QSize(640,480));
- QImage img(reader.read());
- QVERIFY(!img.isNull());
-
- capturedSignal.clear();
- imageAvailableSignal.clear();
- savedSignal.clear();
-
- //Capture to yuv buffer
-#ifdef Q_WS_MAEMO_6
- QVERIFY(imageCapture.supportedBufferFormats().contains(QVideoFrame::Format_UYVY));
-#endif
-
- if (imageCapture.supportedBufferFormats().contains(QVideoFrame::Format_UYVY)) {
- imageCapture.setBufferFormat(QVideoFrame::Format_UYVY);
- QCOMPARE(imageCapture.bufferFormat(), QVideoFrame::Format_UYVY);
-
- id = imageCapture.capture();
- QTRY_VERIFY(!imageAvailableSignal.isEmpty());
-
- QVERIFY(errorSignal.isEmpty());
- QVERIFY(!capturedSignal.isEmpty());
- QVERIFY(!imageAvailableSignal.isEmpty());
- QVERIFY(savedSignal.isEmpty());
-
- QTest::qWait(2000);
- QVERIFY(savedSignal.isEmpty());
-
- frame = imageAvailableSignal.first().last().value<QVideoFrame>();
- QVERIFY(frame.isValid());
-
- qDebug() << frame.pixelFormat();
- QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_UYVY);
- QVERIFY(!frame.size().isEmpty());
- frame = QVideoFrame();
-
- capturedSignal.clear();
- imageAvailableSignal.clear();
- savedSignal.clear();
-
- imageCapture.setBufferFormat(QVideoFrame::Format_Jpeg);
- QCOMPARE(imageCapture.bufferFormat(), QVideoFrame::Format_Jpeg);
- }
-
- //Try to capture to both buffer and file
-#ifdef Q_WS_MAEMO_6
- QVERIFY(imageCapture.isCaptureDestinationSupported(QCameraImageCapture::CaptureToBuffer | QCameraImageCapture::CaptureToFile));
-#endif
- if (imageCapture.isCaptureDestinationSupported(QCameraImageCapture::CaptureToBuffer | QCameraImageCapture::CaptureToFile)) {
- imageCapture.setCaptureDestination(QCameraImageCapture::CaptureToBuffer | QCameraImageCapture::CaptureToFile);
-
- int oldId = id;
- id = imageCapture.capture();
- QVERIFY(id != oldId);
- QTRY_VERIFY(!savedSignal.isEmpty());
-
- QVERIFY(errorSignal.isEmpty());
- QVERIFY(!capturedSignal.isEmpty());
- QVERIFY(!imageAvailableSignal.isEmpty());
- QVERIFY(!savedSignal.isEmpty());
-
- QCOMPARE(capturedSignal.first().first().toInt(), id);
- QCOMPARE(imageAvailableSignal.first().first().toInt(), id);
-
- frame = imageAvailableSignal.first().last().value<QVideoFrame>();
- QVERIFY(frame.isValid());
- QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_Jpeg);
- QVERIFY(!frame.size().isEmpty());
-
- QString fileName = savedSignal.first().last().toString();
- QVERIFY(QFileInfo(fileName).exists());
- }
-}
-
-void tst_QCameraBackend::testCameraCaptureMetadata()
-{
-#ifndef Q_WS_MAEMO_6
- QSKIP("Capture metadata is supported only on harmattan", SkipAll);
-#endif
-
- QCamera camera;
- QCameraImageCapture imageCapture(&camera);
- camera.exposure()->setFlashMode(QCameraExposure::FlashOff);
-
- QSignalSpy metadataSignal(&imageCapture, SIGNAL(imageMetadataAvailable(int,QtMultimedia::MetaData,QVariant)));
- QSignalSpy savedSignal(&imageCapture, SIGNAL(imageSaved(int,QString)));
-
- camera.start();
-
- QTRY_VERIFY(imageCapture.isReadyForCapture());
-
- int id = imageCapture.capture(QString::fromLatin1("/dev/null"));
- QTRY_VERIFY(!savedSignal.isEmpty());
- QVERIFY(!metadataSignal.isEmpty());
- QCOMPARE(metadataSignal.first().first().toInt(), id);
-}
-
-void tst_QCameraBackend::testExposureCompensation()
-{
-#if !defined(Q_WS_MAEMO_6)
- QSKIP("Capture exposure parameters are supported only on mobile platforms", SkipAll);
-#endif
-
- QCamera camera;
- QCameraExposure *exposure = camera.exposure();
-
- QSignalSpy exposureCompensationSignal(exposure, SIGNAL(exposureCompensationChanged(qreal)));
-
- //it should be possible to set exposure parameters in Unloaded state
- QCOMPARE(exposure->exposureCompensation()+1.0, 1.0);
- exposure->setExposureCompensation(1.0);
- QCOMPARE(exposure->exposureCompensation(), 1.0);
- QTRY_COMPARE(exposureCompensationSignal.count(), 1);
- QCOMPARE(exposureCompensationSignal.last().first().toReal(), 1.0);
-
- //exposureCompensationChanged should not be emitted when value is not changed
- exposure->setExposureCompensation(1.0);
- QTest::qWait(50);
- QCOMPARE(exposureCompensationSignal.count(), 1);
-
- //exposure compensation should be preserved during load/start
- camera.load();
- QTRY_COMPARE(camera.status(), QCamera::LoadedStatus);
-
- QCOMPARE(exposure->exposureCompensation(), 1.0);
-
- exposureCompensationSignal.clear();
- exposure->setExposureCompensation(-1.0);
- QCOMPARE(exposure->exposureCompensation(), -1.0);
- QTRY_COMPARE(exposureCompensationSignal.count(), 1);
- QCOMPARE(exposureCompensationSignal.last().first().toReal(), -1.0);
-
- camera.start();
- QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
-
- QCOMPARE(exposure->exposureCompensation(), -1.0);
-
- exposureCompensationSignal.clear();
- exposure->setExposureCompensation(1.0);
- QCOMPARE(exposure->exposureCompensation(), 1.0);
- QTRY_COMPARE(exposureCompensationSignal.count(), 1);
- QCOMPARE(exposureCompensationSignal.last().first().toReal(), 1.0);
-}
-
-void tst_QCameraBackend::testExposureMode()
-{
-#if !defined(Q_WS_MAEMO_6)
- QSKIP("Capture exposure parameters are supported only on mobile platforms", SkipAll);
-#endif
-
- QCamera camera;
- QCameraExposure *exposure = camera.exposure();
-
-#ifdef Q_WS_MAEMO_6
- QEXPECT_FAIL("", "Camerabin reports Manual exposure instead of Auto", Continue);
-#endif
- QCOMPARE(exposure->exposureMode(), QCameraExposure::ExposureAuto);
-
- // Night
- exposure->setExposureMode(QCameraExposure::ExposureNight);
- QCOMPARE(exposure->exposureMode(), QCameraExposure::ExposureNight);
- camera.start();
- QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
- QCOMPARE(exposure->exposureMode(), QCameraExposure::ExposureNight);
-
- camera.unload();
- QTRY_COMPARE(camera.status(), QCamera::UnloadedStatus);
-
-#ifdef Q_WS_MAEMO_6
- //resource policy doesn't work correctly when resource is released and immediately requested again.
- QTest::qWait(250);
-#endif
-
- // Auto
- exposure->setExposureMode(QCameraExposure::ExposureAuto);
- QCOMPARE(exposure->exposureMode(), QCameraExposure::ExposureAuto);
- camera.start();
- QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
- QCOMPARE(exposure->exposureMode(), QCameraExposure::ExposureAuto);
-}
-
-QTEST_MAIN(tst_QCameraBackend)
-
-#include "tst_qcamerabackend.moc"
diff --git a/tests/auto/qcameraimagecapture/qcameraimagecapture.pro b/tests/auto/qcameraimagecapture/qcameraimagecapture.pro
deleted file mode 100644
index fdd2cf5..0000000
--- a/tests/auto/qcameraimagecapture/qcameraimagecapture.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qcameraimagecapture
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += \
- tst_qcameraimagecapture.cpp
-
-include (../qmultimedia_common/mock.pri)
-include (../qmultimedia_common/mockcamera.pri)
diff --git a/tests/auto/qcameraimagecapture/tst_qcameraimagecapture.cpp b/tests/auto/qcameraimagecapture/tst_qcameraimagecapture.cpp
deleted file mode 100644
index e842cbb..0000000
--- a/tests/auto/qcameraimagecapture/tst_qcameraimagecapture.cpp
+++ /dev/null
@@ -1,432 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/****************************************************************************
-Author : Vijay/Avinash
-
-Reviewer Name Date Coverage ( Full / Test Case IDs ).
----------------------------------------------------------------------------
- Initial review of test cases.
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-#include <QtTest/QtTest>
-#include <QDebug>
-
-#include <qcameracontrol.h>
-#include <qcameralockscontrol.h>
-#include <qcameraexposurecontrol.h>
-#include <qcameraflashcontrol.h>
-#include <qcamerafocuscontrol.h>
-#include <qcameraimagecapturecontrol.h>
-#include <qimageencodercontrol.h>
-#include <qcameraimageprocessingcontrol.h>
-#include <qmediaservice.h>
-#include <qcamera.h>
-#include <qcameraimagecapture.h>
-
-#include "mockcameraservice.h"
-#include "mockmediaserviceprovider.h"
-
-QT_USE_NAMESPACE
-
-class NullService: public QMediaService
-{
- Q_OBJECT
-
-public:
- NullService(): QMediaService(0)
- {
-
- }
-
- ~NullService()
- {
-
- }
-
- QMediaControl* requestControl(const char *iid)
- {
- Q_UNUSED(iid);
- return 0;
- }
-
- void releaseControl(QMediaControl*) {}
-
-};
-
-class tst_QCameraImageCapture: public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- void constructor();
- void mediaObject();
- void deleteMediaObject();
- void isReadyForCapture();
- void capture();
- void cancelCapture();
- void encodingSettings();
- void errors();
- void error();
- void imageCaptured();
- void imageExposed();
- void imageSaved();
- void readyForCaptureChanged();
- void supportedResolutions();
- void imageCodecDescription();
- void supportedImageCodecs();
- void cameraImageCaptureControl();
-
-private:
- MockCameraService *mockcameraservice;
- MockMediaServiceProvider *provider;
-};
-
-void tst_QCameraImageCapture::initTestCase()
-{
- provider = new MockMediaServiceProvider;
- mockcameraservice = new MockCameraService;
- provider->service = mockcameraservice;
-}
-
-void tst_QCameraImageCapture::cleanupTestCase()
-{
- delete mockcameraservice;
- delete provider;
-}
-
-//MaemoAPI-1823:test QCameraImageCapture Constructor
-void tst_QCameraImageCapture::constructor()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QVERIFY(imageCapture.isAvailable() == true);
-}
-
-//MaemoAPI-1824:test mediaObject
-void tst_QCameraImageCapture::mediaObject()
-{
- MockMediaServiceProvider provider1;
- NullService mymockcameraservice ;
- provider1.service = &mymockcameraservice;
- QCamera camera(0, &provider1);
- QCameraImageCapture imageCapture(&camera);
- QMediaObject *medobj = imageCapture.mediaObject();
- QVERIFY(medobj == NULL);
-
- QCamera camera1(0, provider);
- QCameraImageCapture imageCapture1(&camera1);
- QMediaObject *medobj1 = imageCapture1.mediaObject();
- QCOMPARE(medobj1, &camera1);
-}
-
-void tst_QCameraImageCapture::deleteMediaObject()
-{
- MockMediaServiceProvider *provider = new MockMediaServiceProvider;
- provider->service = new MockCameraService;
-
- QCamera *camera = new QCamera(0, provider);
- QCameraImageCapture *capture = new QCameraImageCapture(camera);
-
- QVERIFY(capture->mediaObject() == camera);
- QVERIFY(capture->isAvailable());
-
- delete camera;
- delete provider->service;
- delete provider;
-
- //capture should detach from camera
- QVERIFY(capture->mediaObject() == 0);
- QVERIFY(!capture->isAvailable());
-
- capture->capture();
- delete capture;
-}
-
-//MaemoAPI-1825:test isReadyForCapture
-void tst_QCameraImageCapture::isReadyForCapture()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QVERIFY(imageCapture.isAvailable() == true);
- QVERIFY(imageCapture.isReadyForCapture() == false);
- camera.start();
- imageCapture.capture();
- QTest::qWait(300);
- QVERIFY(imageCapture.isReadyForCapture() == true);
- camera.stop();
-}
-
-//MaemoAPI-1826:test capture
-void tst_QCameraImageCapture::capture()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QVERIFY(imageCapture.isAvailable() == true);
- QVERIFY(imageCapture.isReadyForCapture() == false);
- QVERIFY(imageCapture.capture() == -1);
- camera.start();
- QVERIFY(imageCapture.isReadyForCapture() == true);
- QTest::qWait(300);
- QVERIFY(imageCapture.capture() != -1);
- camera.stop();
-}
-
-//MaemoAPI-1827:test cancelCapture
-void tst_QCameraImageCapture::cancelCapture()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QSignalSpy spy(&imageCapture, SIGNAL(imageCaptured(int,QImage)));
- QSignalSpy spy1(&imageCapture, SIGNAL(imageSaved(int,QString)));
- QVERIFY(imageCapture.isAvailable() == true);
- QVERIFY(imageCapture.isReadyForCapture() == false);
- camera.start();
- imageCapture.capture();
- QTest::qWait(300);
- QVERIFY(imageCapture.isReadyForCapture() == true);
- QVERIFY(spy.count() == 1 && spy1.count() == 1);
- spy.clear();
- spy1.clear();
- camera.stop();
-
- QVERIFY(imageCapture.isReadyForCapture() == false);
- camera.start();
- imageCapture.capture();
- imageCapture.cancelCapture();
- QTest::qWait(300);
- QVERIFY(imageCapture.isReadyForCapture() == true);
- QVERIFY(spy.count() == 0 && spy1.count() == 0);
- camera.stop();
-}
-
-//MaemoAPI-1828:test encodingSettings
-//MaemoAPI-1829:test set encodingSettings
-void tst_QCameraImageCapture::encodingSettings()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QVERIFY(imageCapture.isAvailable() == true);
- QVERIFY(imageCapture.encodingSettings() == QImageEncoderSettings());
- QImageEncoderSettings settings;
- settings.setCodec("JPEG");
- settings.setQuality(QtMultimedia::NormalQuality);
- imageCapture.setEncodingSettings(settings);
- QVERIFY(!imageCapture.encodingSettings().isNull());
- QVERIFY(imageCapture.encodingSettings().codec() == "JPEG");
- QVERIFY(imageCapture.encodingSettings().quality() == QtMultimedia::NormalQuality);
-}
-
-//MaemoAPI-1838:test supportedImageCodecs
-void tst_QCameraImageCapture::supportedImageCodecs()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QVERIFY(imageCapture.isAvailable() == true);
- QVERIFY(!imageCapture.supportedImageCodecs().isEmpty());
-}
-
-//MaemoAPI-1836:test supportedResolutions
-void tst_QCameraImageCapture::supportedResolutions()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QVERIFY(imageCapture.isAvailable() == true);
- QVERIFY(imageCapture.supportedResolutions().count() == 2);
- QImageEncoderSettings settings1;
- settings1.setCodec("PNG");;
- settings1.setResolution(320, 240);
- int result = imageCapture.supportedResolutions(settings1).count();
- QVERIFY(result == 1);
-}
-
-//MaemoAPI-1837:test imageCodecDescription
-void tst_QCameraImageCapture::imageCodecDescription()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QVERIFY(imageCapture.isAvailable() == true);
- QVERIFY(imageCapture.imageCodecDescription(" ").isNull());
- QVERIFY(imageCapture.imageCodecDescription("PNG").isNull() == false);
-}
-
-//MaemoAPI-1830:test errors
-void tst_QCameraImageCapture::errors()
-{
- MockMediaServiceProvider provider1 ;
- MockSimpleCameraService mockSimpleCameraService ;
- provider1.service = &mockSimpleCameraService;
-
- QCamera camera1(0, &provider1);
- QCameraImageCapture imageCapture1(&camera1);
- QVERIFY(imageCapture1.isAvailable() == false);
- imageCapture1.capture(QString::fromLatin1("/dev/null"));
- QVERIFY(imageCapture1.error() == QCameraImageCapture::NotSupportedFeatureError);
- QVERIFY2(!imageCapture1.errorString().isEmpty(), "Device does not support images capture");
- QVERIFY(imageCapture1.availabilityError() == QtMultimedia::ServiceMissingError);
-
-
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QVERIFY(imageCapture.isAvailable() == true);
- QVERIFY(imageCapture.error() == QCameraImageCapture::NoError);
- QVERIFY(imageCapture.errorString().isEmpty());
- QVERIFY(imageCapture.availabilityError() == QtMultimedia::NoError);
-
- imageCapture.capture();
- QVERIFY(imageCapture.error() == QCameraImageCapture::NotReadyError);
- QVERIFY2(!imageCapture.errorString().isEmpty(), "Could not capture in stopped state");
- QVERIFY(imageCapture.availabilityError() == QtMultimedia::NoError);
-}
-
-//MaemoAPI-1831:test error
-void tst_QCameraImageCapture::error()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QSignalSpy spy(&imageCapture, SIGNAL(error(int,QCameraImageCapture::Error,QString)));
- imageCapture.capture();
- QTest::qWait(30);
- QVERIFY(spy.count() == 1);
- QVERIFY(qvariant_cast<int>(spy.at(0).at(0)) == -1);
- QVERIFY(qvariant_cast<QCameraImageCapture::Error>(spy.at(0).at(1)) == QCameraImageCapture::NotReadyError);
- QVERIFY(qvariant_cast<QString>(spy.at(0).at(2)) == "Could not capture in stopped state");
- spy.clear();
-}
-
-//MaemoAPI-1832:test imageCaptured
-void tst_QCameraImageCapture::imageCaptured()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QSignalSpy spy(&imageCapture, SIGNAL(imageCaptured(int,QImage)));
- QVERIFY(imageCapture.isAvailable() == true);
- QVERIFY(imageCapture.isReadyForCapture() == false);
- camera.start();
- imageCapture.capture();
- QTest::qWait(300);
- QVERIFY(imageCapture.isReadyForCapture() == true);
-
- QVERIFY(spy.count() == 1);
- QVERIFY(qvariant_cast<int>(spy.at(0).at(0)) > 0);
- QImage image = qvariant_cast<QImage>(spy.at(0).at(1));
- QVERIFY(image.isNull() == true);
- spy.clear();
- camera.stop();
-}
-
-//MaemoAPI-1833:test imageExposed
-void tst_QCameraImageCapture::imageExposed()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QSignalSpy spy(&imageCapture, SIGNAL(imageExposed(int)));
- QVERIFY(imageCapture.isAvailable() == true);
- QVERIFY(imageCapture.isReadyForCapture() == false);
- camera.start();
- imageCapture.capture();
- QTest::qWait(300);
- QVERIFY(imageCapture.isReadyForCapture() == true);
-
- QVERIFY(spy.count() == 1);
- QVERIFY(qvariant_cast<int>(spy.at(0).at(0)) > 0);
- spy.clear();
- camera.stop();
-}
-
-//MaemoAPI-1834:test imageSaved
-void tst_QCameraImageCapture::imageSaved()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QSignalSpy spy(&imageCapture, SIGNAL(imageSaved(int,QString)));
- QVERIFY(imageCapture.isAvailable() == true);
- QVERIFY(imageCapture.isReadyForCapture() == false);
- camera.start();
- imageCapture.capture(QString::fromLatin1("/usr/share"));
- QTest::qWait(300);
- QVERIFY(imageCapture.isReadyForCapture() == true);
-
- QVERIFY(spy.count() == 1);
- QVERIFY(qvariant_cast<int>(spy.at(0).at(0)) > 0);
- QVERIFY(qvariant_cast<QString>(spy.at(0).at(1)) == "/usr/share");
- spy.clear();
- camera.stop();
-}
-
-//MaemoAPI-1835:test readyForCaptureChanged
-void tst_QCameraImageCapture::readyForCaptureChanged()
-{
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
- QSignalSpy spy(&imageCapture, SIGNAL(readyForCaptureChanged(bool)));
- QVERIFY(imageCapture.isReadyForCapture() == false);
- imageCapture.capture();
- QTest::qWait(100);
- QVERIFY(spy.count() == 0);
- QVERIFY2(!imageCapture.errorString().isEmpty(),"Could not capture in stopped state" );
- camera.start();
- QTest::qWait(100);
- imageCapture.capture();
- QTest::qWait(100);
- QVERIFY(spy.count() == 2);
- QVERIFY(spy.at(0).at(0).toBool() == false);
- QVERIFY(spy.at(1).at(0).toBool() == true);
- camera.stop();
- spy.clear();
-}
-
-//MaemoAPI-1853:test cameraImageCapture control constructor
-void tst_QCameraImageCapture::cameraImageCaptureControl()
-{
- MockCameraControl ctrl;
- MockCaptureControl capctrl(&ctrl);
-}
-
-QTEST_MAIN(tst_QCameraImageCapture)
-
-#include "tst_qcameraimagecapture.moc"
diff --git a/tests/auto/qcameraviewfinder/qcameraviewfinder.pro b/tests/auto/qcameraviewfinder/qcameraviewfinder.pro
deleted file mode 100644
index a53729a..0000000
--- a/tests/auto/qcameraviewfinder/qcameraviewfinder.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qcameraviewfinder
-
-QT += multimedia-private multimediawidgets-private testlib
-CONFIG += no_private_qt_headers_warning
-
-include (../qmultimedia_common/mock.pri)
-include (../qmultimedia_common/mockcamera.pri)
-
-SOURCES += tst_qcameraviewfinder.cpp
-QT+=widgets
diff --git a/tests/auto/qcameraviewfinder/tst_qcameraviewfinder.cpp b/tests/auto/qcameraviewfinder/tst_qcameraviewfinder.cpp
deleted file mode 100644
index 106a87b..0000000
--- a/tests/auto/qcameraviewfinder/tst_qcameraviewfinder.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include <QDebug>
-
-#include "qcameraviewfinder.h"
-#include "qcamera.h"
-#include "qmediaobject.h"
-
-#include "mockcameraservice.h"
-#include "mockmediaserviceprovider.h"
-
-class tst_QCameraViewFinder : public QObject
-{
- Q_OBJECT
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- void testConstructor();
- void testMediaObject();
-
-private:
- MockCameraService *mockcameraservice;
- MockMediaServiceProvider *provider;
- QCamera *camera;
- QCameraViewfinder *viewFinder;
-};
-
-void tst_QCameraViewFinder::initTestCase()
-{
- provider = new MockMediaServiceProvider;
- mockcameraservice = new MockCameraService;
- provider->service = mockcameraservice;
-
- camera = new QCamera(0, provider);
- viewFinder = new QCameraViewfinder();
-}
-
-void tst_QCameraViewFinder::cleanupTestCase()
-{
- delete mockcameraservice;
- delete provider;
-}
-
-void tst_QCameraViewFinder::testConstructor()
-{
- /* Verify whether the object is created or not */
- QVERIFY(viewFinder != NULL);
- QCOMPARE(viewFinder->isVisible(),false);
- QCOMPARE(viewFinder->isEnabled(),true);
- viewFinder->show();
-}
-
-void tst_QCameraViewFinder::testMediaObject()
-{
- QVERIFY(viewFinder != NULL);
- viewFinder->show();
- /* Sets the QVideoWidget based camera viewfinder.*/
- camera->setViewfinder(viewFinder);
- QCOMPARE(viewFinder->isVisible(),true);
-
- /* Return the currently attached media object.*/
- QMediaObject *media = viewFinder->mediaObject();
-
- /* Verifying the object */
- QCOMPARE(media, camera);
-}
-
-QTEST_MAIN(tst_QCameraViewFinder)
-#include "tst_qcameraviewfinder.moc"
diff --git a/tests/auto/qcamerawidgets/qcamerawidgets.pro b/tests/auto/qcamerawidgets/qcamerawidgets.pro
deleted file mode 100644
index f8de4af..0000000
--- a/tests/auto/qcamerawidgets/qcamerawidgets.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qcamerawidgets
-
-QT += multimedia-private multimediawidgets-private testlib
-CONFIG += no_private_qt_headers_warning
-
-include (../qmultimedia_common/mock.pri)
-include (../qmultimedia_common/mockcamera.pri)
-
-SOURCES += tst_qcamerawidgets.cpp
-
-maemo*:CONFIG += insignificant_test
-QT+=widgets
diff --git a/tests/auto/qcamerawidgets/tst_qcamerawidgets.cpp b/tests/auto/qcamerawidgets/tst_qcamerawidgets.cpp
deleted file mode 100644
index 92cafda..0000000
--- a/tests/auto/qcamerawidgets/tst_qcamerawidgets.cpp
+++ /dev/null
@@ -1,318 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-#include <QtTest/QtTest>
-#include <QDebug>
-
-#include <qabstractvideosurface.h>
-#include <qcameracontrol.h>
-#include <qcameralockscontrol.h>
-#include <qcameraexposurecontrol.h>
-#include <qcameraflashcontrol.h>
-#include <qcamerafocuscontrol.h>
-#include <qcameraimagecapturecontrol.h>
-#include <qimageencodercontrol.h>
-#include <qcameraimageprocessingcontrol.h>
-#include <qcameracapturebufferformatcontrol.h>
-#include <qcameracapturedestinationcontrol.h>
-#include <qmediaservice.h>
-#include <qcamera.h>
-#include <qcameraimagecapture.h>
-#include <qgraphicsvideoitem.h>
-#include <qvideorenderercontrol.h>
-#include <qvideowidget.h>
-#include <qvideowindowcontrol.h>
-
-#include "mockcameraservice.h"
-
-#include "mockmediaserviceprovider.h"
-#include "mockvideosurface.h"
-#include "mockvideorenderercontrol.h"
-#include "mockvideowindowcontrol.h"
-
-QT_USE_NAMESPACE
-
-
-class tst_QCameraWidgets: public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- void testCameraEncodingProperyChange();
- void testSetVideoOutput();
- void testSetVideoOutputNoService();
- void testSetVideoOutputNoControl();
-
-private:
- MockSimpleCameraService *mockSimpleCameraService;
- MockMediaServiceProvider *provider;
-};
-
-void tst_QCameraWidgets::initTestCase()
-{
- provider = new MockMediaServiceProvider;
- mockSimpleCameraService = new MockSimpleCameraService;
- provider->service = mockSimpleCameraService;
- qRegisterMetaType<QtMultimedia::MetaData>("QtMultimedia::MetaData");
-}
-
-void tst_QCameraWidgets::cleanupTestCase()
-{
- delete mockSimpleCameraService;
- delete provider;
-}
-
-void tst_QCameraWidgets::testCameraEncodingProperyChange()
-{
- MockCameraService service;
- provider->service = &service;
- QCamera camera(0, provider);
- QCameraImageCapture imageCapture(&camera);
-
- QSignalSpy stateChangedSignal(&camera, SIGNAL(stateChanged(QCamera::State)));
- QSignalSpy statusChangedSignal(&camera, SIGNAL(statusChanged(QCamera::Status)));
-
- camera.start();
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::ActiveStatus);
-
- QCOMPARE(stateChangedSignal.count(), 1);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
-
- camera.setCaptureMode(QCamera::CaptureVideo);
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::LoadedStatus);
-
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- QTest::qWait(10);
-
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::ActiveStatus);
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- //backens should not be stopped since the capture mode is Video
- imageCapture.setEncodingSettings(QImageEncoderSettings());
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 0);
-
- camera.setCaptureMode(QCamera::CaptureStillImage);
- QTest::qWait(10);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- //the settings change should trigger camera stop/start
- imageCapture.setEncodingSettings(QImageEncoderSettings());
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::LoadedStatus);
-
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- QTest::qWait(10);
-
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::ActiveStatus);
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- //the settings change should trigger camera stop/start only once
- camera.setCaptureMode(QCamera::CaptureVideo);
- camera.setCaptureMode(QCamera::CaptureStillImage);
- imageCapture.setEncodingSettings(QImageEncoderSettings());
- imageCapture.setEncodingSettings(QImageEncoderSettings());
-
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::LoadedStatus);
-
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- QTest::qWait(10);
-
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::ActiveStatus);
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- //setting the viewfinder should also trigger backend to be restarted:
- camera.setViewfinder(new QGraphicsVideoItem());
- QCOMPARE(camera.state(), QCamera::ActiveState);
- QCOMPARE(camera.status(), QCamera::LoadedStatus);
-
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 1);
-
- QTest::qWait(10);
-
- service.mockControl->m_propertyChangesSupported = true;
- //the changes to encoding settings,
- //capture mode and encoding parameters should not trigger service restart
- stateChangedSignal.clear();
- statusChangedSignal.clear();
-
- camera.setCaptureMode(QCamera::CaptureVideo);
- camera.setCaptureMode(QCamera::CaptureStillImage);
- imageCapture.setEncodingSettings(QImageEncoderSettings());
- imageCapture.setEncodingSettings(QImageEncoderSettings());
- camera.setViewfinder(new QGraphicsVideoItem());
-
- QCOMPARE(stateChangedSignal.count(), 0);
- QCOMPARE(statusChangedSignal.count(), 0);
-}
-
-void tst_QCameraWidgets::testSetVideoOutput()
-{
- QVideoWidget widget;
- QGraphicsVideoItem item;
- MockVideoSurface surface;
-
- MockCameraService service;
- MockMediaServiceProvider provider;
- provider.service = &service;
- QCamera camera(0, &provider);
-
- camera.setViewfinder(&widget);
- qDebug() << widget.mediaObject();
- QVERIFY(widget.mediaObject() == &camera);
-
- camera.setViewfinder(&item);
- QVERIFY(widget.mediaObject() == 0);
- QVERIFY(item.mediaObject() == &camera);
-
- camera.setViewfinder(reinterpret_cast<QVideoWidget *>(0));
- QVERIFY(item.mediaObject() == 0);
-
- camera.setViewfinder(&widget);
- QVERIFY(widget.mediaObject() == &camera);
-
- camera.setViewfinder(reinterpret_cast<QGraphicsVideoItem *>(0));
- QVERIFY(widget.mediaObject() == 0);
-
- camera.setViewfinder(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
-
- camera.setViewfinder(reinterpret_cast<QAbstractVideoSurface *>(0));
- QVERIFY(service.rendererControl->surface() == 0);
-
- camera.setViewfinder(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
-
- camera.setViewfinder(&widget);
- QVERIFY(service.rendererControl->surface() == 0);
- QVERIFY(widget.mediaObject() == &camera);
-
- camera.setViewfinder(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
- QVERIFY(widget.mediaObject() == 0);
-}
-
-
-void tst_QCameraWidgets::testSetVideoOutputNoService()
-{
- QVideoWidget widget;
- QGraphicsVideoItem item;
- MockVideoSurface surface;
-
- MockMediaServiceProvider provider;
- provider.service = 0;
- QCamera camera(0, &provider);
-
- camera.setViewfinder(&widget);
- QVERIFY(widget.mediaObject() == 0);
-
- camera.setViewfinder(&item);
- QVERIFY(item.mediaObject() == 0);
-
- camera.setViewfinder(&surface);
- // Nothing we can verify here other than it doesn't assert.
-}
-
-void tst_QCameraWidgets::testSetVideoOutputNoControl()
-{
- QVideoWidget widget;
- QGraphicsVideoItem item;
- MockVideoSurface surface;
-
- MockCameraService service;
- service.rendererRef = 1;
- service.windowRef = 1;
-
- MockMediaServiceProvider provider;
- provider.service = &service;
- QCamera camera(0, &provider);
-
- camera.setViewfinder(&widget);
- QVERIFY(widget.mediaObject() == 0);
-
- camera.setViewfinder(&item);
- QVERIFY(item.mediaObject() == 0);
-
- camera.setViewfinder(&surface);
- QVERIFY(service.rendererControl->surface() == 0);
-}
-
-QTEST_MAIN(tst_QCameraWidgets)
-
-#include "tst_qcamerawidgets.moc"
diff --git a/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro b/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro
deleted file mode 100644
index 35f1173..0000000
--- a/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qdeclarativeaudio
-
-QT += multimedia-private declarative testlib
-CONFIG += no_private_qt_headers_warning
-
-HEADERS += \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativeaudio_p.h \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativemediabase_p.h \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativemediametadata_p.h
-
-SOURCES += \
- tst_qdeclarativeaudio.cpp \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativeaudio.cpp \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativemediabase.cpp
-
-INCLUDEPATH += $$QT.multimedia.sources/../imports/multimedia
diff --git a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp b/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp
deleted file mode 100644
index ef538b6..0000000
--- a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp
+++ /dev/null
@@ -1,1301 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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=plugins/declarative/multimedia
-
-#include <QtTest/QtTest>
-
-#include "qdeclarativeaudio_p.h"
-#include "qdeclarativemediametadata_p.h"
-
-#include <qmediaplayercontrol.h>
-#include <qmediaservice.h>
-#include <qmediaserviceprovider.h>
-#include <qmetadatareadercontrol.h>
-
-#include <QtWidgets/qapplication.h>
-
-class tst_QDeclarativeAudio : public QObject
-{
- Q_OBJECT
-public slots:
- void initTestCase();
-
-private slots:
- void nullPlayerControl();
- void nullMetaDataControl();
- void nullService();
-
- void source();
- void autoLoad();
- void playing();
- void paused();
- void duration();
- void position();
- void volume();
- void muted();
- void bufferProgress();
- void seekable();
- void playbackRate();
- void status();
- void metaData_data();
- void metaData();
- void error();
- void loops();
-};
-
-Q_DECLARE_METATYPE(QDeclarativeAudio::Error);
-
-class QtTestMediaPlayerControl : public QMediaPlayerControl
-{
- Q_OBJECT
-public:
- QtTestMediaPlayerControl(QObject *parent = 0)
- : QMediaPlayerControl(parent)
- , m_state(QMediaPlayer::StoppedState)
- , m_mediaStatus(QMediaPlayer::NoMedia)
- , m_duration(0)
- , m_position(0)
- , m_playbackRate(1.0)
- , m_volume(100)
- , m_bufferStatus(0)
- , m_muted(false)
- , m_audioAvailable(false)
- , m_videoAvailable(false)
- , m_seekable(false)
- {
- }
-
- QMediaPlayer::State state() const { return m_state; }
- void updateState(QMediaPlayer::State state) { emit stateChanged(m_state = state); }
-
- QMediaPlayer::MediaStatus mediaStatus() const { return m_mediaStatus; }
- void updateMediaStatus(QMediaPlayer::MediaStatus status) {
- emit mediaStatusChanged(m_mediaStatus = status); }
- void updateMediaStatus(QMediaPlayer::MediaStatus status, QMediaPlayer::State state)
- {
- m_mediaStatus = status;
- m_state = state;
-
- emit mediaStatusChanged(m_mediaStatus);
- emit stateChanged(m_state);
- }
-
- qint64 duration() const { return m_duration; }
- void setDuration(qint64 duration) { emit durationChanged(m_duration = duration); }
-
- qint64 position() const { return m_position; }
- void setPosition(qint64 position) { emit positionChanged(m_position = position); }
-
- int volume() const { return m_volume; }
- void setVolume(int volume) { emit volumeChanged(m_volume = volume); }
-
- bool isMuted() const { return m_muted; }
- void setMuted(bool muted) { emit mutedChanged(m_muted = muted); }
-
- int bufferStatus() const { return m_bufferStatus; }
- void setBufferStatus(int status) { emit bufferStatusChanged(m_bufferStatus = status); }
-
- bool isAudioAvailable() const { return m_audioAvailable; }
- void setAudioAvailable(bool available) {
- emit audioAvailableChanged(m_audioAvailable = available); }
- bool isVideoAvailable() const { return m_videoAvailable; }
- void setVideoAvailable(bool available) {
- emit videoAvailableChanged(m_videoAvailable = available); }
-
- bool isSeekable() const { return m_seekable; }
- void setSeekable(bool seekable) { emit seekableChanged(m_seekable = seekable); }
-
- QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); }
-
- qreal playbackRate() const { return m_playbackRate; }
- void setPlaybackRate(qreal rate) { emit playbackRateChanged(m_playbackRate = rate); }
-
- QMediaContent media() const { return m_media; }
- const QIODevice *mediaStream() const { return 0; }
- void setMedia(const QMediaContent &media, QIODevice *)
- {
- m_media = media;
-
- m_mediaStatus = m_media.isNull()
- ? QMediaPlayer::NoMedia
- : QMediaPlayer::LoadingMedia;
-
- emit mediaChanged(m_media);
- emit mediaStatusChanged(m_mediaStatus);
- }
-
- void play()
- {
- m_state = QMediaPlayer::PlayingState;
- if (m_mediaStatus == QMediaPlayer::EndOfMedia)
- updateMediaStatus(QMediaPlayer::LoadedMedia);
- emit stateChanged(m_state);
- }
- void pause() { emit stateChanged(m_state = QMediaPlayer::PausedState); }
- void stop() { emit stateChanged(m_state = QMediaPlayer::StoppedState); }
-
- void emitError(QMediaPlayer::Error err, const QString &errorString) {
- emit error(err, errorString); }
-
-private:
- QMediaPlayer::State m_state;
- QMediaPlayer::MediaStatus m_mediaStatus;
- qint64 m_duration;
- qint64 m_position;
- qreal m_playbackRate;
- int m_volume;
- int m_bufferStatus;
- bool m_muted;
- bool m_audioAvailable;
- bool m_videoAvailable;
- bool m_seekable;
- QMediaContent m_media;
-};
-
-class QtTestMetaDataControl : public QMetaDataReaderControl
-{
- Q_OBJECT
-public:
- QtTestMetaDataControl(QObject *parent = 0)
- : QMetaDataReaderControl(parent)
- {
- }
-
- bool isMetaDataAvailable() const { return true; }
-
- QVariant metaData(QtMultimedia::MetaData key) const { return m_metaData.value(key); }
- void setMetaData(QtMultimedia::MetaData key, const QVariant &value) {
- m_metaData.insert(key, value); emit metaDataChanged(); }
-
- QList<QtMultimedia::MetaData> availableMetaData() const { return m_metaData.keys(); }
-
- QVariant extendedMetaData(const QString &) const { return QVariant(); }
- QStringList availableExtendedMetaData() const { return QStringList(); }
-
-private:
- QMap<QtMultimedia::MetaData, QVariant> m_metaData;
-};
-
-class QtTestMediaService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestMediaService(
- QtTestMediaPlayerControl *playerControl,
- QtTestMetaDataControl *metaDataControl,
- QObject *parent)
- : QMediaService(parent)
- , playerControl(playerControl)
- , metaDataControl(metaDataControl)
- {
- }
-
- QMediaControl *requestControl(const char *name)
- {
- if (qstrcmp(name, QMediaPlayerControl_iid) == 0)
- return playerControl;
- else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0)
- return metaDataControl;
- else
- return 0;
- }
-
- void releaseControl(QMediaControl *) {}
-
- QtTestMediaPlayerControl *playerControl;
- QtTestMetaDataControl *metaDataControl;
-};
-
-class QtTestMediaServiceProvider : public QMediaServiceProvider
-{
- Q_OBJECT
-public:
- QtTestMediaServiceProvider()
- : service(new QtTestMediaService(
- new QtTestMediaPlayerControl(this), new QtTestMetaDataControl(this), this))
- {
- setDefaultServiceProvider(this);
- }
-
- QtTestMediaServiceProvider(QtTestMediaService *service)
- : service(service)
- {
- setDefaultServiceProvider(this);
- }
-
- QtTestMediaServiceProvider(
- QtTestMediaPlayerControl *playerControl, QtTestMetaDataControl *metaDataControl)
- : service(new QtTestMediaService(playerControl, metaDataControl, this))
- {
- setDefaultServiceProvider(this);
- }
-
- ~QtTestMediaServiceProvider()
- {
- setDefaultServiceProvider(0);
- }
-
- QMediaService *requestService(
- const QByteArray &type,
- const QMediaServiceProviderHint & = QMediaServiceProviderHint())
- {
- requestedService = type;
-
- return service;
- }
-
- void releaseService(QMediaService *) {}
-
- inline QtTestMediaPlayerControl *playerControl() { return service->playerControl; }
- inline QtTestMetaDataControl *metaDataControl() { return service->metaDataControl; }
-
- QtTestMediaService *service;
- QByteArray requestedService;
-};
-
-void tst_QDeclarativeAudio::initTestCase()
-{
- qRegisterMetaType<QDeclarativeAudio::Error>();
-}
-
-void tst_QDeclarativeAudio::nullPlayerControl()
-{
- QtTestMetaDataControl metaDataControl;
- QtTestMediaServiceProvider provider(0, &metaDataControl);
-
- QDeclarativeAudio audio;
- audio.classBegin();
-
- QCOMPARE(audio.source(), QUrl());
- audio.setSource(QUrl("http://example.com"));
- QCOMPARE(audio.source(), QUrl("http://example.com"));
-
- QCOMPARE(audio.isPlaying(), false);
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- audio.setPlaying(false);
- audio.play();
- QCOMPARE(audio.isPlaying(), false);
-
- QCOMPARE(audio.isPaused(), false);
- audio.pause();
- QCOMPARE(audio.isPaused(), false);
- audio.setPaused(true);
- QCOMPARE(audio.isPaused(), true);
-
- QCOMPARE(audio.duration(), 0);
-
- QCOMPARE(audio.position(), 0);
- audio.setPosition(10000);
- QCOMPARE(audio.position(), 10000);
-
- QCOMPARE(audio.volume(), qreal(1.0));
- audio.setVolume(0.5);
- QCOMPARE(audio.volume(), qreal(0.5));
-
- QCOMPARE(audio.isMuted(), false);
- audio.setMuted(true);
- QCOMPARE(audio.isMuted(), true);
-
- QCOMPARE(audio.bufferProgress(), qreal(0));
-
- QCOMPARE(audio.isSeekable(), false);
-
- QCOMPARE(audio.playbackRate(), qreal(1.0));
-
- QCOMPARE(audio.status(), QDeclarativeAudio::NoMedia);
-
- QCOMPARE(audio.error(), QDeclarativeAudio::ServiceMissing);
-}
-
-void tst_QDeclarativeAudio::nullMetaDataControl()
-{
- QtTestMediaPlayerControl playerControl;
- QtTestMediaServiceProvider provider(&playerControl, 0);
-
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QVERIFY(audio.metaData());
-}
-
-void tst_QDeclarativeAudio::nullService()
-{
- QtTestMediaServiceProvider provider(0);
-
- QDeclarativeAudio audio;
- audio.classBegin();
-
- QCOMPARE(audio.source(), QUrl());
- audio.setSource(QUrl("http://example.com"));
- QCOMPARE(audio.source(), QUrl("http://example.com"));
-
- QCOMPARE(audio.isPlaying(), false);
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- audio.setPlaying(false);
- audio.play();
- QCOMPARE(audio.isPlaying(), false);
-
- QCOMPARE(audio.isPaused(), false);
- audio.pause();
- QCOMPARE(audio.isPaused(), false);
- audio.setPaused(true);
- QCOMPARE(audio.isPaused(), true);
-
- QCOMPARE(audio.duration(), 0);
-
- QCOMPARE(audio.position(), 0);
- audio.setPosition(10000);
- QCOMPARE(audio.position(), 10000);
-
- QCOMPARE(audio.volume(), qreal(1.0));
- audio.setVolume(0.5);
- QCOMPARE(audio.volume(), qreal(0.5));
-
- QCOMPARE(audio.isMuted(), false);
- audio.setMuted(true);
- QCOMPARE(audio.isMuted(), true);
-
- QCOMPARE(audio.bufferProgress(), qreal(0));
-
- QCOMPARE(audio.isSeekable(), false);
-
- QCOMPARE(audio.playbackRate(), qreal(1.0));
-
- QCOMPARE(audio.status(), QDeclarativeAudio::NoMedia);
-
- QCOMPARE(audio.error(), QDeclarativeAudio::ServiceMissing);
-
- QVERIFY(audio.metaData());
-}
-
-void tst_QDeclarativeAudio::source()
-{
- const QUrl url1("http://example.com");
- const QUrl url2("file:///local/path");
- const QUrl url3;
-
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(sourceChanged()));
-
- audio.setSource(url1);
- QCOMPARE(audio.source(), url1);
- QCOMPARE(provider.playerControl()->media().canonicalUrl(), url1);
- QCOMPARE(spy.count(), 1);
-
- audio.setSource(url2);
- QCOMPARE(audio.source(), url2);
- QCOMPARE(provider.playerControl()->media().canonicalUrl(), url2);
- QCOMPARE(spy.count(), 2);
-
- audio.setSource(url3);
- QCOMPARE(audio.source(), url3);
- QCOMPARE(provider.playerControl()->media().canonicalUrl(), url3);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeAudio::autoLoad()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(autoLoadChanged()));
-
- QCOMPARE(audio.isAutoLoad(), true);
-
- audio.setAutoLoad(false);
- QCOMPARE(audio.isAutoLoad(), false);
- QCOMPARE(spy.count(), 1);
-
- audio.setSource(QUrl("http://example.com"));
- QCOMPARE(audio.source(), QUrl("http://example.com"));
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- audio.stop();
-
- audio.setAutoLoad(true);
- audio.setSource(QUrl("http://example.com"));
- audio.setPaused(true);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(audio.isPaused(), true);
-}
-
-void tst_QDeclarativeAudio::playing()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
-
- QSignalSpy playingChangedSpy(&audio, SIGNAL(playingChanged()));
- QSignalSpy startedSpy(&audio, SIGNAL(started()));
- QSignalSpy stoppedSpy(&audio, SIGNAL(stopped()));
-
- int playingChanged = 0;
- int started = 0;
- int stopped = 0;
-
- audio.componentComplete();
- audio.setSource(QUrl("http://example.com"));
-
- QCOMPARE(audio.isPlaying(), false);
-
- // setPlaying(true) when stopped.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when playing.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // play() when stopped.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when playing.
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // stop() when stopped.
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when stopped.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(true) when playing.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // play() when playing.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-}
-
-void tst_QDeclarativeAudio::paused()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
-
- QSignalSpy playingChangedSpy(&audio, SIGNAL(playingChanged()));
- QSignalSpy pausedChangedSpy(&audio, SIGNAL(pausedChanged()));
- QSignalSpy startedSpy(&audio, SIGNAL(started()));
- QSignalSpy pausedSpy(&audio, SIGNAL(paused()));
- QSignalSpy resumedSpy(&audio, SIGNAL(resumed()));
- QSignalSpy stoppedSpy(&audio, SIGNAL(stopped()));
-
- int playingChanged = 0;
- int pausedChanged = 0;
- int started = 0;
- int paused = 0;
- int resumed = 0;
- int stopped = 0;
-
- audio.componentComplete();
- audio.setSource(QUrl("http://example.com"));
-
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), false);
-
- // setPlaying(true) when stopped.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when playing.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when paused.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when paused.
- audio.pause();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when paused.
- audio.setPaused(false);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), ++resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when playing.
- audio.setPaused(false);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when playing.
- audio.pause();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // setPaused(true) when stopped and paused.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when stopped and paused.
- audio.setPaused(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when stopped.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(true) when stopped and paused.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // play() when paused.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), ++resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when playing.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when paused.
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // setPaused(true) when stopped.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when stopped and paused.
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when stopped.
- audio.pause();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // pause() when stopped and paused.
- audio.pause();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // play() when stopped and paused.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-}
-
-void tst_QDeclarativeAudio::duration()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(durationChanged()));
-
- QCOMPARE(audio.duration(), 0);
-
- provider.playerControl()->setDuration(4040);
- QCOMPARE(audio.duration(), 4040);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setDuration(-129);
- QCOMPARE(audio.duration(), -129);
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setDuration(0);
- QCOMPARE(audio.duration(), 0);
- QCOMPARE(spy.count(), 3);
-
- // Unnecessary duration changed signals aren't filtered.
- provider.playerControl()->setDuration(0);
- QCOMPARE(audio.duration(), 0);
- QCOMPARE(spy.count(), 4);
-}
-
-void tst_QDeclarativeAudio::position()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(positionChanged()));
-
- QCOMPARE(audio.position(), 0);
-
- // QDeclarativeAudio won't bound set positions to the duration. A media service may though.
- QCOMPARE(audio.duration(), 0);
-
- audio.setPosition(450);
- QCOMPARE(audio.position(), 450);
- QCOMPARE(provider.playerControl()->position(), qint64(450));
- QCOMPARE(spy.count(), 1);
-
- audio.setPosition(-5403);
- QCOMPARE(audio.position(), -5403);
- QCOMPARE(provider.playerControl()->position(), qint64(-5403));
- QCOMPARE(spy.count(), 2);
-
- audio.setPosition(-5403);
- QCOMPARE(audio.position(), -5403);
- QCOMPARE(provider.playerControl()->position(), qint64(-5403));
- QCOMPARE(spy.count(), 2);
-
- // Check the signal change signal is emitted if the change originates from the media service.
- provider.playerControl()->setPosition(0);
- QCOMPARE(audio.position(), 0);
- QCOMPARE(spy.count(), 3);
-
- connect(&audio, SIGNAL(positionChanged()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- provider.playerControl()->updateState(QMediaPlayer::PlayingState);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(spy.count() > 3 && spy.count() < 6); // 4 or 5
-
- provider.playerControl()->updateState(QMediaPlayer::PausedState);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(spy.count() < 6);
-}
-
-void tst_QDeclarativeAudio::volume()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(volumeChanged()));
-
- QCOMPARE(audio.volume(), qreal(1.0));
-
- audio.setVolume(0.7);
- QCOMPARE(audio.volume(), qreal(0.7));
- QCOMPARE(provider.playerControl()->volume(), 70);
- QCOMPARE(spy.count(), 1);
-
- audio.setVolume(0.7);
- QCOMPARE(audio.volume(), qreal(0.7));
- QCOMPARE(provider.playerControl()->volume(), 70);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setVolume(30);
- QCOMPARE(audio.volume(), qreal(0.3));
- QCOMPARE(spy.count(), 2);
-}
-
-void tst_QDeclarativeAudio::muted()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(mutedChanged()));
-
- QCOMPARE(audio.isMuted(), false);
-
- audio.setMuted(true);
- QCOMPARE(audio.isMuted(), true);
- QCOMPARE(provider.playerControl()->isMuted(), true);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setMuted(false);
- QCOMPARE(audio.isMuted(), false);
- QCOMPARE(spy.count(), 2);
-
- audio.setMuted(false);
- QCOMPARE(audio.isMuted(), false);
- QCOMPARE(provider.playerControl()->isMuted(), false);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeAudio::bufferProgress()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(bufferProgressChanged()));
-
- QCOMPARE(audio.bufferProgress(), qreal(0.0));
-
- provider.playerControl()->setBufferStatus(20);
- QCOMPARE(audio.bufferProgress(), qreal(0.2));
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setBufferStatus(20);
- QCOMPARE(audio.bufferProgress(), qreal(0.2));
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setBufferStatus(40);
- QCOMPARE(audio.bufferProgress(), qreal(0.4));
- QCOMPARE(spy.count(), 3);
-
- connect(&audio, SIGNAL(positionChanged()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- provider.playerControl()->updateMediaStatus(
- QMediaPlayer::BufferingMedia, QMediaPlayer::PlayingState);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(spy.count() > 3 && spy.count() < 6); // 4 or 5
-
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(spy.count() < 6);
-}
-
-void tst_QDeclarativeAudio::seekable()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(seekableChanged()));
-
- QCOMPARE(audio.isSeekable(), false);
-
- provider.playerControl()->setSeekable(true);
- QCOMPARE(audio.isSeekable(), true);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setSeekable(true);
- QCOMPARE(audio.isSeekable(), true);
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setSeekable(false);
- QCOMPARE(audio.isSeekable(), false);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeAudio::playbackRate()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(playbackRateChanged()));
-
- QCOMPARE(audio.playbackRate(), qreal(1.0));
-
- audio.setPlaybackRate(0.5);
- QCOMPARE(audio.playbackRate(), qreal(0.5));
- QCOMPARE(provider.playerControl()->playbackRate(), qreal(0.5));
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setPlaybackRate(2.0);
- QCOMPARE(provider.playerControl()->playbackRate(), qreal(2.0));
- QCOMPARE(spy.count(), 2);
-
- audio.setPlaybackRate(2.0);
- QCOMPARE(audio.playbackRate(), qreal(2.0));
- QCOMPARE(provider.playerControl()->playbackRate(), qreal(2.0));
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeAudio::status()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy statusChangedSpy(&audio, SIGNAL(statusChanged()));
-
- QCOMPARE(audio.status(), QDeclarativeAudio::NoMedia);
-
- // Set media, start loading.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::LoadingMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Loading);
- QCOMPARE(statusChangedSpy.count(), 1);
-
- // Finish loading.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::LoadedMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Loaded);
- QCOMPARE(statusChangedSpy.count(), 2);
-
- // Play, start buffering.
- provider.playerControl()->updateMediaStatus(
- QMediaPlayer::StalledMedia, QMediaPlayer::PlayingState);
- QCOMPARE(audio.status(), QDeclarativeAudio::Stalled);
- QCOMPARE(statusChangedSpy.count(), 3);
-
- // Enough data buffered to proceed.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Buffering);
- QCOMPARE(statusChangedSpy.count(), 4);
-
- // Errant second buffering status changed.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Buffering);
- QCOMPARE(statusChangedSpy.count(), 4);
-
- // Buffer full.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Buffered);
- QCOMPARE(statusChangedSpy.count(), 5);
-
- // Buffer getting low.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Buffering);
- QCOMPARE(statusChangedSpy.count(), 6);
-
- // Buffer full.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Buffered);
- QCOMPARE(statusChangedSpy.count(), 7);
-
- // Finished.
- provider.playerControl()->updateMediaStatus(
- QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- QCOMPARE(audio.status(), QDeclarativeAudio::EndOfMedia);
- QCOMPARE(statusChangedSpy.count(), 8);
-}
-
-void tst_QDeclarativeAudio::metaData_data()
-{
- QTest::addColumn<QByteArray>("propertyName");
- QTest::addColumn<QtMultimedia::MetaData>("propertyKey");
- QTest::addColumn<QVariant>("value");
-
- QTest::newRow("title")
- << QByteArray("title")
- << QtMultimedia::Title
- << QVariant(QString::fromLatin1("This is a title"));
-
- QTest::newRow("genre")
- << QByteArray("genre")
- << QtMultimedia::Genre
- << QVariant(QString::fromLatin1("rock"));
-
- QTest::newRow("trackNumber")
- << QByteArray("trackNumber")
- << QtMultimedia::TrackNumber
- << QVariant(8);
-}
-
-void tst_QDeclarativeAudio::metaData()
-{
- QFETCH(QByteArray, propertyName);
- QFETCH(QtMultimedia::MetaData, propertyKey);
- QFETCH(QVariant, value);
-
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(audio.metaData(), SIGNAL(metaDataChanged()));
-
- const int index = audio.metaData()->metaObject()->indexOfProperty(propertyName.constData());
- QVERIFY(index != -1);
-
- QMetaProperty property = audio.metaData()->metaObject()->property(index);
- QCOMPARE(property.read(&audio), QVariant());
-
- property.write(audio.metaData(), value);
- QCOMPARE(property.read(audio.metaData()), QVariant());
- QCOMPARE(provider.metaDataControl()->metaData(propertyKey), QVariant());
- QCOMPARE(spy.count(), 0);
-
- provider.metaDataControl()->setMetaData(propertyKey, value);
- QCOMPARE(property.read(audio.metaData()), value);
- QCOMPARE(spy.count(), 1);
-}
-
-void tst_QDeclarativeAudio::error()
-{
- const QString errorString = QLatin1String("Failed to open device.");
-
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy errorSpy(&audio, SIGNAL(error(QDeclarativeAudio::Error,QString)));
- QSignalSpy errorChangedSpy(&audio, SIGNAL(errorChanged()));
-
- QCOMPARE(audio.error(), QDeclarativeAudio::NoError);
- QCOMPARE(audio.errorString(), QString());
-
- provider.playerControl()->emitError(QMediaPlayer::ResourceError, errorString);
-
- QCOMPARE(audio.error(), QDeclarativeAudio::ResourceError);
- QCOMPARE(audio.errorString(), errorString);
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 1);
-
- // Changing the source resets the error properties.
- audio.setSource(QUrl("http://example.com"));
- QCOMPARE(audio.error(), QDeclarativeAudio::NoError);
- QCOMPARE(audio.errorString(), QString());
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 2);
-
- // But isn't noisy.
- audio.setSource(QUrl("file:///file/path"));
- QCOMPARE(audio.error(), QDeclarativeAudio::NoError);
- QCOMPARE(audio.errorString(), QString());
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 2);
-}
-
-void tst_QDeclarativeAudio::loops()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
-
- QSignalSpy loopsChangedSpy(&audio, SIGNAL(loopCountChanged()));
- QSignalSpy playingChangedSpy(&audio, SIGNAL(playingChanged()));
- QSignalSpy stoppedSpy(&audio, SIGNAL(stopped()));
-
- int playingChanged = 0;
- int stopped = 0;
- int loopsChanged = 0;
-
- audio.classBegin();
- audio.componentComplete();
-
- QCOMPARE(audio.isPlaying(), false);
-
- //setLoopCount(3) when stopped.
- audio.setLoopCount(3);
- QCOMPARE(audio.loopCount(), 3);
- QCOMPARE(loopsChangedSpy.count(), ++loopsChanged);
-
- //play till end
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
-
- // setPlaying(true) when playing.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- provider.playerControl()->updateMediaStatus(QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
-
- //play to end
- provider.playerControl()->updateMediaStatus(QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- //play to end
- provider.playerControl()->updateMediaStatus(QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // stop when playing
- audio.play();
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- provider.playerControl()->updateMediaStatus(QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- //setPlaying(true) with infinite loop
- audio.setLoopCount(-1);
- QCOMPARE(audio.loopCount(), -1);
- QCOMPARE(loopsChangedSpy.count(), ++loopsChanged);
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- provider.playerControl()->updateMediaStatus(QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
-
- // play() when playing.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when playing in infinite loop.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-}
-
-QTEST_MAIN(tst_QDeclarativeAudio)
-
-#include "tst_qdeclarativeaudio.moc"
diff --git a/tests/auto/qdeclarativevideo/qdeclarativevideo.pro b/tests/auto/qdeclarativevideo/qdeclarativevideo.pro
deleted file mode 100644
index cd1c615..0000000
--- a/tests/auto/qdeclarativevideo/qdeclarativevideo.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qdeclarativevideo
-
-QT += multimedia-private declarative testlib
-CONFIG += no_private_qt_headers_warning
-
-HEADERS += \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativevideo_p.h \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativemediabase_p.h \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativemediametadata_p.h
-
-SOURCES += \
- tst_qdeclarativevideo.cpp \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativevideo.cpp \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativemediabase.cpp
-
-INCLUDEPATH += $$QT.multimedia.sources/../imports/multimedia
-QT+=widgets
diff --git a/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp b/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp
deleted file mode 100644
index 5a0dce3..0000000
--- a/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp
+++ /dev/null
@@ -1,991 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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=plugins/declarative/multimedia
-
-#include <QtTest/QtTest>
-
-#include "qdeclarativevideo_p.h"
-
-
-#include <qabstractvideosurface.h>
-#include <qgraphicsvideoitem.h>
-#include <qmediaplayercontrol.h>
-#include <qmediaservice.h>
-#include <qmediaserviceprovider.h>
-#include <qvideorenderercontrol.h>
-#include <qvideowindowcontrol.h>
-#include <qvideosurfaceformat.h>
-
-#include <QtWidgets/qapplication.h>
-#include <QtGui/qpainter.h>
-
-class tst_QDeclarativeVideo : public QObject
-{
- Q_OBJECT
-public slots:
- void initTestCase();
-
-private slots:
- void nullPlayerControl();
- void nullService();
-
- void playing();
- void paused();
- void error();
-
- void hasAudio();
- void hasVideo();
- void fillMode();
- void geometry();
-};
-
-Q_DECLARE_METATYPE(QDeclarativeVideo::Error);
-
-class QtTestMediaPlayerControl : public QMediaPlayerControl
-{
- Q_OBJECT
-public:
- QtTestMediaPlayerControl(QObject *parent = 0)
- : QMediaPlayerControl(parent)
- , m_state(QMediaPlayer::StoppedState)
- , m_mediaStatus(QMediaPlayer::NoMedia)
- , m_duration(0)
- , m_position(0)
- , m_playbackRate(1.0)
- , m_volume(50)
- , m_bufferStatus(0)
- , m_muted(false)
- , m_audioAvailable(false)
- , m_videoAvailable(false)
- , m_seekable(false)
- {
- }
-
- QMediaPlayer::State state() const { return m_state; }
- void updateState(QMediaPlayer::State state) { emit stateChanged(m_state = state); }
-
- QMediaPlayer::MediaStatus mediaStatus() const { return m_mediaStatus; }
- void updateMediaStatus(QMediaPlayer::MediaStatus status) {
- emit mediaStatusChanged(m_mediaStatus = status); }
- void updateMediaStatus(QMediaPlayer::MediaStatus status, QMediaPlayer::State state)
- {
- m_mediaStatus = status;
- m_state = state;
-
- emit mediaStatusChanged(m_mediaStatus);
- emit stateChanged(m_state);
- }
-
- qint64 duration() const { return m_duration; }
- void setDuration(qint64 duration) { emit durationChanged(m_duration = duration); }
-
- qint64 position() const { return m_position; }
- void setPosition(qint64 position) { emit positionChanged(m_position = position); }
-
- int volume() const { return m_volume; }
- void setVolume(int volume) { emit volumeChanged(m_volume = volume); }
-
- bool isMuted() const { return m_muted; }
- void setMuted(bool muted) { emit mutedChanged(m_muted = muted); }
-
- int bufferStatus() const { return m_bufferStatus; }
- void setBufferStatus(int status) { emit bufferStatusChanged(m_bufferStatus = status); }
-
- bool isAudioAvailable() const { return m_audioAvailable; }
- void setAudioAvailable(bool available) {
- emit audioAvailableChanged(m_audioAvailable = available); }
- bool isVideoAvailable() const { return m_videoAvailable; }
- void setVideoAvailable(bool available) {
- emit videoAvailableChanged(m_videoAvailable = available); }
-
- bool isSeekable() const { return m_seekable; }
- void setSeekable(bool seekable) { emit seekableChanged(m_seekable = seekable); }
-
- QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); }
-
- qreal playbackRate() const { return m_playbackRate; }
- void setPlaybackRate(qreal rate) { emit playbackRateChanged(m_playbackRate = rate); }
-
- QMediaContent media() const { return m_media; }
- const QIODevice *mediaStream() const { return 0; }
- void setMedia(const QMediaContent &media, QIODevice *)
- {
- m_media = media;
-
- m_mediaStatus = m_media.isNull()
- ? QMediaPlayer::NoMedia
- : QMediaPlayer::LoadingMedia;
-
- emit mediaChanged(m_media);
- emit mediaStatusChanged(m_mediaStatus);
- }
-
- void play() { emit stateChanged(m_state = QMediaPlayer::PlayingState); }
- void pause() { emit stateChanged(m_state = QMediaPlayer::PausedState); }
- void stop() { emit stateChanged(m_state = QMediaPlayer::StoppedState); }
-
- void emitError(QMediaPlayer::Error err, const QString &errorString) {
- emit error(err, errorString); }
-
-private:
- QMediaPlayer::State m_state;
- QMediaPlayer::MediaStatus m_mediaStatus;
- qint64 m_duration;
- qint64 m_position;
- qreal m_playbackRate;
- int m_volume;
- int m_bufferStatus;
- bool m_muted;
- bool m_audioAvailable;
- bool m_videoAvailable;
- bool m_seekable;
- QMediaContent m_media;
-};
-
-class QtTestRendererControl : public QVideoRendererControl
-{
-public:
- QtTestRendererControl(QObject *parent ) : QVideoRendererControl(parent), m_surface(0) {}
-
- QAbstractVideoSurface *surface() const { return m_surface; }
- void setSurface(QAbstractVideoSurface *surface) { m_surface = surface; }
-
-private:
- QAbstractVideoSurface *m_surface;
-};
-
-class QtTestWindowControl : public QVideoWindowControl
-{
-public:
- QtTestWindowControl(QObject *parent)
- : QVideoWindowControl(parent)
- , m_winId(0)
- , m_repaintCount(0)
- , m_brightness(0)
- , m_contrast(0)
- , m_saturation(0)
- , m_aspectRatioMode(Qt::KeepAspectRatio)
- , m_fullScreen(0)
- {
- }
-
- WId winId() const { return m_winId; }
- void setWinId(WId id) { m_winId = id; }
-
- QRect displayRect() const { return m_displayRect; }
- void setDisplayRect(const QRect &rect) { m_displayRect = rect; }
-
- bool isFullScreen() const { return m_fullScreen; }
- void setFullScreen(bool fullScreen) { emit fullScreenChanged(m_fullScreen = fullScreen); }
-
- int repaintCount() const { return m_repaintCount; }
- void setRepaintCount(int count) { m_repaintCount = count; }
- void repaint() { ++m_repaintCount; }
-
- QSize nativeSize() const { return m_nativeSize; }
- void setNativeSize(const QSize &size) { m_nativeSize = size; emit nativeSizeChanged(); }
-
- Qt::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
- void setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; }
-
- int brightness() const { return m_brightness; }
- void setBrightness(int brightness) { emit brightnessChanged(m_brightness = brightness); }
-
- int contrast() const { return m_contrast; }
- void setContrast(int contrast) { emit contrastChanged(m_contrast = contrast); }
-
- int hue() const { return m_hue; }
- void setHue(int hue) { emit hueChanged(m_hue = hue); }
-
- int saturation() const { return m_saturation; }
- void setSaturation(int saturation) { emit saturationChanged(m_saturation = saturation); }
-
-private:
- WId m_winId;
- int m_repaintCount;
- int m_brightness;
- int m_contrast;
- int m_hue;
- int m_saturation;
- Qt::AspectRatioMode m_aspectRatioMode;
- QRect m_displayRect;
- QSize m_nativeSize;
- bool m_fullScreen;
-};
-
-class QtTestMediaService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestMediaService(
- QtTestMediaPlayerControl *playerControl,
- QtTestRendererControl *rendererControl,
- QtTestWindowControl *windowControl,
- QObject *parent)
- : QMediaService(parent)
- , playerControl(playerControl)
- , rendererControl(rendererControl)
- , windowControl(windowControl)
- {
- }
-
- QMediaControl *requestControl(const char *name)
- {
- if (qstrcmp(name, QMediaPlayerControl_iid) == 0)
- return playerControl;
- else if (qstrcmp(name, QVideoRendererControl_iid) == 0)
- return rendererControl;
- else if (qstrcmp(name, QVideoWindowControl_iid) == 0)
- return windowControl;
- else
- return 0;
- }
-
- void releaseControl(QMediaControl *) {}
-
- QtTestMediaPlayerControl *playerControl;
- QtTestRendererControl *rendererControl;
- QtTestWindowControl *windowControl;
-};
-
-class QtTestMediaServiceProvider : public QMediaServiceProvider
-{
- Q_OBJECT
-public:
- QtTestMediaServiceProvider()
- : service(
- new QtTestMediaService(
- new QtTestMediaPlayerControl(this),
- new QtTestRendererControl(this),
- new QtTestWindowControl(this),
- this))
- {
- setDefaultServiceProvider(this);
- }
-
- QtTestMediaServiceProvider(QtTestMediaService *service)
- : service(service)
- {
- setDefaultServiceProvider(this);
- }
-
- QtTestMediaServiceProvider(
- QtTestMediaPlayerControl *playerControl,
- QtTestRendererControl *rendererControl,
- QtTestWindowControl *windowControl)
- : service(new QtTestMediaService(playerControl, rendererControl, windowControl, this))
- {
- setDefaultServiceProvider(this);
- }
-
- ~QtTestMediaServiceProvider()
- {
- setDefaultServiceProvider(0);
- }
-
- QMediaService *requestService(
- const QByteArray &type,
- const QMediaServiceProviderHint & = QMediaServiceProviderHint())
- {
- requestedService = type;
-
- return service;
- }
-
- void releaseService(QMediaService *) {}
-
- inline QtTestMediaPlayerControl *playerControl() { return service->playerControl; }
- inline QtTestRendererControl *rendererControl() { return service->rendererControl; }
-
- QtTestMediaService *service;
- QByteArray requestedService;
-};
-
-
-void tst_QDeclarativeVideo::initTestCase()
-{
- qRegisterMetaType<QDeclarativeVideo::Error>();
-}
-
-void tst_QDeclarativeVideo::nullPlayerControl()
-{
- QtTestMediaServiceProvider provider(0, 0, 0);
-
- QDeclarativeVideo video;
- video.classBegin();
-
- QCOMPARE(video.source(), QUrl());
- video.setSource(QUrl("http://example.com"));
- QCOMPARE(video.source(), QUrl("http://example.com"));
-
- QCOMPARE(video.isPlaying(), false);
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- video.setPlaying(false);
- video.play();
- QCOMPARE(video.isPlaying(), false);
-
- QCOMPARE(video.isPaused(), false);
- video.pause();
- QCOMPARE(video.isPaused(), false);
- video.setPaused(true);
- QCOMPARE(video.isPaused(), true);
-
- QCOMPARE(video.duration(), 0);
-
- QCOMPARE(video.position(), 0);
- video.setPosition(10000);
- QCOMPARE(video.position(), 10000);
-
- QCOMPARE(video.volume(), qreal(1.0));
- video.setVolume(0.5);
- QCOMPARE(video.volume(), qreal(0.5));
-
- QCOMPARE(video.isMuted(), false);
- video.setMuted(true);
- QCOMPARE(video.isMuted(), true);
-
- QCOMPARE(video.bufferProgress(), qreal(0));
-
- QCOMPARE(video.isSeekable(), false);
-
- QCOMPARE(video.playbackRate(), qreal(1.0));
-
- QCOMPARE(video.hasAudio(), false);
- QCOMPARE(video.hasVideo(), false);
-
- QCOMPARE(video.status(), QDeclarativeVideo::NoMedia);
-
- QCOMPARE(video.error(), QDeclarativeVideo::ServiceMissing);
-}
-
-void tst_QDeclarativeVideo::nullService()
-{
- QtTestMediaServiceProvider provider(0);
-
- QDeclarativeVideo video;
- video.classBegin();
-
- QCOMPARE(video.source(), QUrl());
- video.setSource(QUrl("http://example.com"));
- QCOMPARE(video.source(), QUrl("http://example.com"));
-
- QCOMPARE(video.isPlaying(), false);
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- video.setPlaying(false);
- video.play();
- QCOMPARE(video.isPlaying(), false);
-
- QCOMPARE(video.isPaused(), false);
- video.pause();
- QCOMPARE(video.isPaused(), false);
- video.setPaused(true);
- QCOMPARE(video.isPaused(), true);
-
- QCOMPARE(video.duration(), 0);
-
- QCOMPARE(video.position(), 0);
- video.setPosition(10000);
- QCOMPARE(video.position(), 10000);
-
- QCOMPARE(video.volume(), qreal(1.0));
- video.setVolume(0.5);
- QCOMPARE(video.volume(), qreal(0.5));
-
- QCOMPARE(video.isMuted(), false);
- video.setMuted(true);
- QCOMPARE(video.isMuted(), true);
-
- QCOMPARE(video.bufferProgress(), qreal(0));
-
- QCOMPARE(video.isSeekable(), false);
-
- QCOMPARE(video.playbackRate(), qreal(1.0));
-
- QCOMPARE(video.hasAudio(), false);
- QCOMPARE(video.hasVideo(), false);
-
- QCOMPARE(video.status(), QDeclarativeVideo::NoMedia);
-
- QCOMPARE(video.error(), QDeclarativeVideo::ServiceMissing);
-
- QCOMPARE(video.metaObject()->indexOfProperty("title"), -1);
- QCOMPARE(video.metaObject()->indexOfProperty("genre"), -1);
- QCOMPARE(video.metaObject()->indexOfProperty("description"), -1);
-}
-
-void tst_QDeclarativeVideo::playing()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.classBegin();
- video.componentComplete();
- video.setSource(QUrl("http://example.com"));
-
- QSignalSpy playingChangedSpy(&video, SIGNAL(playingChanged()));
- QSignalSpy startedSpy(&video, SIGNAL(started()));
- QSignalSpy stoppedSpy(&video, SIGNAL(stopped()));
-
- int playingChanged = 0;
- int started = 0;
- int stopped = 0;
-
- QCOMPARE(video.isPlaying(), false);
-
- // setPlaying(true) when stopped.
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when playing.
- video.setPlaying(false);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // play() when stopped.
- video.play();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when playing.
- video.stop();
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // stop() when stopped.
- video.stop();
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when stopped.
- video.setPlaying(false);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(true) when playing.
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // play() when playing.
- video.play();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-}
-
-void tst_QDeclarativeVideo::paused()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.classBegin();
- video.componentComplete();
- video.setSource(QUrl("http://example.com"));
-
- QSignalSpy playingChangedSpy(&video, SIGNAL(playingChanged()));
- QSignalSpy pausedChangedSpy(&video, SIGNAL(pausedChanged()));
- QSignalSpy startedSpy(&video, SIGNAL(started()));
- QSignalSpy pausedSpy(&video, SIGNAL(paused()));
- QSignalSpy resumedSpy(&video, SIGNAL(resumed()));
- QSignalSpy stoppedSpy(&video, SIGNAL(stopped()));
-
- int playingChanged = 0;
- int pausedChanged = 0;
- int started = 0;
- int paused = 0;
- int resumed = 0;
- int stopped = 0;
-
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), false);
-
- // setPlaying(true) when stopped.
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when playing.
- video.setPaused(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when paused.
- video.setPaused(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when paused.
- video.pause();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when paused.
- video.setPaused(false);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), ++resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when playing.
- video.setPaused(false);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when playing.
- video.pause();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- video.setPlaying(false);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // setPaused(true) when stopped and paused.
- video.setPaused(true);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when stopped and paused.
- video.setPaused(false);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when stopped.
- video.setPaused(true);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(true) when stopped and paused.
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // play() when paused.
- video.play();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), ++resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when playing.
- video.setPaused(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when paused.
- video.stop();
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // setPaused(true) when stopped.
- video.setPaused(true);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when stopped and paused.
- video.stop();
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when stopped.
- video.pause();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- video.setPlaying(false);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // pause() when stopped and paused.
- video.pause();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- video.setPlaying(false);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // play() when stopped and paused.
- video.play();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-}
-
-void tst_QDeclarativeVideo::error()
-{
- const QString errorString = QLatin1String("Failed to open device.");
-
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.classBegin();
- video.componentComplete();
-
- QSignalSpy errorSpy(&video, SIGNAL(error(QDeclarativeVideo::Error,QString)));
- QSignalSpy errorChangedSpy(&video, SIGNAL(errorChanged()));
-
- QCOMPARE(video.error(), QDeclarativeVideo::NoError);
- QCOMPARE(video.errorString(), QString());
-
- provider.playerControl()->emitError(QMediaPlayer::ResourceError, errorString);
-
- QCOMPARE(video.error(), QDeclarativeVideo::ResourceError);
- QCOMPARE(video.errorString(), errorString);
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 1);
-
- // Changing the source resets the error properties.
- video.setSource(QUrl("http://example.com"));
- QCOMPARE(video.error(), QDeclarativeVideo::NoError);
- QCOMPARE(video.errorString(), QString());
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 2);
-
- // But isn't noisy.
- video.setSource(QUrl("file:///file/path"));
- QCOMPARE(video.error(), QDeclarativeVideo::NoError);
- QCOMPARE(video.errorString(), QString());
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 2);
-}
-
-
-void tst_QDeclarativeVideo::hasAudio()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.classBegin();
- video.componentComplete();
-
- QSignalSpy spy(&video, SIGNAL(hasAudioChanged()));
-
- QCOMPARE(video.hasAudio(), false);
-
- provider.playerControl()->setAudioAvailable(true);
- QCOMPARE(video.hasAudio(), true);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setAudioAvailable(true);
- QCOMPARE(video.hasAudio(), true);
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setAudioAvailable(false);
- QCOMPARE(video.hasAudio(), false);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeVideo::hasVideo()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.classBegin();
- video.componentComplete();
-
- QSignalSpy spy(&video, SIGNAL(hasVideoChanged()));
-
- QCOMPARE(video.hasVideo(), false);
-
- provider.playerControl()->setVideoAvailable(true);
- QCOMPARE(video.hasVideo(), true);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setVideoAvailable(true);
- QCOMPARE(video.hasVideo(), true);
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setVideoAvailable(false);
- QCOMPARE(video.hasVideo(), false);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeVideo::fillMode()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.classBegin();
- video.componentComplete();
-
- QList<QGraphicsItem *> children = video.childItems();
- QCOMPARE(children.count(), 1);
- QGraphicsVideoItem *videoItem = qgraphicsitem_cast<QGraphicsVideoItem *>(children.first());
- QVERIFY(videoItem != 0);
-
- QCOMPARE(video.fillMode(), QDeclarativeVideo::PreserveAspectFit);
-
- video.setFillMode(QDeclarativeVideo::PreserveAspectCrop);
- QCOMPARE(video.fillMode(), QDeclarativeVideo::PreserveAspectCrop);
- QCOMPARE(videoItem->aspectRatioMode(), Qt::KeepAspectRatioByExpanding);
-
- video.setFillMode(QDeclarativeVideo::Stretch);
- QCOMPARE(video.fillMode(), QDeclarativeVideo::Stretch);
- QCOMPARE(videoItem->aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- video.setFillMode(QDeclarativeVideo::PreserveAspectFit);
- QCOMPARE(video.fillMode(), QDeclarativeVideo::PreserveAspectFit);
- QCOMPARE(videoItem->aspectRatioMode(), Qt::KeepAspectRatio);
-}
-
-void tst_QDeclarativeVideo::geometry()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.classBegin();
- video.componentComplete();
-
- QList<QGraphicsItem *> children = video.childItems();
- QCOMPARE(children.count(), 1);
- QGraphicsVideoItem *videoItem = qgraphicsitem_cast<QGraphicsVideoItem *>(children.first());
- QVERIFY(videoItem != 0);
-
- { // Surface setup is deferred until after the first paint.
- QImage image(320, 240, QImage::Format_RGB32);
- QPainter painter(&image);
-
- videoItem->paint(&painter, 0);
- }
-
- QAbstractVideoSurface *surface = provider.rendererControl()->surface();
-
- //video item can use overlay, QAbstractVideoSurface is not used than.
- if (surface) {
- QVideoSurfaceFormat format(QSize(640, 480), QVideoFrame::Format_RGB32);
-
- QVERIFY(surface->start(format));
- QCoreApplication::processEvents();
-
- QCOMPARE(video.implicitWidth(), qreal(640));
- QCOMPARE(video.implicitHeight(), qreal(480));
- }
-
- video.setWidth(560);
- video.setHeight(328);
-
- QCOMPARE(videoItem->size().width(), qreal(560));
- QCOMPARE(videoItem->size().height(), qreal(328));
-}
-
-QTEST_MAIN(tst_QDeclarativeVideo)
-
-#include "tst_qdeclarativevideo.moc"
diff --git a/tests/auto/qgraphicsvideoitem/qgraphicsvideoitem.pro b/tests/auto/qgraphicsvideoitem/qgraphicsvideoitem.pro
deleted file mode 100644
index d3514cf..0000000
--- a/tests/auto/qgraphicsvideoitem/qgraphicsvideoitem.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qgraphicsvideoitem
-
-QT += multimedia-private multimediawidgets-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qgraphicsvideoitem.cpp
-
-# QPA minimal crashes with this test in QBackingStore
-qpa:CONFIG += insignificant_test
-QT+=widgets
diff --git a/tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp b/tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp
deleted file mode 100644
index 393ac7a..0000000
--- a/tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp
+++ /dev/null
@@ -1,675 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <qtmultimediadefs.h>
-#include "qgraphicsvideoitem.h"
-#include <QtTest/QtTest>
-#include "qmediaobject.h"
-#include "qmediaservice.h"
-#include <private/qpaintervideosurface_p.h>
-#include "qvideorenderercontrol.h"
-
-#include <qabstractvideosurface.h>
-#include <qvideosurfaceformat.h>
-
-#include <QtWidgets/qapplication.h>
-#include <QtWidgets/qgraphicsscene.h>
-#include <QtWidgets/qgraphicsview.h>
-
-QT_USE_NAMESPACE
-class tst_QGraphicsVideoItem : public QObject
-{
- Q_OBJECT
-public slots:
- void initTestCase();
-
-private slots:
- void nullObject();
- void nullService();
- void noOutputs();
- void serviceDestroyed();
- void mediaObjectDestroyed();
- void setMediaObject();
-
- void show();
-
- void aspectRatioMode();
- void offset();
- void size();
- void nativeSize_data();
- void nativeSize();
-
- void boundingRect_data();
- void boundingRect();
-
- void paint();
-};
-
-Q_DECLARE_METATYPE(const uchar *)
-Q_DECLARE_METATYPE(Qt::AspectRatioMode)
-
-class QtTestRendererControl : public QVideoRendererControl
-{
-public:
- QtTestRendererControl()
- : m_surface(0)
- {
- }
-
- QAbstractVideoSurface *surface() const { return m_surface; }
- void setSurface(QAbstractVideoSurface *surface) { m_surface = surface; }
-
-private:
- QAbstractVideoSurface *m_surface;
-};
-
-class QtTestVideoService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestVideoService(
- QtTestRendererControl *renderer)
- : QMediaService(0)
- , rendererRef(0)
- , rendererControl(renderer)
- {
- }
-
- ~QtTestVideoService()
- {
- delete rendererControl;
- }
-
- QMediaControl *requestControl(const char *name)
- {
- if (qstrcmp(name, QVideoRendererControl_iid) == 0 && rendererControl) {
- rendererRef += 1;
-
- return rendererControl;
- } else {
- return 0;
- }
- }
-
- void releaseControl(QMediaControl *control)
- {
- Q_ASSERT(control);
-
- if (control == rendererControl) {
- rendererRef -= 1;
-
- if (rendererRef == 0)
- rendererControl->setSurface(0);
- }
- }
-
- int rendererRef;
- QtTestRendererControl *rendererControl;
-};
-
-class QtTestVideoObject : public QMediaObject
-{
- Q_OBJECT
-public:
- QtTestVideoObject(QtTestRendererControl *renderer)
- : QMediaObject(0, new QtTestVideoService(renderer))
- {
- testService = qobject_cast<QtTestVideoService*>(service());
- }
-
- QtTestVideoObject(QtTestVideoService *service):
- QMediaObject(0, service),
- testService(service)
- {
- }
-
- ~QtTestVideoObject()
- {
- delete testService;
- }
-
- QtTestVideoService *testService;
-};
-
-class QtTestGraphicsVideoItem : public QGraphicsVideoItem
-{
-public:
- QtTestGraphicsVideoItem(QGraphicsItem *parent = 0)
- : QGraphicsVideoItem(parent)
- , m_paintCount(0)
- {
- }
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
- {
- ++m_paintCount;
-
- QTestEventLoop::instance().exitLoop();
-
- QGraphicsVideoItem::paint(painter, option, widget);
- }
-
- bool waitForPaint(int secs)
- {
- const int paintCount = m_paintCount;
-
- QTestEventLoop::instance().enterLoop(secs);
-
- return m_paintCount != paintCount;
- }
-
- int paintCount() const
- {
- return m_paintCount;
- }
-
-private:
- int m_paintCount;
-};
-
-void tst_QGraphicsVideoItem::initTestCase()
-{
- qRegisterMetaType<Qt::AspectRatioMode>();
-}
-
-void tst_QGraphicsVideoItem::nullObject()
-{
- QGraphicsVideoItem item(0);
-
- QVERIFY(item.boundingRect().isEmpty());
-}
-
-void tst_QGraphicsVideoItem::nullService()
-{
- QtTestVideoService *service = 0;
-
- QtTestVideoObject object(service);
-
- QtTestGraphicsVideoItem *item = new QtTestGraphicsVideoItem;
- object.bind(item);
-
- QVERIFY(item->boundingRect().isEmpty());
-
- item->hide();
- item->show();
-
- QGraphicsScene graphicsScene;
- graphicsScene.addItem(item);
- QGraphicsView graphicsView(&graphicsScene);
- graphicsView.show();
-}
-
-void tst_QGraphicsVideoItem::noOutputs()
-{
- QtTestRendererControl *control = 0;
- QtTestVideoObject object(control);
-
- QtTestGraphicsVideoItem *item = new QtTestGraphicsVideoItem;
- object.bind(item);
-
- QVERIFY(item->boundingRect().isEmpty());
-
- item->hide();
- item->show();
-
- QGraphicsScene graphicsScene;
- graphicsScene.addItem(item);
- QGraphicsView graphicsView(&graphicsScene);
- graphicsView.show();
-}
-
-void tst_QGraphicsVideoItem::serviceDestroyed()
-{
- QtTestVideoObject object(new QtTestRendererControl);
-
- QGraphicsVideoItem item;
- object.bind(&item);
-
- QCOMPARE(object.testService->rendererRef, 1);
-
- QtTestVideoService *service = object.testService;
- object.testService = 0;
-
- delete service;
-
- QCOMPARE(item.mediaObject(), static_cast<QMediaObject *>(&object));
- QVERIFY(item.boundingRect().isEmpty());
-}
-
-void tst_QGraphicsVideoItem::mediaObjectDestroyed()
-{
- QtTestVideoObject *object = new QtTestVideoObject(new QtTestRendererControl);
-
- QGraphicsVideoItem item;
- object->bind(&item);
-
- QCOMPARE(object->testService->rendererRef, 1);
-
- delete object;
- object = 0;
-
- QCOMPARE(item.mediaObject(), static_cast<QMediaObject *>(object));
- QVERIFY(item.boundingRect().isEmpty());
-}
-
-void tst_QGraphicsVideoItem::setMediaObject()
-{
- QMediaObject *nullObject = 0;
- QtTestVideoObject object(new QtTestRendererControl);
-
- QGraphicsVideoItem item;
-
- QCOMPARE(item.mediaObject(), nullObject);
- QCOMPARE(object.testService->rendererRef, 0);
-
- object.bind(&item);
- QCOMPARE(item.mediaObject(), static_cast<QMediaObject *>(&object));
- QCOMPARE(object.testService->rendererRef, 1);
- QVERIFY(object.testService->rendererControl->surface() == 0);
-
- { // Surface setup is deferred until after the first paint.
- QImage image(320, 240, QImage::Format_RGB32);
- QPainter painter(&image);
-
- item.paint(&painter, 0);
- }
- QVERIFY(object.testService->rendererControl->surface() != 0);
-
- object.unbind(&item);
- QCOMPARE(item.mediaObject(), nullObject);
-
- QCOMPARE(object.testService->rendererRef, 0);
- QVERIFY(object.testService->rendererControl->surface() == 0);
-
- item.setVisible(false);
-
- object.bind(&item);
- QCOMPARE(item.mediaObject(), static_cast<QMediaObject *>(&object));
- QCOMPARE(object.testService->rendererRef, 1);
- QVERIFY(object.testService->rendererControl->surface() != 0);
-}
-
-void tst_QGraphicsVideoItem::show()
-{
- QtTestVideoObject object(new QtTestRendererControl);
- QtTestGraphicsVideoItem *item = new QtTestGraphicsVideoItem;
- object.bind(item);
-
- // Graphics items are visible by default
- QCOMPARE(object.testService->rendererRef, 1);
- QVERIFY(object.testService->rendererControl->surface() == 0);
-
- item->hide();
- QCOMPARE(object.testService->rendererRef, 1);
-
- item->show();
- QCOMPARE(object.testService->rendererRef, 1);
- QVERIFY(object.testService->rendererControl->surface() == 0);
-
- QGraphicsScene graphicsScene;
- graphicsScene.addItem(item);
- QGraphicsView graphicsView(&graphicsScene);
- graphicsView.show();
-
- QVERIFY(item->paintCount() || item->waitForPaint(1));
- QVERIFY(object.testService->rendererControl->surface() != 0);
-
- QVERIFY(item->boundingRect().isEmpty());
-
- QVideoSurfaceFormat format(QSize(320,240),QVideoFrame::Format_RGB32);
- QVERIFY(object.testService->rendererControl->surface()->start(format));
-
- QCoreApplication::processEvents();
- QVERIFY(!item->boundingRect().isEmpty());
-}
-
-void tst_QGraphicsVideoItem::aspectRatioMode()
-{
- QGraphicsVideoItem item;
-
- QCOMPARE(item.aspectRatioMode(), Qt::KeepAspectRatio);
-
- item.setAspectRatioMode(Qt::IgnoreAspectRatio);
- QCOMPARE(item.aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- item.setAspectRatioMode(Qt::KeepAspectRatioByExpanding);
- QCOMPARE(item.aspectRatioMode(), Qt::KeepAspectRatioByExpanding);
-
- item.setAspectRatioMode(Qt::KeepAspectRatio);
- QCOMPARE(item.aspectRatioMode(), Qt::KeepAspectRatio);
-}
-
-void tst_QGraphicsVideoItem::offset()
-{
- QGraphicsVideoItem item;
-
- QCOMPARE(item.offset(), QPointF(0, 0));
-
- item.setOffset(QPointF(-32.4, 43.0));
- QCOMPARE(item.offset(), QPointF(-32.4, 43.0));
-
- item.setOffset(QPointF(1, 1));
- QCOMPARE(item.offset(), QPointF(1, 1));
-
- item.setOffset(QPointF(12, -30.4));
- QCOMPARE(item.offset(), QPointF(12, -30.4));
-
- item.setOffset(QPointF(-90.4, -75));
- QCOMPARE(item.offset(), QPointF(-90.4, -75));
-}
-
-void tst_QGraphicsVideoItem::size()
-{
- QGraphicsVideoItem item;
-
- QCOMPARE(item.size(), QSizeF(320, 240));
-
- item.setSize(QSizeF(542.5, 436.3));
- QCOMPARE(item.size(), QSizeF(542.5, 436.3));
-
- item.setSize(QSizeF(-43, 12));
- QCOMPARE(item.size(), QSizeF(0, 0));
-
- item.setSize(QSizeF(54, -9));
- QCOMPARE(item.size(), QSizeF(0, 0));
-
- item.setSize(QSizeF(-90, -65));
- QCOMPARE(item.size(), QSizeF(0, 0));
-
- item.setSize(QSizeF(1000, 1000));
- QCOMPARE(item.size(), QSizeF(1000, 1000));
-}
-
-void tst_QGraphicsVideoItem::nativeSize_data()
-{
- QTest::addColumn<QSize>("frameSize");
- QTest::addColumn<QRect>("viewport");
- QTest::addColumn<QSize>("pixelAspectRatio");
- QTest::addColumn<QSizeF>("nativeSize");
-
- QTest::newRow("640x480")
- << QSize(640, 480)
- << QRect(0, 0, 640, 480)
- << QSize(1, 1)
- << QSizeF(640, 480);
-
- QTest::newRow("800x600, (80,60, 640x480) viewport")
- << QSize(800, 600)
- << QRect(80, 60, 640, 480)
- << QSize(1, 1)
- << QSizeF(640, 480);
-
- QTest::newRow("800x600, (80,60, 640x480) viewport, 4:3")
- << QSize(800, 600)
- << QRect(80, 60, 640, 480)
- << QSize(4, 3)
- << QSizeF(853, 480);
-}
-
-void tst_QGraphicsVideoItem::nativeSize()
-{
- QFETCH(QSize, frameSize);
- QFETCH(QRect, viewport);
- QFETCH(QSize, pixelAspectRatio);
- QFETCH(QSizeF, nativeSize);
-
- QtTestVideoObject object(new QtTestRendererControl);
- QGraphicsVideoItem item;
- object.bind(&item);
-
- QCOMPARE(item.nativeSize(), QSizeF());
-
- QSignalSpy spy(&item, SIGNAL(nativeSizeChanged(QSizeF)));
-
- QVideoSurfaceFormat format(frameSize, QVideoFrame::Format_ARGB32);
- format.setViewport(viewport);
- format.setPixelAspectRatio(pixelAspectRatio);
-
- { // Surface setup is deferred until after the first paint.
- QImage image(320, 240, QImage::Format_RGB32);
- QPainter painter(&image);
-
- item.paint(&painter, 0);
- }
- QVERIFY(object.testService->rendererControl->surface() != 0);
- QVERIFY(object.testService->rendererControl->surface()->start(format));
-
- QCoreApplication::processEvents();
- QCOMPARE(item.nativeSize(), nativeSize);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.last().first().toSizeF(), nativeSize);
-
- object.testService->rendererControl->surface()->stop();
-
- QCoreApplication::processEvents();
- QVERIFY(item.nativeSize().isEmpty());
- QCOMPARE(spy.count(), 2);
- QVERIFY(spy.last().first().toSizeF().isEmpty());
-}
-
-void tst_QGraphicsVideoItem::boundingRect_data()
-{
- QTest::addColumn<QSize>("frameSize");
- QTest::addColumn<QPointF>("offset");
- QTest::addColumn<QSizeF>("size");
- QTest::addColumn<Qt::AspectRatioMode>("aspectRatioMode");
- QTest::addColumn<QRectF>("expectedRect");
-
-
- QTest::newRow("640x480: (0,0 640x480), Keep")
- << QSize(640, 480)
- << QPointF(0, 0)
- << QSizeF(640, 480)
- << Qt::KeepAspectRatio
- << QRectF(0, 0, 640, 480);
-
- QTest::newRow("800x600, (0,0, 640x480), Keep")
- << QSize(800, 600)
- << QPointF(0, 0)
- << QSizeF(640, 480)
- << Qt::KeepAspectRatio
- << QRectF(0, 0, 640, 480);
-
- QTest::newRow("800x600, (0,0, 640x480), KeepByExpanding")
- << QSize(800, 600)
- << QPointF(0, 0)
- << QSizeF(640, 480)
- << Qt::KeepAspectRatioByExpanding
- << QRectF(0, 0, 640, 480);
-
- QTest::newRow("800x600, (0,0, 640x480), Ignore")
- << QSize(800, 600)
- << QPointF(0, 0)
- << QSizeF(640, 480)
- << Qt::IgnoreAspectRatio
- << QRectF(0, 0, 640, 480);
-
- QTest::newRow("800x600, (100,100, 640x480), Keep")
- << QSize(800, 600)
- << QPointF(100, 100)
- << QSizeF(640, 480)
- << Qt::KeepAspectRatio
- << QRectF(100, 100, 640, 480);
-
- QTest::newRow("800x600, (100,-100, 640x480), KeepByExpanding")
- << QSize(800, 600)
- << QPointF(100, -100)
- << QSizeF(640, 480)
- << Qt::KeepAspectRatioByExpanding
- << QRectF(100, -100, 640, 480);
-
- QTest::newRow("800x600, (-100,-100, 640x480), Ignore")
- << QSize(800, 600)
- << QPointF(-100, -100)
- << QSizeF(640, 480)
- << Qt::IgnoreAspectRatio
- << QRectF(-100, -100, 640, 480);
-
- QTest::newRow("800x600, (0,0, 1920x1024), Keep")
- << QSize(800, 600)
- << QPointF(0, 0)
- << QSizeF(1920, 1024)
- << Qt::KeepAspectRatio
- << QRectF(832.0 / 3, 0, 4096.0 / 3, 1024);
-
- QTest::newRow("800x600, (0,0, 1920x1024), KeepByExpanding")
- << QSize(800, 600)
- << QPointF(0, 0)
- << QSizeF(1920, 1024)
- << Qt::KeepAspectRatioByExpanding
- << QRectF(0, 0, 1920, 1024);
-
- QTest::newRow("800x600, (0,0, 1920x1024), Ignore")
- << QSize(800, 600)
- << QPointF(0, 0)
- << QSizeF(1920, 1024)
- << Qt::IgnoreAspectRatio
- << QRectF(0, 0, 1920, 1024);
-
- QTest::newRow("800x600, (100,100, 1920x1024), Keep")
- << QSize(800, 600)
- << QPointF(100, 100)
- << QSizeF(1920, 1024)
- << Qt::KeepAspectRatio
- << QRectF(100 + 832.0 / 3, 100, 4096.0 / 3, 1024);
-
- QTest::newRow("800x600, (100,-100, 1920x1024), KeepByExpanding")
- << QSize(800, 600)
- << QPointF(100, -100)
- << QSizeF(1920, 1024)
- << Qt::KeepAspectRatioByExpanding
- << QRectF(100, -100, 1920, 1024);
-
- QTest::newRow("800x600, (-100,-100, 1920x1024), Ignore")
- << QSize(800, 600)
- << QPointF(-100, -100)
- << QSizeF(1920, 1024)
- << Qt::IgnoreAspectRatio
- << QRectF(-100, -100, 1920, 1024);
-}
-
-void tst_QGraphicsVideoItem::boundingRect()
-{
- QFETCH(QSize, frameSize);
- QFETCH(QPointF, offset);
- QFETCH(QSizeF, size);
- QFETCH(Qt::AspectRatioMode, aspectRatioMode);
- QFETCH(QRectF, expectedRect);
-
- QtTestVideoObject object(new QtTestRendererControl);
- QGraphicsVideoItem item;
- object.bind(&item);
-
- item.setOffset(offset);
- item.setSize(size);
- item.setAspectRatioMode(aspectRatioMode);
-
- QVideoSurfaceFormat format(frameSize, QVideoFrame::Format_ARGB32);
-
- { // Surface setup is deferred until after the first paint.
- QImage image(320, 240, QImage::Format_RGB32);
- QPainter painter(&image);
-
- item.paint(&painter, 0);
- }
- QVERIFY(object.testService->rendererControl->surface() != 0);
- QVERIFY(object.testService->rendererControl->surface()->start(format));
-
- QCoreApplication::processEvents();
- QCOMPARE(item.boundingRect(), expectedRect);
-}
-
-static const uchar rgb32ImageData[] =
-{
- 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00,
- 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00
-};
-
-void tst_QGraphicsVideoItem::paint()
-{
- QtTestVideoObject object(new QtTestRendererControl);
- QtTestGraphicsVideoItem *item = new QtTestGraphicsVideoItem;
- object.bind(item);
-
- QGraphicsScene graphicsScene;
- graphicsScene.addItem(item);
- QGraphicsView graphicsView(&graphicsScene);
- graphicsView.show();
- QVERIFY(item->waitForPaint(1));
-
- QPainterVideoSurface *surface = qobject_cast<QPainterVideoSurface *>(
- object.testService->rendererControl->surface());
- if (!surface)
- QSKIP("QGraphicsVideoItem is not QPainterVideoSurface based", SkipAll);
-
- QVideoSurfaceFormat format(QSize(2, 2), QVideoFrame::Format_RGB32);
-
- QVERIFY(surface->start(format));
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), true);
-
- QVERIFY(item->waitForPaint(1));
-
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), true);
-
- QVideoFrame frame(sizeof(rgb32ImageData), QSize(2, 2), 8, QVideoFrame::Format_RGB32);
-
- frame.map(QAbstractVideoBuffer::WriteOnly);
- memcpy(frame.bits(), rgb32ImageData, frame.mappedBytes());
- frame.unmap();
-
- QVERIFY(surface->present(frame));
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), false);
-
- QVERIFY(item->waitForPaint(1));
-
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), true);
-}
-
-
-QTEST_MAIN(tst_QGraphicsVideoItem)
-
-#include "tst_qgraphicsvideoitem.moc"
diff --git a/tests/auto/qmediabindableinterface/qmediabindableinterface.pro b/tests/auto/qmediabindableinterface/qmediabindableinterface.pro
deleted file mode 100644
index 366a4e6..0000000
--- a/tests/auto/qmediabindableinterface/qmediabindableinterface.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediabindableinterface
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += \
- tst_qmediabindableinterface.cpp
-
-include (../qmultimedia_common/mock.pri)
-include (../qmultimedia_common/mockrecorder.pri)
diff --git a/tests/auto/qmediabindableinterface/tst_qmediabindableinterface.cpp b/tests/auto/qmediabindableinterface/tst_qmediabindableinterface.cpp
deleted file mode 100644
index d7f06db..0000000
--- a/tests/auto/qmediabindableinterface/tst_qmediabindableinterface.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include <qmediaobject.h>
-#include <qmediacontrol.h>
-#include <qmediaservice.h>
-#include <qmediarecordercontrol.h>
-#include <qmediarecorder.h>
-#include <qmetadatawritercontrol.h>
-#include <qaudioendpointselector.h>
-#include <qaudioencodercontrol.h>
-#include <qmediacontainercontrol.h>
-#include <qvideoencodercontrol.h>
-#include <qaudioformat.h>
-
-#include "mockmediacontainercontrol.h"
-#include "mockmetadatawritercontrol.h"
-#include "mockmediarecordercontrol.h"
-#include "mockmediaobject.h"
-
-QT_USE_NAMESPACE
-
-class TestBindableService : public QMediaService
-{
- Q_OBJECT
-public:
- TestBindableService(QObject *parent, QMediaControl *control):
- QMediaService(parent),
- mockControl(control),
- hasControls(true)
- {
- mockContainerControl = new MockMediaContainerControl(parent); //Creating the object for Media
- mockMetaDataControl = new MockMetaDataWriterControl(parent); //Creating the object for MetaData
- }
-
- QMediaControl* requestControl(const char *name)
- {
- if (hasControls && qstrcmp(name,QMediaRecorderControl_iid) == 0)
- return mockControl;
- if (hasControls && qstrcmp(name,QMediaContainerControl_iid) == 0)
- return mockContainerControl;
- if (hasControls && qstrcmp(name, QMetaDataWriterControl_iid) == 0)
- return mockMetaDataControl;
-
- return 0;
- }
-
- void releaseControl(QMediaControl*) {}
- //Initialising the objects for the media
- QMediaControl *mockControl;
- QMediaContainerControl *mockContainerControl;
- MockMetaDataWriterControl *mockMetaDataControl;
- bool hasControls;
-};
-
-class tst_QMediaBindableInterface:public QObject
-{
- Q_OBJECT
-private slots:
- void init()
- {
-
- }
-
- void cleanup()
- {
-
- }
-
- void testMediaObject() //Verifying the mediaobject api
- {
- MockMediaRecorderControl recorderControl(0);
- TestBindableService service(0, &recorderControl);
- service.mockMetaDataControl->populateMetaData();
- MockMediaObject object(0, &service);
- QMediaRecorder recorder(&object);
- QMediaObject *obj = recorder.mediaObject();
- QVERIFY(obj != NULL);
- QVERIFY(obj->isAvailable());
- }
-
- void testDestructor() //Invoking the destructor
- {
- MockMediaRecorderControl recorderControl(0);
- TestBindableService service(0, &recorderControl);
- service.mockMetaDataControl->populateMetaData();
- MockMediaObject object(0, &service);
- QMediaRecorder *recorder = new QMediaRecorder(&object);
- QVERIFY(recorder->isAvailable());
- delete recorder;
- recorder = NULL;
- }
-};
-
-QTEST_MAIN(tst_QMediaBindableInterface)
-#include "tst_qmediabindableinterface.moc"
diff --git a/tests/auto/qmediacontainercontrol/qmediacontainercontrol.pro b/tests/auto/qmediacontainercontrol/qmediacontainercontrol.pro
deleted file mode 100644
index 90dcbf8..0000000
--- a/tests/auto/qmediacontainercontrol/qmediacontainercontrol.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediacontainercontrol
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qmediacontainercontrol.cpp
-
-include (../qmultimedia_common/mockcontainer.pri)
-
diff --git a/tests/auto/qmediacontainercontrol/tst_qmediacontainercontrol.cpp b/tests/auto/qmediacontainercontrol/tst_qmediacontainercontrol.cpp
deleted file mode 100644
index e5dabd1..0000000
--- a/tests/auto/qmediacontainercontrol/tst_qmediacontainercontrol.cpp
+++ /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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include "qmediacontainercontrol.h"
-#include "qmediarecorder.h"
-
-#include "../qmultimedia_common/mockmediacontainercontrol.h"
-
-//MaemoAPI-
-class tst_QMediaContainerControl :public QObject
-{
- Q_OBJECT
-
-private slots:
- //to test the constructor
- void tst_mediacontainercontrol()
- {
-
- QObject obj;
- MockMediaContainerControl control(&obj);
- QStringList strlist=control.supportedContainers();
- QStringList strlist1;
- strlist1 << "wav" << "mp3" << "mov";
- QVERIFY(strlist[0]==strlist1[0]); //checking with "wav" mime type
- QVERIFY(strlist[1]==strlist1[1]); //checking with "mp3" mime type
- QVERIFY(strlist[2]==strlist1[2]); //checking with "mov" mime type
-
- control.setContainerMimeType("wav");
- const QString str("wav");
- QVERIFY2(control.containerMimeType() == str,"Failed");
-
- const QString str1("WAV format");
- QVERIFY2(control.containerDescription("wav") == str1,"FAILED");
- }
-};
-
-QTEST_MAIN(tst_QMediaContainerControl);
-#include "tst_qmediacontainercontrol.moc"
diff --git a/tests/auto/qmediacontent/qmediacontent.pro b/tests/auto/qmediacontent/qmediacontent.pro
deleted file mode 100644
index d55218d..0000000
--- a/tests/auto/qmediacontent/qmediacontent.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediacontent
-
-QT += multimedia-private network testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qmediacontent.cpp
diff --git a/tests/auto/qmediacontent/tst_qmediacontent.cpp b/tests/auto/qmediacontent/tst_qmediacontent.cpp
deleted file mode 100644
index a215b47..0000000
--- a/tests/auto/qmediacontent/tst_qmediacontent.cpp
+++ /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$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtNetwork/qnetworkrequest.h>
-
-#include <qmediacontent.h>
-
-//TESTED_COMPONENT=src/multimedia
-
-QT_USE_NAMESPACE
-class tst_QMediaContent : public QObject
-{
- Q_OBJECT
-
-private slots:
- void testNull();
- void testUrlCtor();
- void testRequestCtor();
- void testResourceCtor();
- void testResourceListCtor();
- void testCopy();
- void testAssignment();
- void testEquality();
- void testResources();
-};
-
-void tst_QMediaContent::testNull()
-{
- QMediaContent media;
-
- QCOMPARE(media.isNull(), true);
- QCOMPARE(media.canonicalUrl(), QUrl());
- QCOMPARE(media.canonicalResource(), QMediaResource());
- QCOMPARE(media.resources(), QMediaResourceList());
-}
-
-void tst_QMediaContent::testUrlCtor()
-{
- QMediaContent media(QUrl("http://example.com/movie.mov"));
-
- QCOMPARE(media.canonicalUrl(), QUrl("http://example.com/movie.mov"));
- QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov"));
-}
-
-void tst_QMediaContent::testRequestCtor()
-{
- QNetworkRequest request(QUrl("http://example.com/movie.mov"));
- request.setAttribute(QNetworkRequest::User, QVariant(1234));
-
- QMediaContent media(request);
-
- QCOMPARE(media.canonicalUrl(), QUrl("http://example.com/movie.mov"));
- QCOMPARE(media.canonicalRequest(),request);
- QCOMPARE(media.canonicalResource().request(), request);
- QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov"));
-}
-
-void tst_QMediaContent::testResourceCtor()
-{
- QMediaContent media(QMediaResource(QUrl("http://example.com/movie.mov")));
-
- QCOMPARE(media.canonicalResource(), QMediaResource(QUrl("http://example.com/movie.mov")));
-}
-
-void tst_QMediaContent::testResourceListCtor()
-{
- QMediaResourceList resourceList;
- resourceList << QMediaResource(QUrl("http://example.com/movie.mov"));
-
- QMediaContent media(resourceList);
-
- QCOMPARE(media.canonicalUrl(), QUrl("http://example.com/movie.mov"));
- QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov"));
-}
-
-void tst_QMediaContent::testCopy()
-{
- QMediaContent media1(QMediaResource(QUrl("http://example.com/movie.mov")));
- QMediaContent media2(media1);
-
- QVERIFY(media1 == media2);
-}
-
-void tst_QMediaContent::testAssignment()
-{
- QMediaContent media1(QMediaResource(QUrl("http://example.com/movie.mov")));
- QMediaContent media2;
- QMediaContent media3;
-
- media2 = media1;
- QVERIFY(media2 == media1);
-
- media2 = media3;
- QVERIFY(media2 == media3);
-}
-
-void tst_QMediaContent::testEquality()
-{
- QMediaContent media1;
- QMediaContent media2;
- QMediaContent media3(QMediaResource(QUrl("http://example.com/movie.mov")));
- QMediaContent media4(QMediaResource(QUrl("http://example.com/movie.mov")));
- QMediaContent media5(QMediaResource(QUrl("file:///some/where/over/the/rainbow.mp3")));
-
- // null == null
- QCOMPARE(media1 == media2, true);
- QCOMPARE(media1 != media2, false);
-
- // null != something
- QCOMPARE(media1 == media3, false);
- QCOMPARE(media1 != media3, true);
-
- // equiv
- QCOMPARE(media3 == media4, true);
- QCOMPARE(media3 != media4, false);
-
- // not equiv
- QCOMPARE(media4 == media5, false);
- QCOMPARE(media4 != media5, true);
-}
-
-void tst_QMediaContent::testResources()
-{
- QMediaResourceList resourceList;
-
- resourceList << QMediaResource(QUrl("http://example.com/movie-main.mov"));
- resourceList << QMediaResource(QUrl("http://example.com/movie-big.mov"));
- QMediaContent media(resourceList);
-
- QMediaResourceList res = media.resources();
- QCOMPARE(res.size(), 2);
- QCOMPARE(res[0], QMediaResource(QUrl("http://example.com/movie-main.mov")));
- QCOMPARE(res[1], QMediaResource(QUrl("http://example.com/movie-big.mov")));
-}
-
-QTEST_MAIN(tst_QMediaContent)
-
-#include "tst_qmediacontent.moc"
diff --git a/tests/auto/qmediaimageviewer/images.qrc b/tests/auto/qmediaimageviewer/images.qrc
deleted file mode 100644
index 508de13..0000000
--- a/tests/auto/qmediaimageviewer/images.qrc
+++ /dev/null
@@ -1,9 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>images/coverart.png</file>
- <file>images/image.jpg</file>
- <file>images/image.png</file>
- <file>images/invalid.png</file>
- <file>images/poster.png</file>
- </qresource>
-</RCC>
diff --git a/tests/auto/qmediaimageviewer/images/coverart.png b/tests/auto/qmediaimageviewer/images/coverart.png
deleted file mode 100644
index a24db1b..0000000
--- a/tests/auto/qmediaimageviewer/images/coverart.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qmediaimageviewer/images/image.jpg b/tests/auto/qmediaimageviewer/images/image.jpg
deleted file mode 100644
index 8771224..0000000
--- a/tests/auto/qmediaimageviewer/images/image.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qmediaimageviewer/images/image.png b/tests/auto/qmediaimageviewer/images/image.png
deleted file mode 100644
index a24db1b..0000000
--- a/tests/auto/qmediaimageviewer/images/image.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qmediaimageviewer/images/invalid.png b/tests/auto/qmediaimageviewer/images/invalid.png
deleted file mode 100644
index 3aba327..0000000
--- a/tests/auto/qmediaimageviewer/images/invalid.png
+++ /dev/null
@@ -1,2 +0,0 @@
-This is not really a PNG file.
-
diff --git a/tests/auto/qmediaimageviewer/images/poster.png b/tests/auto/qmediaimageviewer/images/poster.png
deleted file mode 100644
index a24db1b..0000000
--- a/tests/auto/qmediaimageviewer/images/poster.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qmediaimageviewer/qmediaimageviewer.pro b/tests/auto/qmediaimageviewer/qmediaimageviewer.pro
deleted file mode 100644
index 4724f61..0000000
--- a/tests/auto/qmediaimageviewer/qmediaimageviewer.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediaimageviewer
-
-QT += multimedia-private network testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qmediaimageviewer.cpp
-
-RESOURCES += \
- images.qrc
-
-!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
-
-wince* {
- !contains(QT_CONFIG, no-jpeg): DEPLOYMENT_PLUGIN += qjpeg
-}
diff --git a/tests/auto/qmediaimageviewer/tst_qmediaimageviewer.cpp b/tests/auto/qmediaimageviewer/tst_qmediaimageviewer.cpp
deleted file mode 100644
index 00cfe85..0000000
--- a/tests/auto/qmediaimageviewer/tst_qmediaimageviewer.cpp
+++ /dev/null
@@ -1,1044 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <qtmultimediadefs.h>
-#include <QtTest/QtTest>
-
-#include <QtCore/qdir.h>
-
-#include <qmediaimageviewer.h>
-#include <private/qmediaimageviewerservice_p.h>
-#include <qmediaplaylist.h>
-#include <qmediaservice.h>
-#include <qvideorenderercontrol.h>
-
-#include <QtCore/qfile.h>
-#include <QtNetwork/qnetworkaccessmanager.h>
-#include <QtNetwork/qnetworkreply.h>
-
-#include <qabstractvideosurface.h>
-#include <qvideosurfaceformat.h>
-
-QT_USE_NAMESPACE
-class QtTestNetworkAccessManager;
-
-class tst_QMediaImageViewer : public QObject
-{
- Q_OBJECT
-private slots:
- void initTestCase();
-
- void isValid();
- void timeout();
- void setMedia_data();
- void setMedia();
- void setConsecutiveMedia();
- void setInvalidMedia();
- void playlist();
- void multiplePlaylists();
- void invalidPlaylist();
- void elapsedTime();
- void rendererControl();
- void setVideoOutput();
- void debugEnums();
-
- void mediaChanged_signal();
-
-public:
- tst_QMediaImageViewer() : m_network(0) {}
-
-private:
- QUrl imageUrl(const char *fileName) const {
- return QUrl(QLatin1String("qrc:///images/") + QLatin1String(fileName)); }
- QString imageFileName(const char *fileName) {
- return QLatin1String(":/images/") + QLatin1String(fileName); }
-
- QtTestNetworkAccessManager *m_network;
- QString m_fileProtocol;
-};
-
-class QtTestVideoSurface : public QAbstractVideoSurface
-{
-public:
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const {
- QList<QVideoFrame::PixelFormat> formats;
- if (handleType == QAbstractVideoBuffer::NoHandle) {
- formats << QVideoFrame::Format_RGB32;
- }
- return formats;
- }
-
- QVideoFrame frame() const { return m_frame; }
-
- bool present(const QVideoFrame &frame) { m_frame = frame; return true; }
-
-private:
- QVideoFrame m_frame;
-};
-
-class QtTestNetworkReply : public QNetworkReply
-{
-public:
- QtTestNetworkReply(
- const QNetworkRequest &request,
- const QByteArray &mimeType,
- QObject *parent)
- : QNetworkReply(parent)
- {
- setRequest(request);
- setOperation(QNetworkAccessManager::HeadOperation);
- setRawHeader("content-type", mimeType);
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::User));
- }
-
- QtTestNetworkReply(
- const QNetworkRequest &request,
- const QByteArray &mimeType,
- const QString &fileName,
- QObject *parent)
- : QNetworkReply(parent)
- , m_file(fileName)
- {
- setRequest(request);
- setOperation(QNetworkAccessManager::GetOperation);
- setRawHeader("content-type", mimeType);
-
- if (m_file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) {
- setOpenMode(QIODevice::ReadOnly);
- }
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::User));
- }
-
- void abort() { m_file.close(); }
-
- bool atEnd () const { return m_file.atEnd(); }
- qint64 bytesAvailable() const { return m_file.bytesAvailable() + QIODevice::bytesAvailable(); }
- void close() { m_file.close(); setOpenMode(QIODevice::NotOpen); }
- bool isSequential() const { return true; }
- bool open(OpenMode) { return false; }
- qint64 pos() const { return 0; }
- bool seek(qint64) { return false; }
- qint64 size() const { return m_file.size(); }
- qint64 readData(char * data, qint64 maxSize) { return m_file.read(data, maxSize); }
- qint64 writeData(const char *, qint64) { return -1; }
-
-protected:
- void customEvent(QEvent *event)
- {
- if (event->type() == QEvent::User) {
- event->accept();
- emit finished();
- }
- }
-
-private:
- QFile m_file;
-};
-
-class QtTestNetworkAccessManager : public QNetworkAccessManager
-{
-public:
- QtTestNetworkAccessManager(QObject *parent = 0)
- : QNetworkAccessManager(parent)
- {
- }
-
- void appendDocument(const QUrl &url, const QByteArray &mimeType, const QString &fileName)
- {
- m_documents.append(Document(url, mimeType, fileName));
- }
-
-protected:
- QNetworkReply *createRequest(
- Operation op, const QNetworkRequest &request, QIODevice *outgoingData = 0)
- {
- foreach (const Document &document, m_documents) {
- if (document.url == request.url()) {
- if (op == GetOperation) {
- return new QtTestNetworkReply(
- request, document.mimeType, document.fileName, this);
- } else if (op == HeadOperation) {
- return new QtTestNetworkReply(request, document.mimeType, this);
- }
- }
- }
- return QNetworkAccessManager::createRequest(op, request, outgoingData);
- }
-
-private:
- struct Document
- {
- Document(const QUrl url, const QByteArray mimeType, const QString &fileName)
- : url(url), mimeType(mimeType), fileName(fileName)
- {
- }
-
- QUrl url;
- QByteArray mimeType;
- QString fileName;
- };
-
- QList<Document> m_documents;
-};
-
-void tst_QMediaImageViewer::initTestCase()
-{
- qRegisterMetaType<QMediaImageViewer::State>();
- qRegisterMetaType<QMediaImageViewer::MediaStatus>();
-
- m_network = new QtTestNetworkAccessManager(this);
-
- m_network->appendDocument(
- QUrl(QLatin1String("test://image/png?id=1")),
- "image/png",
- imageFileName("image.png"));
- m_network->appendDocument(
- QUrl(QLatin1String("test://image/png?id=2")),
- QByteArray(),
- imageFileName("image.png"));
- m_network->appendDocument(
- QUrl(QLatin1String("test://image/invalid?id=1")),
- "image/png",
- imageFileName("invalid.png"));
- m_network->appendDocument(
- QUrl(QLatin1String("test://image/invalid?id=2")),
- QByteArray(),
- imageFileName("invalid.png"));
-#ifdef QTEST_HAVE_JPEG
- m_network->appendDocument(
- QUrl(QLatin1String("test://image/jpeg?id=1")),
- "image/jpeg",
- imageFileName("image.jpg"));
-#endif
- m_network->appendDocument(
- QUrl(QLatin1String("test://music/songs/mp3?id=1")),
- "audio/mpeg",
- QString());
- m_network->appendDocument(
- QUrl(QLatin1String("test://music/covers/small?id=1")),
- "image/png",
- imageFileName("coverart.png"));
- m_network->appendDocument(
- QUrl(QLatin1String("test://music/covers/large?id=1")),
- "image/png",
- imageFileName("coverart.png"));
- m_network->appendDocument(
- QUrl(QLatin1String("test://video/movies/mp4?id=1")),
- "video/mp4",
- QString());
- m_network->appendDocument(
- QUrl(QLatin1String("test://video/posters/png?id=1")),
- "image/png",
- imageFileName("poster.png"));
-}
-
-void tst_QMediaImageViewer::isValid()
-{
- QMediaImageViewer viewer;
-
- QVERIFY(viewer.service() != 0);
-}
-
-void tst_QMediaImageViewer::timeout()
-{
- QMediaImageViewer viewer;
-
- QCOMPARE(viewer.timeout(), 3000);
-
- viewer.setTimeout(0);
- QCOMPARE(viewer.timeout(), 0);
-
- viewer.setTimeout(45);
- QCOMPARE(viewer.timeout(), 45);
-
- viewer.setTimeout(-3000);
- QCOMPARE(viewer.timeout(), 0);
-}
-
-void tst_QMediaImageViewer::setMedia_data()
-{
- QTest::addColumn<QMediaContent>("media");
-
- {
- QMediaContent media(imageUrl("image.png"));
-
- QTest::newRow("file: png image")
- << media;
- } {
- QMediaContent media(QUrl(QLatin1String("test://image/png?id=1")));
-
- QTest::newRow("network: png image")
- << media;
- } {
- QMediaContent media(QMediaResource(
- QUrl(QLatin1String("test://image/png?id=1")), QLatin1String("image/png")));
-
- QTest::newRow("network: png image, explicit mime type")
- << media;
- } {
- QMediaContent media(QUrl(QLatin1String("test://image/png?id=2")));
-
- QTest::newRow("network: png image, no mime type")
- << media;
-#ifdef QTEST_HAVE_JPEG
- } {
- QMediaContent media(imageUrl("image.jpg"));
-
- QTest::newRow("file: jpg image")
- << media;
- } {
- QMediaContent media(QUrl(QLatin1String("test://image/jpeg?id=1")));
-
- QTest::newRow("network: jpg image")
- << media;
-#endif
- }
-}
-
-void tst_QMediaImageViewer::setMedia()
-{
- QFETCH(QMediaContent, media);
-
- QMediaImageViewer viewer;
-
- QMediaImageViewerService *service = qobject_cast<QMediaImageViewerService *>(viewer.service());
- service->setNetworkManager(m_network);
-
- connect(&viewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- viewer.setMedia(media);
- QCOMPARE(viewer.media(), media);
-
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
-
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
-}
-
-void tst_QMediaImageViewer::setConsecutiveMedia()
-{
- QMediaContent fileMedia1(imageUrl("image.png"));
- QMediaContent fileMedia2(imageUrl("coverart.png"));
- QMediaContent networkMedia1(QUrl(QLatin1String("test://image/png?id=1")));
- QMediaContent networkMedia2(QUrl(QLatin1String("test://image/png?id=2")));
-
- QMediaImageViewer viewer;
-
- connect(&viewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- viewer.setMedia(fileMedia1);
- viewer.setMedia(fileMedia2);
-
- QCOMPARE(viewer.media(), fileMedia2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.media(), fileMedia2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
-
- QMediaImageViewerService *service = qobject_cast<QMediaImageViewerService *>(viewer.service());
- service->setNetworkManager(m_network);
-
- viewer.setMedia(networkMedia2);
- viewer.setMedia(networkMedia1);
-
- QCOMPARE(viewer.media(), networkMedia1);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.media(), networkMedia1);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
-
- viewer.setMedia(fileMedia1);
- viewer.setMedia(networkMedia2);
-
- QCOMPARE(viewer.media(), networkMedia2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.media(), networkMedia2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
-
- viewer.setMedia(fileMedia1);
- viewer.setMedia(networkMedia2);
-
- QCOMPARE(viewer.media(), networkMedia2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.media(), networkMedia2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
-
- viewer.setMedia(networkMedia1);
- viewer.setMedia(fileMedia2);
-
- QCOMPARE(viewer.media(), fileMedia2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.media(), fileMedia2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
-}
-
-void tst_QMediaImageViewer::setInvalidMedia()
-{
- QMediaImageViewer viewer;
- viewer.setTimeout(250);
-
- QMediaImageViewerService *service = qobject_cast<QMediaImageViewerService *>(viewer.service());
- service->setNetworkManager(m_network);
-
- connect(&viewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- {
- QMediaContent media(imageUrl("invalid.png"));
-
- viewer.setMedia(media);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::InvalidMedia);
- QCOMPARE(viewer.media(), media);
- } {
- QMediaContent media(imageUrl("deleted.png"));
-
- viewer.setMedia(media);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::InvalidMedia);
- QCOMPARE(viewer.media(), media);
- } {
- QMediaResource invalidResource(imageUrl("invalid.png"));
- QMediaResource deletedResource(imageUrl("deleted.png"));
- QMediaContent media(QMediaResourceList() << invalidResource << deletedResource);
-
- viewer.setMedia(media);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::InvalidMedia);
- QCOMPARE(viewer.media(), media);
- } {
- QMediaResource resource(imageUrl("image.png"), QLatin1String("audio/mpeg"));
- QMediaContent media(resource);
-
- viewer.setMedia(media);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::InvalidMedia);
- QCOMPARE(viewer.media(), media);
- } {
- QMediaResource audioResource(imageUrl("image.png"), QLatin1String("audio/mpeg"));
- QMediaResource invalidResource(imageUrl("invalid.png"));
- QMediaContent media(QMediaResourceList() << audioResource << invalidResource);
-
- viewer.setMedia(media);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::InvalidMedia);
- QCOMPARE(viewer.media(), media);
- } {
- QMediaContent media(QUrl(QLatin1String("test://image/invalid?id=1")));
-
- viewer.setMedia(media);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::InvalidMedia);
- QCOMPARE(viewer.media(), media);
- } {
- QMediaContent media(QUrl(QLatin1String("test://image/invalid?id=2")));
-
- viewer.setMedia(media);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::InvalidMedia);
- QCOMPARE(viewer.media(), media);
- } {
- QMediaContent media(QUrl(QLatin1String("test://image/invalid?id=3")));
-
- viewer.setMedia(media);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::InvalidMedia);
- QCOMPARE(viewer.media(), media);
- }
-}
-
-void tst_QMediaImageViewer::playlist()
-{
- QMediaContent imageMedia(imageUrl("image.png"));
- QMediaContent posterMedia(imageUrl("poster.png"));
- QMediaContent coverArtMedia(imageUrl("coverart.png"));
-
- QMediaImageViewer viewer;
- viewer.setTimeout(250);
-
- connect(&viewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- QSignalSpy stateSpy(&viewer, SIGNAL(stateChanged(QMediaImageViewer::State)));
-
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
-
- // No playlist so can't exit stopped state.
- viewer.play();
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
- QCOMPARE(stateSpy.count(), 0);
- viewer.pause();
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
- QCOMPARE(stateSpy.count(), 0);
-
- QMediaPlaylist playlist;
- viewer.setPlaylist(&playlist);
-
- // Empty playlist so can't exit stopped state.
- viewer.play();
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
- QCOMPARE(stateSpy.count(), 0);
- viewer.pause();
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
- QCOMPARE(stateSpy.count(), 0);
-
- playlist.addMedia(imageMedia);
- playlist.addMedia(posterMedia);
- playlist.addMedia(coverArtMedia);
-
- // Play progresses immediately to the first image and starts loading.
- viewer.play();
- QCOMPARE(viewer.state(), QMediaImageViewer::PlayingState);
- QCOMPARE(stateSpy.count(), 1);
- QCOMPARE(qvariant_cast<QMediaImageViewer::State>(stateSpy.last().value(0)),
- QMediaImageViewer::PlayingState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
- QCOMPARE(playlist.currentIndex(), 0);
- QCOMPARE(viewer.media(), imageMedia);
-
- // Image is loaded asynchronously.
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
- QCOMPARE(playlist.currentIndex(), 0);
-
- // Time out causes progression to second image, which starts loading.
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
- QCOMPARE(playlist.currentIndex(), 1);
- QCOMPARE(viewer.media(), posterMedia);
-
- // Image is loaded asynchronously.
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.state(), QMediaImageViewer::PlayingState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
- QCOMPARE(playlist.currentIndex(), 1);
-
- // Pausing stops progression at current image.
- viewer.pause();
- QCOMPARE(viewer.state(), QMediaImageViewer::PausedState);
- QCOMPARE(stateSpy.count(), 2);
- QCOMPARE(qvariant_cast<QMediaImageViewer::State>(stateSpy.last().value(0)),
- QMediaImageViewer::PausedState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
- QCOMPARE(playlist.currentIndex(), 1);
-
- // No time out.
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.state(), QMediaImageViewer::PausedState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
- QCOMPARE(playlist.currentIndex(), 1);
-
- // Resuming playback does not immediately progress to the next item
- viewer.play();
- QCOMPARE(viewer.state(), QMediaImageViewer::PlayingState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
- QCOMPARE(playlist.currentIndex(), 1);
-
- // Time out causes progression to next image, which starts loading.
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
- QCOMPARE(playlist.currentIndex(), 2);
- QCOMPARE(viewer.media(), coverArtMedia);
-
- // Image is loaded asynchronously.
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
- QCOMPARE(playlist.currentIndex(), 2);
-
- // Time out causes progression to end of list
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
- QCOMPARE(stateSpy.count(), 4);
- QCOMPARE(qvariant_cast<QMediaImageViewer::State>(stateSpy.last().value(0)),
- QMediaImageViewer::StoppedState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::NoMedia);
- QCOMPARE(playlist.currentIndex(), -1);
- QCOMPARE(viewer.media(), QMediaContent());
-
- // Stopped, no time out.
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::NoMedia);
- QCOMPARE(playlist.currentIndex(), -1);
-
- // Play progresses immediately to the first image and starts loading.
- viewer.play();
- QCOMPARE(viewer.state(), QMediaImageViewer::PlayingState);
- QCOMPARE(stateSpy.count(), 5);
- QCOMPARE(qvariant_cast<QMediaImageViewer::State>(stateSpy.last().value(0)),
- QMediaImageViewer::PlayingState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
- QCOMPARE(playlist.currentIndex(), 0);
- QCOMPARE(viewer.media(), imageMedia);
-
- // Image is loaded asynchronously.
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
- QCOMPARE(playlist.currentIndex(), 0);
-
- // Stop ends progress, but retains current index.
- viewer.stop();
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
- QCOMPARE(stateSpy.count(), 6);
- QCOMPARE(qvariant_cast<QMediaImageViewer::State>(stateSpy.last().value(0)),
- QMediaImageViewer::StoppedState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
- QCOMPARE(playlist.currentIndex(), 0);
- QCOMPARE(viewer.media(), imageMedia);
-
- // Stoppped, No time out.
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
- QCOMPARE(playlist.currentIndex(), 0);
- QCOMPARE(viewer.media(), imageMedia);
-
- // Stop when already stopped doesn't emit additional signals.
- viewer.stop();
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
- QCOMPARE(stateSpy.count(), 6);
-
- viewer.play();
- QCOMPARE(stateSpy.count(), 7);
-
- // Play when already playing doesn't emit additional signals.
- viewer.play();
- QCOMPARE(viewer.state(), QMediaImageViewer::PlayingState);
- QCOMPARE(stateSpy.count(), 7);
-
- playlist.next();
- QCOMPARE(viewer.state(), QMediaImageViewer::PlayingState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- // Pausing while loading, doesn't stop loading.
- viewer.pause();
- QCOMPARE(viewer.state(), QMediaImageViewer::PausedState);
- QCOMPARE(stateSpy.count(), 8);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.state(), QMediaImageViewer::PausedState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadedMedia);
-
- // Pause while paused doesn't emit additional signals.
- viewer.pause();
- QCOMPARE(viewer.state(), QMediaImageViewer::PausedState);
- QCOMPARE(stateSpy.count(), 8);
-
- // Calling setMedia stops the playlist.
- viewer.setMedia(imageMedia);
- QCOMPARE(viewer.media(), imageMedia);
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
- QCOMPARE(stateSpy.count(), 9);
- QCOMPARE(qvariant_cast<QMediaImageViewer::State>(stateSpy.last().value(0)),
- QMediaImageViewer::StoppedState);
-
-}
-
-void tst_QMediaImageViewer::multiplePlaylists()
-{
- QMediaContent imageMedia(imageUrl("image.png"));
- QMediaContent posterMedia(imageUrl("poster.png"));
- QMediaContent coverArtMedia(imageUrl("coverart.png"));
-
- QMediaImageViewer viewer;
-
- QMediaPlaylist *playlist1 = new QMediaPlaylist;
- viewer.setPlaylist(playlist1);
- playlist1->addMedia(imageMedia);
- playlist1->addMedia(posterMedia);
-
- playlist1->setCurrentIndex(0);
- QCOMPARE(viewer.media(), imageMedia);
-
- QMediaPlaylist *playlist2 = new QMediaPlaylist;
-
- viewer.setPlaylist(playlist2);
- playlist2->addMedia(coverArtMedia);
-
- QVERIFY(viewer.media().isNull());
-
- playlist2->setCurrentIndex(0);
- QCOMPARE(viewer.media(), coverArtMedia);
-
- delete playlist2;
- QVERIFY(viewer.media().isNull());
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
-
- viewer.setPlaylist(playlist1);
- playlist1->setCurrentIndex(0);
- QCOMPARE(viewer.media(), imageMedia);
-
- viewer.play();
- QCOMPARE(viewer.state(), QMediaImageViewer::PlayingState);
-
- delete playlist1;
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
-}
-
-
-void tst_QMediaImageViewer::invalidPlaylist()
-{
- QMediaContent imageMedia(imageUrl("image.png"));
- QMediaContent invalidMedia(imageUrl("invalid.png"));
-
- QMediaImageViewer viewer;
- viewer.setTimeout(250);
-
- connect(&viewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- QSignalSpy stateSpy(&viewer, SIGNAL(stateChanged(QMediaImageViewer::State)));
- QSignalSpy statusSpy(&viewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)));
-
- QMediaPlaylist playlist;
- viewer.setPlaylist(&playlist);
- playlist.addMedia(invalidMedia);
- playlist.addMedia(imageMedia);
- playlist.addMedia(invalidMedia);
-
- // Test play initially tries to load the first invalid image.
- viewer.play();
- QCOMPARE(viewer.state(), QMediaImageViewer::PlayingState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
- QCOMPARE(viewer.media(), invalidMedia);
- QCOMPARE(playlist.currentIndex(), 0);
- QCOMPARE(statusSpy.count(), 1);
- QCOMPARE(qvariant_cast<QMediaImageViewer::MediaStatus>(statusSpy.value(0).value(0)),
- QMediaImageViewer::LoadingMedia);
-
- // Test status is changed to InvalidMedia, and loading of the next image is started immediately.
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.state(), QMediaImageViewer::PlayingState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::LoadingMedia);
- QCOMPARE(viewer.media(), imageMedia);
- QCOMPARE(playlist.currentIndex(), 1);
- QCOMPARE(statusSpy.count(), 3);
- QCOMPARE(qvariant_cast<QMediaImageViewer::MediaStatus>(statusSpy.value(1).value(0)),
- QMediaImageViewer::InvalidMedia);
- QCOMPARE(qvariant_cast<QMediaImageViewer::MediaStatus>(statusSpy.value(2).value(0)),
- QMediaImageViewer::LoadingMedia);
-
- // Test if the last image is invalid, the image viewer is stopped.
- playlist.next();
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::NoMedia);
- QCOMPARE(playlist.currentIndex(), -1);
- QCOMPARE(stateSpy.count(), 2);
-
- playlist.setCurrentIndex(2);
- QTestEventLoop::instance().enterLoop(2);
-
- // Test play immediately moves to the next item if the current one is invalid, and no state
- // change signals are emitted if the viewer never effectively moves from the StoppedState.
- viewer.play();
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
- QCOMPARE(viewer.mediaStatus(), QMediaImageViewer::NoMedia);
- QCOMPARE(playlist.currentIndex(), -1);
- QCOMPARE(stateSpy.count(), 2);
-}
-
-void tst_QMediaImageViewer::elapsedTime()
-{
- QMediaContent imageMedia(imageUrl("image.png"));
-
- QMediaImageViewer viewer;
- viewer.setTimeout(250);
- viewer.setNotifyInterval(150);
-
- QSignalSpy spy(&viewer, SIGNAL(elapsedTimeChanged(int)));
-
- connect(&viewer, SIGNAL(elapsedTimeChanged(int)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
-
-
- QMediaPlaylist playlist;
- viewer.setPlaylist(&playlist);
- playlist.addMedia(imageMedia);
-
- QCOMPARE(viewer.elapsedTime(), 0);
-
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(spy.count(), 0);
-
- viewer.play();
- QCOMPARE(viewer.elapsedTime(), 0);
-
- // Emits an initial elapsed time at 0 milliseconds signal when the image is loaded.
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.last().value(0).toInt(), 0);
-
- // Emits a scheduled signal after the notify interval is up. The exact time will be a little
- // fuzzy.
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(spy.count(), 2);
- QVERIFY(spy.last().value(0).toInt() != 0);
-
- // Pausing will emit a signal with the elapsed time when paused.
- viewer.pause();
- QCOMPARE(spy.count(), 3);
- QCOMPARE(viewer.elapsedTime(), spy.last().value(0).toInt());
-
- // No elapsed time signals will be emitted while paused.
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(spy.count(), 3);
-
- // Stopping a paused viewer resets the elapsed time to 0 with signals emitted.
- viewer.stop();
- QCOMPARE(viewer.elapsedTime(), 0);
- QCOMPARE(spy.count(), 4);
- QCOMPARE(spy.last().value(0).toInt(), 0);
-
- disconnect(&viewer, SIGNAL(elapsedTimeChanged(int)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- connect(&viewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- // Play until end.
- viewer.play();
- QTestEventLoop::instance().enterLoop(2);
-
- // Verify at least two more signals are emitted.
- // The second to last at the instant the timeout expired, and the last as it's reset when the
- // current media is cleared.
- QVERIFY(spy.count() >= 5);
- QCOMPARE(spy.value(spy.count() - 2).value(0).toInt(), 250);
- QCOMPARE(spy.value(spy.count() - 1).value(0).toInt(), 0);
-
- viewer.play();
- QTestEventLoop::instance().enterLoop(2);
-
- // Test extending the timeout applies to an already loaded image.
- viewer.setTimeout(10000);
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.state(), QMediaImageViewer::PlayingState);
-
- // Test reducing the timeout applies to an already loaded image.
- viewer.setTimeout(1000);
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(viewer.state(), QMediaImageViewer::StoppedState);
-
-}
-
-void tst_QMediaImageViewer::rendererControl()
-{
- QtTestVideoSurface surfaceA;
- QtTestVideoSurface surfaceB;
- QAbstractVideoSurface *nullSurface = 0;
-
- QMediaImageViewer viewer;
-
- QMediaService *service = viewer.service();
- if (service == 0)
- QSKIP("Image viewer object has no service.", SkipSingle);
-
- QMediaControl *mediaControl = service->requestControl(QVideoRendererControl_iid);
- QVERIFY(mediaControl != 0);
-
- QVideoRendererControl *rendererControl = qobject_cast<QVideoRendererControl *>(mediaControl);
- QVERIFY(rendererControl != 0);
-
- rendererControl->setSurface(&surfaceA);
- QCOMPARE(rendererControl->surface(), (QAbstractVideoSurface *)&surfaceA);
-
- // Load an image so the viewer has some dimensions to work with.
- viewer.setMedia(QMediaContent(imageUrl("image.png")));
-
- connect(&viewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
- QTestEventLoop::instance().enterLoop(2);
-
- if (viewer.mediaStatus() != QMediaImageViewer::LoadedMedia)
- QSKIP("failed to load test image", SkipSingle);
-
- QCOMPARE(surfaceA.isActive(), true);
-
- {
- QVideoSurfaceFormat format = surfaceA.surfaceFormat();
- QCOMPARE(format.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(format.pixelFormat(), QVideoFrame::Format_RGB32);
- QCOMPARE(format.frameSize(), QSize(75, 50));
-
- QVideoFrame frame = surfaceA.frame();
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_RGB32);
- QCOMPARE(frame.size(), QSize(75, 50));
- }
- // Test clearing the output stops the video surface.
- service->releaseControl(rendererControl);
- QCOMPARE(surfaceA.isActive(), false);
-
- // Test reseting the output restarts it.
- mediaControl = service->requestControl(QVideoRendererControl_iid);
- QVERIFY(mediaControl != 0);
-
- rendererControl = qobject_cast<QVideoRendererControl *>(mediaControl);
- rendererControl->setSurface(&surfaceA);
- QVERIFY(rendererControl != 0);
- {
- QVideoSurfaceFormat format = surfaceA.surfaceFormat();
- QCOMPARE(format.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(format.pixelFormat(), QVideoFrame::Format_RGB32);
- QCOMPARE(format.frameSize(), QSize(75, 50));
-
- QVideoFrame frame = surfaceA.frame();
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_RGB32);
- QCOMPARE(frame.size(), QSize(75, 50));
- }
-
- // Test changing the surface while viewing an image stops the old surface and starts
- // the new one and presents the image.
- rendererControl->setSurface(&surfaceB);
- QCOMPARE(rendererControl->surface(), (QAbstractVideoSurface*)&surfaceB);
-
- QCOMPARE(surfaceA.isActive(), false);
- QCOMPARE(surfaceB.isActive(), true);
-
- QVideoSurfaceFormat format = surfaceB.surfaceFormat();
- QCOMPARE(format.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(format.pixelFormat(), QVideoFrame::Format_RGB32);
- QCOMPARE(format.frameSize(), QSize(75, 50));
-
- QVideoFrame frame = surfaceB.frame();
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_RGB32);
- QCOMPARE(frame.size(), QSize(75, 50));
-
- // Test setting null media stops the surface.
- viewer.setMedia(QMediaContent());
- QCOMPARE(surfaceB.isActive(), false);
-
- // Test the renderer control accepts a null surface.
- rendererControl->setSurface(0);
- QCOMPARE(rendererControl->surface(), nullSurface);
-}
-
-void tst_QMediaImageViewer::setVideoOutput()
-{
- QMediaImageViewer imageViewer;
- imageViewer.setMedia(QMediaContent(imageUrl("image.png")));
-
- connect(&imageViewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
- QTestEventLoop::instance().enterLoop(2);
-
- if (imageViewer.mediaStatus() != QMediaImageViewer::LoadedMedia)
- QSKIP("failed to load test image", SkipSingle);
-
- QtTestVideoSurface surface;
-
- imageViewer.setVideoOutput(reinterpret_cast<QVideoWidget *>(0));
-
- imageViewer.setVideoOutput(reinterpret_cast<QGraphicsVideoItem *>(0));
-
- imageViewer.setVideoOutput(&surface);
- QVERIFY(surface.isActive());
-
- imageViewer.setVideoOutput(reinterpret_cast<QAbstractVideoSurface *>(0));
- QVERIFY(!surface.isActive());
-
- imageViewer.setVideoOutput(&surface);
- QVERIFY(surface.isActive());
-
- imageViewer.setVideoOutput(reinterpret_cast<QVideoWidget *>(0));
- QVERIFY(!surface.isActive());
-
- imageViewer.setVideoOutput(&surface);
- QVERIFY(surface.isActive());
-}
-
-void tst_QMediaImageViewer::debugEnums()
-{
- QTest::ignoreMessage(QtDebugMsg, "QMediaImageViewer::PlayingState ");
- qDebug() << QMediaImageViewer::PlayingState;
- QTest::ignoreMessage(QtDebugMsg, "QMediaImageViewer::NoMedia ");
- qDebug() << QMediaImageViewer::NoMedia;
-}
-
-void tst_QMediaImageViewer::mediaChanged_signal()
-{
- QMediaContent imageMedia(imageUrl("image.png"));
- QMediaImageViewer viewer;
- viewer.setTimeout(250);
- viewer.setNotifyInterval(150);
-
- QSignalSpy spy(&viewer, SIGNAL(mediaChanged(QMediaContent)));
- QVERIFY(spy.size() == 0);
-
- viewer.setMedia(imageMedia);
- QVERIFY(spy.size() == 1);
-}
-
-QTEST_MAIN(tst_QMediaImageViewer)
-
-#include "tst_qmediaimageviewer.moc"
diff --git a/tests/auto/qmediaimageviewerwidgets/images.qrc b/tests/auto/qmediaimageviewerwidgets/images.qrc
deleted file mode 100644
index 1d4edce..0000000
--- a/tests/auto/qmediaimageviewerwidgets/images.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>images/image.png</file>
- </qresource>
-</RCC>
diff --git a/tests/auto/qmediaimageviewerwidgets/images/image.png b/tests/auto/qmediaimageviewerwidgets/images/image.png
deleted file mode 100644
index a24db1b..0000000
--- a/tests/auto/qmediaimageviewerwidgets/images/image.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qmediaimageviewerwidgets/qmediaimageviewerwidgets.pro b/tests/auto/qmediaimageviewerwidgets/qmediaimageviewerwidgets.pro
deleted file mode 100644
index a37ae88..0000000
--- a/tests/auto/qmediaimageviewerwidgets/qmediaimageviewerwidgets.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediaimageviewerwidgets
-
-QT += multimedia-private multimediawidgets-private network testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qmediaimageviewerwidgets.cpp
-
-RESOURCES += \
- images.qrc
-
-!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
-
-wince* {
- !contains(QT_CONFIG, no-jpeg): DEPLOYMENT_PLUGIN += qjpeg
-}
-QT+=widgets
diff --git a/tests/auto/qmediaimageviewerwidgets/tst_qmediaimageviewerwidgets.cpp b/tests/auto/qmediaimageviewerwidgets/tst_qmediaimageviewerwidgets.cpp
deleted file mode 100644
index 80c745f..0000000
--- a/tests/auto/qmediaimageviewerwidgets/tst_qmediaimageviewerwidgets.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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-#include <qtmultimediadefs.h>
-#include <QtTest/QtTest>
-
-#include <QtCore/qdir.h>
-
-#include <qgraphicsvideoitem.h>
-#include <qmediaimageviewer.h>
-#include <private/qmediaimageviewerservice_p.h>
-#include <qmediaplaylist.h>
-#include <qmediaservice.h>
-#include <qvideorenderercontrol.h>
-#include <qvideowidget.h>
-#include <qvideowidgetcontrol.h>
-
-#include <qabstractvideosurface.h>
-#include <qvideosurfaceformat.h>
-
-QT_USE_NAMESPACE
-
-class tst_QMediaImageViewerWidgets : public QObject
-{
- Q_OBJECT
-private slots:
- void setVideoOutput();
-};
-
-class QtTestVideoSurface : public QAbstractVideoSurface
-{
-public:
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const {
- QList<QVideoFrame::PixelFormat> formats;
- if (handleType == QAbstractVideoBuffer::NoHandle) {
- formats << QVideoFrame::Format_RGB32;
- }
- return formats;
- }
-
- QVideoFrame frame() const { return m_frame; }
-
- bool present(const QVideoFrame &frame) { m_frame = frame; return true; }
-
-private:
- QVideoFrame m_frame;
-};
-
-void tst_QMediaImageViewerWidgets::setVideoOutput()
-{
- QMediaImageViewer imageViewer;
- imageViewer.setMedia(QMediaContent(QUrl("qrc:///images/image.png")));
-
- connect(&imageViewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
- QTestEventLoop::instance().enterLoop(2);
-
- if (imageViewer.mediaStatus() != QMediaImageViewer::LoadedMedia)
- QSKIP("failed to load test image", SkipSingle);
-
- QVideoWidget widget;
- QGraphicsVideoItem item;
- QtTestVideoSurface surface;
-
- imageViewer.setVideoOutput(&widget);
- QVERIFY(widget.mediaObject() == &imageViewer);
-
- imageViewer.setVideoOutput(&item);
- QVERIFY(widget.mediaObject() == 0);
- QVERIFY(item.mediaObject() == &imageViewer);
-
- imageViewer.setVideoOutput(reinterpret_cast<QVideoWidget *>(0));
- QVERIFY(item.mediaObject() == 0);
-
- imageViewer.setVideoOutput(&widget);
- QVERIFY(widget.mediaObject() == &imageViewer);
-
- imageViewer.setVideoOutput(reinterpret_cast<QGraphicsVideoItem *>(0));
- QVERIFY(widget.mediaObject() == 0);
-
- imageViewer.setVideoOutput(&surface);
- QVERIFY(surface.isActive());
-
- imageViewer.setVideoOutput(reinterpret_cast<QAbstractVideoSurface *>(0));
- QVERIFY(!surface.isActive());
-
- imageViewer.setVideoOutput(&surface);
- QVERIFY(surface.isActive());
-
- imageViewer.setVideoOutput(&widget);
- QVERIFY(!surface.isActive());
- QVERIFY(widget.mediaObject() == &imageViewer);
-
- imageViewer.setVideoOutput(&surface);
- QVERIFY(surface.isActive());
- QVERIFY(widget.mediaObject() == 0);
-}
-
-QTEST_MAIN(tst_QMediaImageViewerWidgets)
-
-#include "tst_qmediaimageviewerwidgets.moc"
diff --git a/tests/auto/qmediaobject/main.cpp b/tests/auto/qmediaobject/main.cpp
deleted file mode 100644
index 5e82276..0000000
--- a/tests/auto/qmediaobject/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-
-#include "tst_qmediaobject.h"
-
-int main(int argc, char**argv)
-{
- QCoreApplication app(argc,argv);
- int ret;
- tst_QMediaObject test_api;
- ret = QTest::qExec(&test_api, argc, argv);
- return ret;
-}
diff --git a/tests/auto/qmediaobject/qmediaobject.pro b/tests/auto/qmediaobject/qmediaobject.pro
deleted file mode 100644
index 01ee43e..0000000
--- a/tests/auto/qmediaobject/qmediaobject.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediaobject
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-include (../qmultimedia_common/mockrecorder.pri)
-
-HEADERS+= tst_qmediaobject.h
-SOURCES += main.cpp tst_qmediaobject.cpp
-
diff --git a/tests/auto/qmediaobject/tst_qmediaobject.cpp b/tests/auto/qmediaobject/tst_qmediaobject.cpp
deleted file mode 100644
index dde2936..0000000
--- a/tests/auto/qmediaobject/tst_qmediaobject.cpp
+++ /dev/null
@@ -1,403 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 "tst_qmediaobject.h"
-
-#include "mockmediarecorderservice.h"
-#include "mockmediaserviceprovider.h"
-
-QT_USE_NAMESPACE
-
-void tst_QMediaObject::propertyWatch()
-{
- QtTestMediaObject object;
- object.setNotifyInterval(0);
-
- QEventLoop loop;
- connect(&object, SIGNAL(aChanged(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
- connect(&object, SIGNAL(bChanged(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
- connect(&object, SIGNAL(cChanged(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- QSignalSpy aSpy(&object, SIGNAL(aChanged(int)));
- QSignalSpy bSpy(&object, SIGNAL(bChanged(int)));
- QSignalSpy cSpy(&object, SIGNAL(cChanged(int)));
-
- QTestEventLoop::instance().enterLoop(1);
-
- QCOMPARE(aSpy.count(), 0);
- QCOMPARE(bSpy.count(), 0);
- QCOMPARE(cSpy.count(), 0);
-
- int aCount = 0;
- int bCount = 0;
- int cCount = 0;
-
- object.addPropertyWatch("a");
-
- QTestEventLoop::instance().enterLoop(1);
-
- QVERIFY(aSpy.count() > aCount);
- QCOMPARE(bSpy.count(), 0);
- QCOMPARE(cSpy.count(), 0);
- QCOMPARE(aSpy.last().value(0).toInt(), 0);
-
- aCount = aSpy.count();
-
- object.setA(54);
- object.setB(342);
- object.setC(233);
-
- QTestEventLoop::instance().enterLoop(1);
-
- QVERIFY(aSpy.count() > aCount);
- QCOMPARE(bSpy.count(), 0);
- QCOMPARE(cSpy.count(), 0);
- QCOMPARE(aSpy.last().value(0).toInt(), 54);
-
- aCount = aSpy.count();
-
- object.addPropertyWatch("b");
- object.addPropertyWatch("d");
- object.removePropertyWatch("e");
- object.setA(43);
- object.setB(235);
- object.setC(90);
-
- QTestEventLoop::instance().enterLoop(1);
-
- QVERIFY(aSpy.count() > aCount);
- QVERIFY(bSpy.count() > bCount);
- QCOMPARE(cSpy.count(), 0);
- QCOMPARE(aSpy.last().value(0).toInt(), 43);
- QCOMPARE(bSpy.last().value(0).toInt(), 235);
-
- aCount = aSpy.count();
- bCount = bSpy.count();
-
- object.removePropertyWatch("a");
- object.addPropertyWatch("c");
- object.addPropertyWatch("e");
-
- QTestEventLoop::instance().enterLoop(1);
-
- QCOMPARE(aSpy.count(), aCount);
- QVERIFY(bSpy.count() > bCount);
- QVERIFY(cSpy.count() > cCount);
- QCOMPARE(bSpy.last().value(0).toInt(), 235);
- QCOMPARE(cSpy.last().value(0).toInt(), 90);
-
- bCount = bSpy.count();
- cCount = cSpy.count();
-
- object.setA(435);
- object.setC(9845);
-
- QTestEventLoop::instance().enterLoop(1);
-
- QCOMPARE(aSpy.count(), aCount);
- QVERIFY(bSpy.count() > bCount);
- QVERIFY(cSpy.count() > cCount);
- QCOMPARE(bSpy.last().value(0).toInt(), 235);
- QCOMPARE(cSpy.last().value(0).toInt(), 9845);
-
- bCount = bSpy.count();
- cCount = cSpy.count();
-
- object.setA(8432);
- object.setB(324);
- object.setC(443);
- object.removePropertyWatch("c");
- object.removePropertyWatch("d");
-
- QTestEventLoop::instance().enterLoop(1);
-
- QCOMPARE(aSpy.count(), aCount);
- QVERIFY(bSpy.count() > bCount);
- QCOMPARE(cSpy.count(), cCount);
- QCOMPARE(bSpy.last().value(0).toInt(), 324);
- QCOMPARE(cSpy.last().value(0).toInt(), 9845);
-
- bCount = bSpy.count();
-
- object.removePropertyWatch("b");
-
- QTestEventLoop::instance().enterLoop(1);
-
- QCOMPARE(aSpy.count(), aCount);
- QCOMPARE(bSpy.count(), bCount);
- QCOMPARE(cSpy.count(), cCount);
-}
-
-void tst_QMediaObject::setupNotifyTests()
-{
- QTest::addColumn<int>("interval");
- QTest::addColumn<int>("count");
-
- QTest::newRow("single 750ms")
- << 750
- << 1;
- QTest::newRow("single 600ms")
- << 600
- << 1;
- QTest::newRow("x3 300ms")
- << 300
- << 3;
- QTest::newRow("x5 180ms")
- << 180
- << 5;
-}
-
-void tst_QMediaObject::notifySignals_data()
-{
- setupNotifyTests();
-}
-
-void tst_QMediaObject::notifySignals()
-{
- QFETCH(int, interval);
- QFETCH(int, count);
-
- QtTestMediaObject object;
- object.setNotifyInterval(interval);
- object.addPropertyWatch("a");
-
- QSignalSpy spy(&object, SIGNAL(aChanged(int)));
-
- QTestEventLoop::instance().enterLoop(1);
-
- QCOMPARE(spy.count(), count);
-}
-
-void tst_QMediaObject::notifyInterval_data()
-{
- setupNotifyTests();
-}
-
-void tst_QMediaObject::notifyInterval()
-{
- QFETCH(int, interval);
-
- QtTestMediaObject object;
- QSignalSpy spy(&object, SIGNAL(notifyIntervalChanged(int)));
-
- object.setNotifyInterval(interval);
- QCOMPARE(object.notifyInterval(), interval);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.last().value(0).toInt(), interval);
-
- object.setNotifyInterval(interval);
- QCOMPARE(object.notifyInterval(), interval);
- QCOMPARE(spy.count(), 1);
-}
-
-void tst_QMediaObject::nullMetaDataControl()
-{
- const QString titleKey(QLatin1String("Title"));
- const QString title(QLatin1String("Host of Seraphim"));
-
- QtTestMetaDataService service;
- service.hasMetaData = false;
-
- QtTestMediaObject object(&service);
-
- QSignalSpy spy(&object, SIGNAL(metaDataChanged()));
-
- QCOMPARE(object.isMetaDataAvailable(), false);
-
- QCOMPARE(object.metaData(QtMultimedia::Title).toString(), QString());
- QCOMPARE(object.extendedMetaData(titleKey).toString(), QString());
- QCOMPARE(object.availableMetaData(), QList<QtMultimedia::MetaData>());
- QCOMPARE(object.availableExtendedMetaData(), QStringList());
- QCOMPARE(spy.count(), 0);
-}
-
-void tst_QMediaObject::isMetaDataAvailable()
-{
- QtTestMetaDataService service;
- service.metaData.setMetaDataAvailable(false);
-
- QtTestMediaObject object(&service);
- QCOMPARE(object.isMetaDataAvailable(), false);
-
- QSignalSpy spy(&object, SIGNAL(metaDataAvailableChanged(bool)));
- service.metaData.setMetaDataAvailable(true);
-
- QCOMPARE(object.isMetaDataAvailable(), true);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toBool(), true);
-
- service.metaData.setMetaDataAvailable(false);
-
- QCOMPARE(object.isMetaDataAvailable(), false);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.at(1).at(0).toBool(), false);
-}
-
-void tst_QMediaObject::metaDataChanged()
-{
- QtTestMetaDataService service;
- QtTestMediaObject object(&service);
-
- QSignalSpy spy(&object, SIGNAL(metaDataChanged()));
-
- service.metaData.metaDataChanged();
- QCOMPARE(spy.count(), 1);
-
- service.metaData.metaDataChanged();
- QCOMPARE(spy.count(), 2);
-}
-
-void tst_QMediaObject::metaData_data()
-{
- QTest::addColumn<QString>("artist");
- QTest::addColumn<QString>("title");
- QTest::addColumn<QString>("genre");
-
- QTest::newRow("")
- << QString::fromLatin1("Dead Can Dance")
- << QString::fromLatin1("Host of Seraphim")
- << QString::fromLatin1("Awesome");
-}
-
-void tst_QMediaObject::metaData()
-{
- QFETCH(QString, artist);
- QFETCH(QString, title);
- QFETCH(QString, genre);
-
- QtTestMetaDataService service;
- service.metaData.populateMetaData();
-
- QtTestMediaObject object(&service);
- QVERIFY(object.availableMetaData().isEmpty());
-
- service.metaData.m_data.insert(QtMultimedia::AlbumArtist, artist);
- service.metaData.m_data.insert(QtMultimedia::Title, title);
- service.metaData.m_data.insert(QtMultimedia::Genre, genre);
-
- QCOMPARE(object.metaData(QtMultimedia::AlbumArtist).toString(), artist);
- QCOMPARE(object.metaData(QtMultimedia::Title).toString(), title);
-
- QList<QtMultimedia::MetaData> metaDataKeys = object.availableMetaData();
- QCOMPARE(metaDataKeys.size(), 3);
- QVERIFY(metaDataKeys.contains(QtMultimedia::AlbumArtist));
- QVERIFY(metaDataKeys.contains(QtMultimedia::Title));
- QVERIFY(metaDataKeys.contains(QtMultimedia::Genre));
-}
-
-void tst_QMediaObject::extendedMetaData()
-{
- QFETCH(QString, artist);
- QFETCH(QString, title);
- QFETCH(QString, genre);
-
- QtTestMetaDataService service;
- QtTestMediaObject object(&service);
- QVERIFY(object.availableExtendedMetaData().isEmpty());
-
- service.metaData.m_extendedData.insert(QLatin1String("Artist"), artist);
- service.metaData.m_extendedData.insert(QLatin1String("Title"), title);
- service.metaData.m_extendedData.insert(QLatin1String("Genre"), genre);
-
- QCOMPARE(object.extendedMetaData(QLatin1String("Artist")).toString(), artist);
- QCOMPARE(object.extendedMetaData(QLatin1String("Title")).toString(), title);
-
- QStringList extendedKeys = object.availableExtendedMetaData();
- QCOMPARE(extendedKeys.size(), 3);
- QVERIFY(extendedKeys.contains(QLatin1String("Artist")));
- QVERIFY(extendedKeys.contains(QLatin1String("Title")));
- QVERIFY(extendedKeys.contains(QLatin1String("Genre")));
-}
-
-void tst_QMediaObject::availability()
-{
- QtTestMediaObject nullObject(0);
- QCOMPARE(nullObject.isAvailable(), false);
- QCOMPARE(nullObject.availabilityError(), QtMultimedia::ServiceMissingError);
-
- QtTestMetaDataService service;
- QtTestMediaObject object(&service);
- QCOMPARE(object.isAvailable(), true);
- QCOMPARE(object.availabilityError(), QtMultimedia::NoError);
-}
-
- void tst_QMediaObject::service()
- {
- // Create the mediaobject with service.
- QtTestMetaDataService service;
- QtTestMediaObject mediaObject1(&service);
-
- // Get service and Compare if it equal to the service passed as an argument in mediaObject1.
- QMediaService *service1 = mediaObject1.service();
- QVERIFY(service1 != NULL);
- QCOMPARE(service1,&service);
-
- // Create the mediaobject with empty service and verify that service() returns NULL.
- QtTestMediaObject mediaObject2;
- QMediaService *service2 = mediaObject2.service();
- QVERIFY(service2 == NULL);
- }
-
- void tst_QMediaObject::availabilityChangedSignal()
- {
- // The availabilityChangedSignal is implemented in QAudioCaptureSource. So using it to test the signal.
- MockMediaRecorderService *mockAudioSourceService = new MockMediaRecorderService;
- MockMediaServiceProvider *mockProvider = new MockMediaServiceProvider(mockAudioSourceService);
- QAudioCaptureSource *audiosource = new QAudioCaptureSource(0, mockProvider);
-
- QSignalSpy spy(audiosource, SIGNAL(availabilityChanged(bool)));
-
- // Add the end points and verify if the availablity changed signal emitted with argument true.
- QMetaObject::invokeMethod(mockAudioSourceService->mockAudioEndpointSelector, "addEndpoints");
- QVERIFY(spy.count() == 1);
- bool available = qvariant_cast<bool>(spy.at(0).at(0));
- QVERIFY(available == true);
-
- spy.clear();
-
- // Remove all endpoints and verify if the signal is emitted with argument false.
- QMetaObject::invokeMethod(mockAudioSourceService->mockAudioEndpointSelector, "removeEndpoints");
- QVERIFY(spy.count() == 1);
- available = qvariant_cast<bool>(spy.at(0).at(0));
- QVERIFY(available == false);
- }
diff --git a/tests/auto/qmediaobject/tst_qmediaobject.h b/tests/auto/qmediaobject/tst_qmediaobject.h
deleted file mode 100644
index 5bc70c4..0000000
--- a/tests/auto/qmediaobject/tst_qmediaobject.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 TST_QMEDIAOBJECT_H
-#define TST_QMEDIAOBJECT_H
-
-#include <QtTest/QtTest>
-
-#include <QtCore/qtimer.h>
-
-#include <qmediaobject.h>
-#include <qmediaservice.h>
-#include <qmetadatareadercontrol.h>
-#include <qaudiocapturesource.h>
-#include <qaudioendpointselector.h>
-
-//TESTED_COMPONENT=src/multimedia
-
-#include "mockmetadatareadercontrol.h"
-
-class QtTestMetaDataService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestMetaDataService(QObject *parent = 0):QMediaService(parent), metaDataRef(0), hasMetaData(true)
- {
- }
-
- QMediaControl *requestControl(const char *iid)
- {
- if (hasMetaData && qstrcmp(iid, QMetaDataReaderControl_iid) == 0)
- return &metaData;
- else
- return 0;
- }
-
- void releaseControl(QMediaControl *)
- {
- }
-
- MockMetaDataReaderControl metaData;
- int metaDataRef;
- bool hasMetaData;
-};
-
-QT_USE_NAMESPACE
-class tst_QMediaObject : public QObject
-{
- Q_OBJECT
-
-private slots:
- void propertyWatch();
- void notifySignals_data();
- void notifySignals();
- void notifyInterval_data();
- void notifyInterval();
-
- void nullMetaDataControl();
- void isMetaDataAvailable();
- void metaDataChanged();
- void metaData_data();
- void metaData();
- void availability();
- void extendedMetaData_data() { metaData_data(); }
- void extendedMetaData();
-
- void service();
- void availabilityChangedSignal();
-
-private:
- void setupNotifyTests();
-};
-
-class QtTestMediaObject : public QMediaObject
-{
- Q_OBJECT
- Q_PROPERTY(int a READ a WRITE setA NOTIFY aChanged)
- Q_PROPERTY(int b READ b WRITE setB NOTIFY bChanged)
- Q_PROPERTY(int c READ c WRITE setC NOTIFY cChanged)
- Q_PROPERTY(int d READ d WRITE setD)
-public:
- QtTestMediaObject(QMediaService *service = 0): QMediaObject(0, service), m_a(0), m_b(0), m_c(0), m_d(0) {}
-
- using QMediaObject::addPropertyWatch;
- using QMediaObject::removePropertyWatch;
-
- int a() const { return m_a; }
- void setA(int a) { m_a = a; }
-
- int b() const { return m_b; }
- void setB(int b) { m_b = b; }
-
- int c() const { return m_c; }
- void setC(int c) { m_c = c; }
-
- int d() const { return m_d; }
- void setD(int d) { m_d = d; }
-
-Q_SIGNALS:
- void aChanged(int a);
- void bChanged(int b);
- void cChanged(int c);
-
-private:
- int m_a;
- int m_b;
- int m_c;
- int m_d;
-};
-#endif //TST_QMEDIAOBJECT_H
diff --git a/tests/auto/qmediaplayer/main.cpp b/tests/auto/qmediaplayer/main.cpp
deleted file mode 100755
index 417dcd3..0000000
--- a/tests/auto/qmediaplayer/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-
-#include "tst_qmediaplayer.h"
-
-int main(int argc, char**argv)
-{
- QCoreApplication app(argc,argv);
- int ret;
- tst_QMediaPlayer test_api;
- ret = QTest::qExec(&test_api, argc, argv);
- return ret;
-}
diff --git a/tests/auto/qmediaplayer/qmediaplayer.pro b/tests/auto/qmediaplayer/qmediaplayer.pro
deleted file mode 100644
index f770f1e..0000000
--- a/tests/auto/qmediaplayer/qmediaplayer.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediaplayer
-
-QT += network multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-HEADERS += tst_qmediaplayer.h
-SOURCES += main.cpp tst_qmediaplayer.cpp
-
-include (../qmultimedia_common/mock.pri)
-include (../qmultimedia_common/mockplayer.pri)
diff --git a/tests/auto/qmediaplayer/tst_qmediaplayer.cpp b/tests/auto/qmediaplayer/tst_qmediaplayer.cpp
deleted file mode 100644
index 383a4c4..0000000
--- a/tests/auto/qmediaplayer/tst_qmediaplayer.cpp
+++ /dev/null
@@ -1,1050 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 "tst_qmediaplayer.h"
-
-#include <QtNetwork/qnetworkconfigmanager.h>
-
-// Encouraging successful diversity through copy and paste.
-#ifndef QTRY_COMPARE
-#define QTRY_COMPARE(__expr, __expected) \
- do { \
- const int __step = 50; \
- const int __timeout = 5000; \
- if ((__expr) != (__expected)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QCOMPARE(__expr, __expected); \
- } while(0)
-#endif
-
-#ifndef QTRY_VERIFY
-#define QTRY_VERIFY(__expr) \
- do { \
- const int __step = 50; \
- const int __timeout = 5000; \
- if (!(__expr)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QVERIFY(__expr); \
- } while(0)
-#endif
-
-QT_USE_NAMESPACE
-
-#include "mockvideosurface.h"
-
-void tst_QMediaPlayer::initTestCase_data()
-{
- QTest::addColumn<bool>("valid");
- QTest::addColumn<QMediaPlayer::State>("state");
- QTest::addColumn<QMediaPlayer::MediaStatus>("status");
- QTest::addColumn<QMediaContent>("mediaContent");
- QTest::addColumn<qint64>("duration");
- QTest::addColumn<qint64>("position");
- QTest::addColumn<bool>("seekable");
- QTest::addColumn<int>("volume");
- QTest::addColumn<bool>("muted");
- QTest::addColumn<bool>("videoAvailable");
- QTest::addColumn<int>("bufferStatus");
- QTest::addColumn<qreal>("playbackRate");
- QTest::addColumn<QMediaPlayer::Error>("error");
- QTest::addColumn<QString>("errorString");
-
- QTest::newRow("invalid") << false << QMediaPlayer::StoppedState << QMediaPlayer::UnknownMediaStatus <<
- QMediaContent() << qint64(0) << qint64(0) << false << 0 << false << false << 0 <<
- qreal(0) << QMediaPlayer::NoError << QString();
- QTest::newRow("valid+null") << true << QMediaPlayer::StoppedState << QMediaPlayer::UnknownMediaStatus <<
- QMediaContent() << qint64(0) << qint64(0) << false << 0 << false << false << 50 <<
- qreal(0) << QMediaPlayer::NoError << QString();
- QTest::newRow("valid+content+stopped") << true << QMediaPlayer::StoppedState << QMediaPlayer::UnknownMediaStatus <<
- QMediaContent(QUrl("file:///some.mp3")) << qint64(0) << qint64(0) << false << 50 << false << false << 0 <<
- qreal(1) << QMediaPlayer::NoError << QString();
- QTest::newRow("valid+content+playing") << true << QMediaPlayer::PlayingState << QMediaPlayer::LoadedMedia <<
- QMediaContent(QUrl("file:///some.mp3")) << qint64(10000) << qint64(10) << true << 50 << true << false << 0 <<
- qreal(1) << QMediaPlayer::NoError << QString();
- QTest::newRow("valid+content+paused") << true << QMediaPlayer::PausedState << QMediaPlayer::LoadedMedia <<
- QMediaContent(QUrl("file:///some.mp3")) << qint64(10000) << qint64(10) << true << 50 << true << false << 0 <<
- qreal(1) << QMediaPlayer::NoError << QString();
- QTest::newRow("valud+streaming") << true << QMediaPlayer::PlayingState << QMediaPlayer::LoadedMedia <<
- QMediaContent(QUrl("http://example.com/stream")) << qint64(10000) << qint64(10000) << false << 50 << false << true << 0 <<
- qreal(1) << QMediaPlayer::NoError << QString();
- QTest::newRow("valid+error") << true << QMediaPlayer::StoppedState << QMediaPlayer::UnknownMediaStatus <<
- QMediaContent(QUrl("http://example.com/stream")) << qint64(0) << qint64(0) << false << 50 << false << false << 0 <<
- qreal(0) << QMediaPlayer::ResourceError << QString("Resource unavailable");
-}
-
-void tst_QMediaPlayer::initTestCase()
-{
- qRegisterMetaType<QMediaPlayer::State>("QMediaPlayer::State");
- qRegisterMetaType<QMediaPlayer::Error>("QMediaPlayer::Error");
- qRegisterMetaType<QMediaPlayer::MediaStatus>("QMediaPlayer::MediaStatus");
- qRegisterMetaType<QMediaContent>("QMediaContent");
-
- mockService = new MockMediaPlayerService;
- mockProvider = new MockMediaServiceProvider(mockService, true);
- player = new QMediaPlayer(0, 0, mockProvider);
-}
-
-void tst_QMediaPlayer::cleanupTestCase()
-{
- delete player;
-}
-
-void tst_QMediaPlayer::init()
-{
- mockService->reset();
-}
-
-void tst_QMediaPlayer::cleanup()
-{
-}
-
-void tst_QMediaPlayer::testNullService()
-{
- MockMediaServiceProvider provider(0);
- QMediaPlayer player(0, 0, &provider);
-
- const QIODevice *nullDevice = 0;
-
- QCOMPARE(player.media(), QMediaContent());
- QCOMPARE(player.mediaStream(), nullDevice);
- QCOMPARE(player.state(), QMediaPlayer::StoppedState);
- QCOMPARE(player.mediaStatus(), QMediaPlayer::UnknownMediaStatus);
- QCOMPARE(player.duration(), qint64(-1));
- QCOMPARE(player.position(), qint64(0));
- QCOMPARE(player.volume(), 0);
- QCOMPARE(player.isMuted(), false);
- QCOMPARE(player.isVideoAvailable(), false);
- QCOMPARE(player.bufferStatus(), 0);
- QCOMPARE(player.isSeekable(), false);
- QCOMPARE(player.playbackRate(), qreal(0));
- QCOMPARE(player.error(), QMediaPlayer::ServiceMissingError);
- QCOMPARE(player.isAvailable(), false);
- QCOMPARE(player.availabilityError(), QtMultimedia::ServiceMissingError);
-
- {
- QFETCH_GLOBAL(QMediaContent, mediaContent);
-
- QSignalSpy spy(&player, SIGNAL(mediaChanged(QMediaContent)));
- QFile file;
-
- player.setMedia(mediaContent, &file);
- QCOMPARE(player.media(), QMediaContent());
- QCOMPARE(player.mediaStream(), nullDevice);
- QCOMPARE(spy.count(), 0);
- } {
- QSignalSpy stateSpy(&player, SIGNAL(stateChanged(QMediaPlayer::State)));
- QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
-
- player.play();
- QCOMPARE(player.state(), QMediaPlayer::StoppedState);
- QCOMPARE(player.mediaStatus(), QMediaPlayer::UnknownMediaStatus);
- QCOMPARE(stateSpy.count(), 0);
- QCOMPARE(statusSpy.count(), 0);
-
- player.pause();
- QCOMPARE(player.state(), QMediaPlayer::StoppedState);
- QCOMPARE(player.mediaStatus(), QMediaPlayer::UnknownMediaStatus);
- QCOMPARE(stateSpy.count(), 0);
- QCOMPARE(statusSpy.count(), 0);
-
- player.stop();
- QCOMPARE(player.state(), QMediaPlayer::StoppedState);
- QCOMPARE(player.mediaStatus(), QMediaPlayer::UnknownMediaStatus);
- QCOMPARE(stateSpy.count(), 0);
- QCOMPARE(statusSpy.count(), 0);
- } {
- QFETCH_GLOBAL(int, volume);
- QFETCH_GLOBAL(bool, muted);
-
- QSignalSpy volumeSpy(&player, SIGNAL(volumeChanged(int)));
- QSignalSpy mutingSpy(&player, SIGNAL(mutedChanged(bool)));
-
- player.setVolume(volume);
- QCOMPARE(player.volume(), 0);
- QCOMPARE(volumeSpy.count(), 0);
-
- player.setMuted(muted);
- QCOMPARE(player.isMuted(), false);
- QCOMPARE(mutingSpy.count(), 0);
- } {
- QFETCH_GLOBAL(qint64, position);
-
- QSignalSpy spy(&player, SIGNAL(positionChanged(qint64)));
-
- player.setPosition(position);
- QCOMPARE(player.position(), qint64(0));
- QCOMPARE(spy.count(), 0);
- } {
- QFETCH_GLOBAL(qreal, playbackRate);
-
- QSignalSpy spy(&player, SIGNAL(playbackRateChanged(qreal)));
-
- player.setPlaybackRate(playbackRate);
- QCOMPARE(player.playbackRate(), qreal(0));
- QCOMPARE(spy.count(), 0);
- } {
- QMediaPlaylist playlist;
- player.setPlaylist(&playlist);
-
- QSignalSpy mediaSpy(&player, SIGNAL(mediaChanged(QMediaContent)));
- QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
-
- playlist.addMedia(QUrl("http://example.com/stream"));
- playlist.addMedia(QUrl("file:///some.mp3"));
-
- playlist.setCurrentIndex(0);
- QCOMPARE(playlist.currentIndex(), 0);
- QCOMPARE(player.media(), QMediaContent());
- QCOMPARE(mediaSpy.count(), 0);
- QCOMPARE(statusSpy.count(), 0);
-
- playlist.next();
- QCOMPARE(playlist.currentIndex(), 1);
- QCOMPARE(player.media(), QMediaContent());
- QCOMPARE(mediaSpy.count(), 0);
- QCOMPARE(statusSpy.count(), 0);
- }
-}
-
-void tst_QMediaPlayer::testValid()
-{
- /*
- QFETCH_GLOBAL(bool, valid);
-
- mockService->setIsValid(valid);
- QCOMPARE(player->isValid(), valid);
- */
-}
-
-void tst_QMediaPlayer::testMedia()
-{
- QFETCH_GLOBAL(QMediaContent, mediaContent);
-
- mockService->setMedia(mediaContent);
- QCOMPARE(player->media(), mediaContent);
-
- QBuffer stream;
- player->setMedia(mediaContent, &stream);
- QCOMPARE(player->media(), mediaContent);
- QCOMPARE((QBuffer*)player->mediaStream(), &stream);
-}
-
-void tst_QMediaPlayer::testDuration()
-{
- QFETCH_GLOBAL(qint64, duration);
-
- mockService->setDuration(duration);
- QVERIFY(player->duration() == duration);
-}
-
-void tst_QMediaPlayer::testPosition()
-{
- QFETCH_GLOBAL(bool, valid);
- QFETCH_GLOBAL(bool, seekable);
- QFETCH_GLOBAL(qint64, position);
- QFETCH_GLOBAL(qint64, duration);
-
- mockService->setIsValid(valid);
- mockService->setSeekable(seekable);
- mockService->setPosition(position);
- mockService->setDuration(duration);
- QVERIFY(player->isSeekable() == seekable);
- QVERIFY(player->position() == position);
- QVERIFY(player->duration() == duration);
-
- if (seekable) {
- { QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(position);
- QCOMPARE(player->position(), position);
- QCOMPARE(spy.count(), 0); }
-
- mockService->setPosition(position);
- { QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(0);
- QCOMPARE(player->position(), qint64(0));
- QCOMPARE(spy.count(), position == 0 ? 0 : 1); }
-
- mockService->setPosition(position);
- { QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(duration);
- QCOMPARE(player->position(), duration);
- QCOMPARE(spy.count(), position == duration ? 0 : 1); }
-
- mockService->setPosition(position);
- { QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(-1);
- QCOMPARE(player->position(), qint64(0));
- QCOMPARE(spy.count(), position == 0 ? 0 : 1); }
-
- mockService->setPosition(position);
- { QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(duration + 1);
- QCOMPARE(player->position(), duration);
- QCOMPARE(spy.count(), position == duration ? 0 : 1); }
- }
- else {
- QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(position);
-
- QCOMPARE(player->position(), position);
- QCOMPARE(spy.count(), 0);
- }
-}
-
-void tst_QMediaPlayer::testVolume()
-{
- QFETCH_GLOBAL(bool, valid);
- QFETCH_GLOBAL(int, volume);
-
- mockService->setVolume(volume);
- QVERIFY(player->volume() == volume);
-
- if (valid) {
- { QSignalSpy spy(player, SIGNAL(volumeChanged(int)));
- player->setVolume(10);
- QCOMPARE(player->volume(), 10);
- QCOMPARE(spy.count(), 1); }
-
- { QSignalSpy spy(player, SIGNAL(volumeChanged(int)));
- player->setVolume(-1000);
- QCOMPARE(player->volume(), 0);
- QCOMPARE(spy.count(), 1); }
-
- { QSignalSpy spy(player, SIGNAL(volumeChanged(int)));
- player->setVolume(100);
- QCOMPARE(player->volume(), 100);
- QCOMPARE(spy.count(), 1); }
-
- { QSignalSpy spy(player, SIGNAL(volumeChanged(int)));
- player->setVolume(1000);
- QCOMPARE(player->volume(), 100);
- QCOMPARE(spy.count(), 0); }
- }
-}
-
-void tst_QMediaPlayer::testMuted()
-{
- QFETCH_GLOBAL(bool, valid);
- QFETCH_GLOBAL(bool, muted);
- QFETCH_GLOBAL(int, volume);
-
- if (valid) {
- mockService->setMuted(muted);
- mockService->setVolume(volume);
- QVERIFY(player->isMuted() == muted);
-
- QSignalSpy spy(player, SIGNAL(mutedChanged(bool)));
- player->setMuted(!muted);
- QCOMPARE(player->isMuted(), !muted);
- QCOMPARE(player->volume(), volume);
- QCOMPARE(spy.count(), 1);
- }
-}
-
-void tst_QMediaPlayer::testVideoAvailable()
-{
- QFETCH_GLOBAL(bool, videoAvailable);
-
- mockService->setVideoAvailable(videoAvailable);
- QVERIFY(player->isVideoAvailable() == videoAvailable);
-}
-
-void tst_QMediaPlayer::testBufferStatus()
-{
- QFETCH_GLOBAL(int, bufferStatus);
-
- mockService->setBufferStatus(bufferStatus);
- QVERIFY(player->bufferStatus() == bufferStatus);
-}
-
-void tst_QMediaPlayer::testSeekable()
-{
- QFETCH_GLOBAL(bool, seekable);
-
- mockService->setSeekable(seekable);
- QVERIFY(player->isSeekable() == seekable);
-}
-
-void tst_QMediaPlayer::testPlaybackRate()
-{
- QFETCH_GLOBAL(bool, valid);
- QFETCH_GLOBAL(qreal, playbackRate);
-
- if (valid) {
- mockService->setPlaybackRate(playbackRate);
- QVERIFY(player->playbackRate() == playbackRate);
-
- QSignalSpy spy(player, SIGNAL(playbackRateChanged(qreal)));
- player->setPlaybackRate(playbackRate + 0.5f);
- QCOMPARE(player->playbackRate(), playbackRate + 0.5f);
- QCOMPARE(spy.count(), 1);
- }
-}
-
-void tst_QMediaPlayer::testError()
-{
- QFETCH_GLOBAL(QMediaPlayer::Error, error);
-
- mockService->setError(error);
- QVERIFY(player->error() == error);
-}
-
-void tst_QMediaPlayer::testErrorString()
-{
- QFETCH_GLOBAL(QString, errorString);
-
- mockService->setErrorString(errorString);
- QVERIFY(player->errorString() == errorString);
-}
-
-void tst_QMediaPlayer::testIsAvailable()
-{
- QCOMPARE(player->isAvailable(), true);
- QCOMPARE(player->availabilityError(), QtMultimedia::NoError);
-}
-
-void tst_QMediaPlayer::testService()
-{
- /*
- QFETCH_GLOBAL(bool, valid);
-
- mockService->setIsValid(valid);
-
- if (valid)
- QVERIFY(player->service() != 0);
- else
- QVERIFY(player->service() == 0);
- */
-}
-
-void tst_QMediaPlayer::testPlay()
-{
- QFETCH_GLOBAL(bool, valid);
- QFETCH_GLOBAL(QMediaContent, mediaContent);
- QFETCH_GLOBAL(QMediaPlayer::State, state);
-
- mockService->setIsValid(valid);
- mockService->setState(state);
- mockService->setMedia(mediaContent);
- QVERIFY(player->state() == state);
- QVERIFY(player->media() == mediaContent);
-
- QSignalSpy spy(player, SIGNAL(stateChanged(QMediaPlayer::State)));
-
- player->play();
-
- if (!valid || mediaContent.isNull()) {
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(spy.count(), 0);
- }
- else {
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(spy.count(), state == QMediaPlayer::PlayingState ? 0 : 1);
- }
-}
-
-void tst_QMediaPlayer::testPause()
-{
- QFETCH_GLOBAL(bool, valid);
- QFETCH_GLOBAL(QMediaContent, mediaContent);
- QFETCH_GLOBAL(QMediaPlayer::State, state);
-
- mockService->setIsValid(valid);
- mockService->setState(state);
- mockService->setMedia(mediaContent);
- QVERIFY(player->state() == state);
- QVERIFY(player->media() == mediaContent);
-
- QSignalSpy spy(player, SIGNAL(stateChanged(QMediaPlayer::State)));
-
- player->pause();
-
- if (!valid || mediaContent.isNull()) {
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(spy.count(), 0);
- }
- else {
- QCOMPARE(player->state(), QMediaPlayer::PausedState);
- QCOMPARE(spy.count(), state == QMediaPlayer::PausedState ? 0 : 1);
- }
-}
-
-void tst_QMediaPlayer::testStop()
-{
- QFETCH_GLOBAL(QMediaContent, mediaContent);
- QFETCH_GLOBAL(QMediaPlayer::State, state);
-
- mockService->setState(state);
- mockService->setMedia(mediaContent);
- QVERIFY(player->state() == state);
- QVERIFY(player->media() == mediaContent);
-
- QSignalSpy spy(player, SIGNAL(stateChanged(QMediaPlayer::State)));
-
- player->stop();
-
- if (mediaContent.isNull() || state == QMediaPlayer::StoppedState) {
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(spy.count(), 0);
- }
- else {
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(spy.count(), 1);
- }
-}
-
-void tst_QMediaPlayer::testMediaStatus()
-{
- QFETCH_GLOBAL(int, bufferStatus);
- int bufferSignals = 0;
-
- player->setNotifyInterval(10);
-
- mockService->setMediaStatus(QMediaPlayer::NoMedia);
- mockService->setBufferStatus(bufferStatus);
-
- AutoConnection connection(
- player, SIGNAL(bufferStatusChanged(int)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- QSignalSpy statusSpy(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
- QSignalSpy bufferSpy(player, SIGNAL(bufferStatusChanged(int)));
-
- QCOMPARE(player->mediaStatus(), QMediaPlayer::NoMedia);
-
- mockService->setMediaStatus(QMediaPlayer::LoadingMedia);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::LoadingMedia);
- QCOMPARE(statusSpy.count(), 1);
-
- QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
- QMediaPlayer::LoadingMedia);
-
- mockService->setMediaStatus(QMediaPlayer::LoadedMedia);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::LoadedMedia);
- QCOMPARE(statusSpy.count(), 2);
-
- QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
- QMediaPlayer::LoadedMedia);
-
- // Verify the bufferStatusChanged() signal isn't being emitted.
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(bufferSpy.count(), 0);
-
- mockService->setMediaStatus(QMediaPlayer::StalledMedia);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::StalledMedia);
- QCOMPARE(statusSpy.count(), 3);
-
- QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
- QMediaPlayer::StalledMedia);
-
- // Verify the bufferStatusChanged() signal is being emitted.
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(bufferSpy.count() > bufferSignals);
- QCOMPARE(bufferSpy.last().value(0).toInt(), bufferStatus);
- bufferSignals = bufferSpy.count();
-
- mockService->setMediaStatus(QMediaPlayer::BufferingMedia);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::BufferingMedia);
- QCOMPARE(statusSpy.count(), 4);
-
- QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
- QMediaPlayer::BufferingMedia);
-
- // Verify the bufferStatusChanged() signal is being emitted.
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(bufferSpy.count() > bufferSignals);
- QCOMPARE(bufferSpy.last().value(0).toInt(), bufferStatus);
- bufferSignals = bufferSpy.count();
-
- mockService->setMediaStatus(QMediaPlayer::BufferedMedia);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::BufferedMedia);
- QCOMPARE(statusSpy.count(), 5);
-
- QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
- QMediaPlayer::BufferedMedia);
-
- // Verify the bufferStatusChanged() signal isn't being emitted.
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(bufferSpy.count(), bufferSignals);
-
- mockService->setMediaStatus(QMediaPlayer::EndOfMedia);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::EndOfMedia);
- QCOMPARE(statusSpy.count(), 6);
-
- QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
- QMediaPlayer::EndOfMedia);
-}
-
-void tst_QMediaPlayer::testPlaylist()
-{
- QMediaContent content0(QUrl(QLatin1String("test://audio/song1.mp3")));
- QMediaContent content1(QUrl(QLatin1String("test://audio/song2.mp3")));
- QMediaContent content2(QUrl(QLatin1String("test://video/movie1.mp4")));
- QMediaContent content3(QUrl(QLatin1String("test://video/movie2.mp4")));
- QMediaContent content4(QUrl(QLatin1String("test://image/photo.jpg")));
-
- mockService->setIsValid(true);
- mockService->setState(QMediaPlayer::StoppedState, QMediaPlayer::NoMedia);
-
- QMediaPlaylist *playlist = new QMediaPlaylist;
- player->setPlaylist(playlist);
-
- QSignalSpy stateSpy(player, SIGNAL(stateChanged(QMediaPlayer::State)));
- QSignalSpy mediaSpy(player, SIGNAL(mediaChanged(QMediaContent)));
-
- // Test the player does nothing with an empty playlist attached.
- player->play();
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(player->media(), QMediaContent());
- QCOMPARE(stateSpy.count(), 0);
- QCOMPARE(mediaSpy.count(), 0);
-
- playlist->addMedia(content0);
- playlist->addMedia(content1);
- playlist->addMedia(content2);
- playlist->addMedia(content3);
-
- // Test changing the playlist position, changes the current media, but not the playing state.
- playlist->setCurrentIndex(1);
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 0);
- QCOMPARE(mediaSpy.count(), 1);
-
- // Test playing starts with the current media.
- player->play();
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 1);
- QCOMPARE(mediaSpy.count(), 1);
-
- // Test pausing doesn't change the current media.
- player->pause();
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::PausedState);
- QCOMPARE(stateSpy.count(), 2);
- QCOMPARE(mediaSpy.count(), 1);
-
- // Test stopping doesn't change the current media.
- player->stop();
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 3);
- QCOMPARE(mediaSpy.count(), 1);
-
- // Test when the player service reaches the end of the current media, the player moves onto
- // the next item without stopping.
- player->play();
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 4);
- QCOMPARE(mediaSpy.count(), 1);
-
- mockService->setState(QMediaPlayer::StoppedState, QMediaPlayer::EndOfMedia);
- QCOMPARE(player->media(), content2);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 4);
- QCOMPARE(mediaSpy.count(), 2);
-
- // Test skipping the current media doesn't change the state.
- playlist->next();
- QCOMPARE(player->media(), content3);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 4);
- QCOMPARE(mediaSpy.count(), 3);
-
- // Test changing the current media while paused doesn't change the state.
- player->pause();
- mockService->setMediaStatus(QMediaPlayer::BufferedMedia);
- QCOMPARE(player->media(), content3);
- QCOMPARE(player->state(), QMediaPlayer::PausedState);
- QCOMPARE(stateSpy.count(), 5);
- QCOMPARE(mediaSpy.count(), 3);
-
- playlist->previous();
- QCOMPARE(player->media(), content2);
- QCOMPARE(player->state(), QMediaPlayer::PausedState);
- QCOMPARE(stateSpy.count(), 5);
- QCOMPARE(mediaSpy.count(), 4);
-
- // Test changing the current media while stopped doesn't change the state.
- player->stop();
- mockService->setMediaStatus(QMediaPlayer::LoadedMedia);
- QCOMPARE(player->media(), content2);
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 6);
- QCOMPARE(mediaSpy.count(), 4);
-
- playlist->next();
- QCOMPARE(player->media(), content3);
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 6);
- QCOMPARE(mediaSpy.count(), 5);
-
- // Test the player is stopped and the current media cleared when it reaches the end of the last
- // item in the playlist.
- player->play();
- QCOMPARE(player->media(), content3);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 7);
- QCOMPARE(mediaSpy.count(), 5);
-
- // Double up the signals to ensure some noise doesn't destabalize things.
- mockService->setState(QMediaPlayer::StoppedState, QMediaPlayer::EndOfMedia);
- mockService->setState(QMediaPlayer::StoppedState, QMediaPlayer::EndOfMedia);
- QCOMPARE(player->media(), QMediaContent());
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 8);
- QCOMPARE(mediaSpy.count(), 6);
-
- // Test starts playing from the start of the playlist if there is no current media selected.
- player->play();
- QCOMPARE(player->media(), content0);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 9);
- QCOMPARE(mediaSpy.count(), 7);
-
- // Test deleting the playlist stops the player and clears the media it set.
- delete playlist;
- QCOMPARE(player->media(), QMediaContent());
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 10);
- QCOMPARE(mediaSpy.count(), 8);
-
- // Test the player works as normal with the playlist removed.
- player->play();
- QCOMPARE(player->media(), QMediaContent());
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 10);
- QCOMPARE(mediaSpy.count(), 8);
-
- player->setMedia(content1);
- player->play();
-
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 11);
- QCOMPARE(mediaSpy.count(), 9);
-
- // Test the player can bind to playlist again
- playlist = new QMediaPlaylist;
- player->setPlaylist(playlist);
-
- QCOMPARE(player->media(), QMediaContent());
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
-
- playlist->addMedia(content0);
- playlist->addMedia(content1);
- playlist->addMedia(content2);
- playlist->addMedia(content3);
-
- playlist->setCurrentIndex(1);
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
-
- // Test attaching the new playlist,
- // player should detach the current one
- QMediaPlaylist *playlist2 = new QMediaPlaylist;
- playlist2->addMedia(content1);
- playlist2->addMedia(content2);
- playlist2->addMedia(content3);
- playlist2->setCurrentIndex(2);
-
- player->play();
- player->setPlaylist(playlist2);
- QCOMPARE(player->media(), playlist2->currentMedia());
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
-
- playlist2->setCurrentIndex(1);
- QCOMPARE(player->media(), playlist2->currentMedia());
-
- {
- QMediaPlaylist playlist;
- playlist.addMedia(content1);
- playlist.addMedia(content2);
- playlist.addMedia(content3);
- playlist.setCurrentIndex(1);
-
- player->setPlaylist(&playlist);
- QCOMPARE(player->playlist(), &playlist);
- QCOMPARE(player->media(), content2);
- } //playlist should be detached now
-
- QVERIFY(player->playlist() == 0);
- QCOMPARE(player->media(), QMediaContent());
-
- // Test when the player service encounters an invalid media, the player moves onto
- // the next item without stopping
- {
- QSignalSpy ss(player, SIGNAL(stateChanged(QMediaPlayer::State)));
- QSignalSpy ms(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
-
- player->setPlaylist(playlist);
- player->play();
- QCOMPARE(ss.count(), 1);
-
- mockService->setState(QMediaPlayer::StoppedState, QMediaPlayer::InvalidMedia);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::InvalidMedia);
- QCOMPARE(ss.count(), 1);
- QCOMPARE(ms.count(), 1);
-
- // NOTE: status should begin transitioning through to BufferedMedia.
- QCOMPARE(player->media(), content2);
- }
-
-}
-
-void tst_QMediaPlayer::testPlayerFlags()
-{
- MockMediaServiceProvider provider(0, true);
- QMediaPlayer::Flag flags = QMediaPlayer::LowLatency;
-
- QMediaPlayer player(0, flags, &provider);
- QMediaServiceProviderHint::Feature feature;
-
- if (flags & QMediaPlayer::LowLatency)
- {
- /* if the flag is low latency set the low latency play back for the service provider */
- feature = QMediaServiceProviderHint::LowLatencyPlayback;
- const QByteArray service(Q_MEDIASERVICE_MEDIAPLAYER);
- const QMediaServiceProviderHint providerHint(feature);
- /* request service for the service provider */
- provider.requestService(service,providerHint);
-
- /* Constructs a SupportedFeatures media service provider hint. */
- QMediaServiceProviderHint servicepro(feature);
-
- /* compare the flag value */
- QVERIFY(servicepro.features() == QMediaServiceProviderHint::LowLatencyPlayback);
- }
-
- /* The player is expected to play QIODevice based streams.
- If passed to QMediaPlayer constructor,
- the service supporting streams playback will be chosen. */
- flags = QMediaPlayer::StreamPlayback;
- /* Construct a QMediaPlayer that uses the playback service from provider,
- parented to parent and with flags.*/
- QMediaPlayer player2(0,flags , &provider);
-
- if (flags & QMediaPlayer::StreamPlayback)
- {
- /* if the flag is stream play back set the stream play back for the service provider */
- feature = QMediaServiceProviderHint::StreamPlayback;
- const QByteArray service(Q_MEDIASERVICE_MEDIAPLAYER);
- const QMediaServiceProviderHint providerHint(feature);
-
- /* request service for the service provider */
- provider.requestService(service,providerHint);
-
- /* Constructs a SupportedFeatures media service provider hint. */
- QMediaServiceProviderHint servicepro(feature);
-
- /* compare the flag value */
- QVERIFY(servicepro.features() == QMediaServiceProviderHint::StreamPlayback);
- }
-}
-
-void tst_QMediaPlayer::testDestructor()
-{
- /* create an object for player */
- QMediaPlayer *player = new QMediaPlayer;
-
- /* check whether the object is created */
- QVERIFY(player);
-
- /* delete the instance */
- delete player;
-}
-
-void tst_QMediaPlayer::testNetworkAccess()
-{
- QNetworkConfigurationManager manager;
- QList<QNetworkConfiguration> configs = manager.allConfigurations();
-
- if (configs.count() >= 1) {
- QSignalSpy spy(player, SIGNAL(networkConfigurationChanged(QNetworkConfiguration)));
- int index = qFloor((configs.count())/2);
- player->setNetworkConfigurations(configs);
- mockService->selectCurrentConfiguration(configs.at(index));
-
- QVERIFY(spy.count() == 1);
- QList<QVariant> args = spy.takeFirst();
- QNetworkConfiguration config = args.at(0).value<QNetworkConfiguration>();
- QCOMPARE(config.identifier() , configs.at(index).identifier());
- QCOMPARE(player->currentNetworkConfiguration().identifier() , config.identifier());
- }
-
- // invalidate current network configuration
- QSignalSpy spy(player, SIGNAL(networkConfigurationChanged(QNetworkConfiguration)));
- mockService->selectCurrentConfiguration(QNetworkConfiguration());
- QVERIFY(spy.count() == 1);
- QList<QVariant> args = spy.takeFirst();
- QNetworkConfiguration config = args.at(0).value<QNetworkConfiguration>();
- QVERIFY(config.isValid() == false);
- QVERIFY(player->currentNetworkConfiguration().isValid() == false);
-}
-
-void tst_QMediaPlayer::testSetVideoOutput()
-{
- MockVideoSurface surface;
-
- MockMediaPlayerService service;
- MockMediaServiceProvider provider(&service);
- QMediaPlayer player(0, 0, &provider);
-
- player.setVideoOutput(reinterpret_cast<QVideoWidget *>(0));
- player.setVideoOutput(reinterpret_cast<QGraphicsVideoItem *>(0));
-
- player.setVideoOutput(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
-
- player.setVideoOutput(reinterpret_cast<QAbstractVideoSurface *>(0));
- QVERIFY(service.rendererControl->surface() == 0);
-
- player.setVideoOutput(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
-
- player.setVideoOutput(reinterpret_cast<QVideoWidget *>(0));
- QVERIFY(service.rendererControl->surface() == 0);
-
- player.setVideoOutput(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
-}
-
-
-void tst_QMediaPlayer::testSetVideoOutputNoService()
-{
- MockVideoSurface surface;
-
- MockMediaServiceProvider provider(0, true);
- QMediaPlayer player(0, 0, &provider);
-
- player.setVideoOutput(&surface);
- // Nothing we can verify here other than it doesn't assert.
-}
-
-void tst_QMediaPlayer::testSetVideoOutputNoControl()
-{
- MockVideoSurface surface;
-
- MockMediaPlayerService service;
- service.rendererRef = 1;
-
- MockMediaServiceProvider provider(&service);
- QMediaPlayer player(0, 0, &provider);
-
- player.setVideoOutput(&surface);
- QVERIFY(service.rendererControl->surface() == 0);
-}
-
-void tst_QMediaPlayer::testSetVideoOutputDestruction()
-{
- MockVideoSurface surface;
-
- MockMediaPlayerService service;
- MockMediaServiceProvider provider(&service);
-
- {
- QMediaPlayer player(0, 0, &provider);
- player.setVideoOutput(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
- QCOMPARE(service.rendererRef, 1);
- }
- QVERIFY(service.rendererControl->surface() == 0);
- QCOMPARE(service.rendererRef, 0);
-}
-
-void tst_QMediaPlayer::testPositionPropertyWatch()
-{
- QMediaContent content0(QUrl(QLatin1String("test://audio/song1.mp3")));
- QMediaContent content1(QUrl(QLatin1String("test://audio/song2.mp3")));
-
- mockService->setIsValid(true);
- mockService->setState(QMediaPlayer::StoppedState, QMediaPlayer::NoMedia);
-
- QMediaPlaylist *playlist = new QMediaPlaylist;
-
- playlist->addMedia(content0);
- playlist->addMedia(content1);
-
- player->setPlaylist(playlist);
- player->setNotifyInterval(5);
-
- player->play();
- QSignalSpy positionSpy(player, SIGNAL(positionChanged(qint64)));
- playlist->next();
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QTRY_VERIFY(positionSpy.count() > 0);
-
- playlist->next();
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
-
- positionSpy.clear();
- QTRY_COMPARE(positionSpy.count(), 0);
-}
-
-void tst_QMediaPlayer::debugEnums()
-{
- QTest::ignoreMessage(QtDebugMsg, "QMediaPlayer::PlayingState ");
- qDebug() << QMediaPlayer::PlayingState;
- QTest::ignoreMessage(QtDebugMsg, "QMediaPlayer::NoMedia ");
- qDebug() << QMediaPlayer::NoMedia;
- QTest::ignoreMessage(QtDebugMsg, "QMediaPlayer::NetworkError ");
- qDebug() << QMediaPlayer::NetworkError;
-}
-
-void tst_QMediaPlayer::testSupportedMimeTypes()
-{
- QStringList mimeList = QMediaPlayer::supportedMimeTypes(QMediaPlayer::LowLatency);
-
- // This is empty on some platforms, and not on others, so can't test something here at the moment.
-}
diff --git a/tests/auto/qmediaplayer/tst_qmediaplayer.h b/tests/auto/qmediaplayer/tst_qmediaplayer.h
deleted file mode 100755
index 76a94cc..0000000
--- a/tests/auto/qmediaplayer/tst_qmediaplayer.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef TST_QMEDIAPLAYER_H
-#define TST_QMEDIAPLAYER_H
-
-#include <QtTest/QtTest>
-#include <QtCore/qdebug.h>
-#include <QtCore/qbuffer.h>
-#include <QtNetwork/qnetworkconfiguration.h>
-
-#include <qabstractvideosurface.h>
-#include <qmediaplayer.h>
-#include <qmediaplayercontrol.h>
-#include <qmediaplaylist.h>
-#include <qmediaservice.h>
-#include <qmediastreamscontrol.h>
-#include <qmedianetworkaccesscontrol.h>
-#include <qvideorenderercontrol.h>
-
-#include "mockmediaserviceprovider.h"
-#include "mockmediaplayerservice.h"
-
-QT_USE_NAMESPACE
-
-class AutoConnection
-{
-public:
- AutoConnection(QObject *sender, const char *signal, QObject *receiver, const char *method)
- : sender(sender), signal(signal), receiver(receiver), method(method)
- {
- QObject::connect(sender, signal, receiver, method);
- }
-
- ~AutoConnection()
- {
- QObject::disconnect(sender, signal, receiver, method);
- }
-
-private:
- QObject *sender;
- const char *signal;
- QObject *receiver;
- const char *method;
-};
-
-class tst_QMediaPlayer: public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase_data();
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
-private slots:
- void testNullService();
- void testValid();
- void testMedia();
- void testDuration();
- void testPosition();
- void testVolume();
- void testMuted();
- void testIsAvailable();
- void testVideoAvailable();
- void testBufferStatus();
- void testSeekable();
- void testPlaybackRate();
- void testError();
- void testErrorString();
- void testService();
- void testPlay();
- void testPause();
- void testStop();
- void testMediaStatus();
- void testPlaylist();
- void testNetworkAccess();
- void testSetVideoOutput();
- void testSetVideoOutputNoService();
- void testSetVideoOutputNoControl();
- void testSetVideoOutputDestruction();
- void testPositionPropertyWatch();
- void debugEnums();
- void testPlayerFlags();
- void testDestructor();
- void testSupportedMimeTypes();
-
-private:
- MockMediaServiceProvider *mockProvider;
- MockMediaPlayerService *mockService;
- QMediaPlayer *player;
-};
-
-#endif //TST_QMEDIAPLAYER_H
diff --git a/tests/auto/qmediaplayerbackend/qmediaplayerbackend.pro b/tests/auto/qmediaplayerbackend/qmediaplayerbackend.pro
deleted file mode 100644
index fdd941d..0000000
--- a/tests/auto/qmediaplayerbackend/qmediaplayerbackend.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = tst_qmediaplayerbackend
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-# This is more of a system test
-# CONFIG += testcase
-
-DEFINES += TESTDATA_DIR=\\\"$$PWD/\\\"
-
-SOURCES += \
- tst_qmediaplayerbackend.cpp
diff --git a/tests/auto/qmediaplayerbackend/testdata/test.wav b/tests/auto/qmediaplayerbackend/testdata/test.wav
deleted file mode 100644
index 4dd0226..0000000
--- a/tests/auto/qmediaplayerbackend/testdata/test.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
deleted file mode 100644
index 29e70c2..0000000
--- a/tests/auto/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ /dev/null
@@ -1,462 +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 <QtTest/QtTest>
-#include <QDebug>
-#include "qmediaservice.h"
-#include "qmediaplayer.h"
-
-//TESTED_COMPONENT=src/multimedia
-
-#ifndef TESTDATA_DIR
-#define TESTDATA_DIR "./"
-#endif
-
-QT_USE_NAMESPACE
-
-// Eventually these will make it into qtestcase.h
-// but we might need to tweak the timeout values here.
-#ifndef QTRY_COMPARE
-#define QTRY_COMPARE(__expr, __expected) \
- do { \
- const int __step = 50; \
- const int __timeout = 5000; \
- if ((__expr) != (__expected)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QCOMPARE(__expr, __expected); \
- } while(0)
-#endif
-
-#ifndef QTRY_VERIFY
-#define QTRY_VERIFY(__expr) \
- do { \
- const int __step = 50; \
- const int __timeout = 5000; \
- if (!(__expr)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QVERIFY(__expr); \
- } while(0)
-#endif
-
-
-#define QTRY_WAIT(code, __expr) \
- do { \
- const int __step = 50; \
- const int __timeout = 5000; \
- if (!(__expr)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
- do { code } while(0); \
- QTest::qWait(__step); \
- } \
- } while(0)
-
-
-/*
- This is the backend conformance test.
-
- Since it relies on platform media framework and sound hardware
- it may be less stable.
-*/
-
-class tst_QMediaPlayerBackend : public QObject
-{
- Q_OBJECT
-public slots:
- void init();
- void cleanup();
- void initTestCase();
-
-private slots:
- void construction();
- void loadMedia();
- void unloadMedia();
- void playPauseStop();
- void processEOS();
- void volumeAndMuted();
- void volumeAcrossFiles_data();
- void volumeAcrossFiles();
-
-private:
- //one second local wav file
- QMediaContent localWavFile;
-};
-
-void tst_QMediaPlayerBackend::init()
-{
-}
-
-void tst_QMediaPlayerBackend::initTestCase()
-{
- QFileInfo wavFile(QLatin1String(TESTDATA_DIR "testdata/test.wav"));
- QVERIFY(wavFile.exists());
-
- localWavFile = QMediaContent(QUrl::fromLocalFile(wavFile.absoluteFilePath()));
-
- qRegisterMetaType<QMediaContent>();
-}
-
-void tst_QMediaPlayerBackend::cleanup()
-{
-}
-
-void tst_QMediaPlayerBackend::construction()
-{
- QMediaPlayer player;
- QVERIFY(player.isAvailable());
-}
-
-void tst_QMediaPlayerBackend::loadMedia()
-{
- QMediaPlayer player;
- QCOMPARE(player.state(), QMediaPlayer::StoppedState);
- QCOMPARE(player.mediaStatus(), QMediaPlayer::NoMedia);
-
- QSignalSpy stateSpy(&player, SIGNAL(stateChanged(QMediaPlayer::State)));
- QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
- QSignalSpy mediaSpy(&player, SIGNAL(mediaChanged(QMediaContent)));
-
- player.setMedia(localWavFile);
-
- QCOMPARE(player.state(), QMediaPlayer::StoppedState);
-
- QVERIFY(player.mediaStatus() != QMediaPlayer::NoMedia);
- QVERIFY(player.mediaStatus() != QMediaPlayer::InvalidMedia);
- QVERIFY(player.media() == localWavFile);
-
- QCOMPARE(stateSpy.count(), 0);
- QVERIFY(statusSpy.count() > 0);
- QCOMPARE(mediaSpy.count(), 1);
- QCOMPARE(mediaSpy.last()[0].value<QMediaContent>(), localWavFile);
-
- QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::LoadedMedia);
-
- QVERIFY(player.isAudioAvailable());
- QVERIFY(!player.isVideoAvailable());
-}
-
-void tst_QMediaPlayerBackend::unloadMedia()
-{
- QMediaPlayer player;
- player.setNotifyInterval(50);
-
- QSignalSpy stateSpy(&player, SIGNAL(stateChanged(QMediaPlayer::State)));
- QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
- QSignalSpy mediaSpy(&player, SIGNAL(mediaChanged(QMediaContent)));
- QSignalSpy positionSpy(&player, SIGNAL(positionChanged(qint64)));
- QSignalSpy durationSpy(&player, SIGNAL(positionChanged(qint64)));
-
- player.setMedia(localWavFile);
-
- QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::LoadedMedia);
-
- QVERIFY(player.position() == 0);
- QVERIFY(player.duration() > 0);
-
- player.play();
-
- QTest::qWait(250);
- QVERIFY(player.position() > 0);
- QVERIFY(player.duration() > 0);
-
- stateSpy.clear();
- statusSpy.clear();
- mediaSpy.clear();
- positionSpy.clear();
- durationSpy.clear();
-
- player.setMedia(QMediaContent());
-
- QVERIFY(player.position() <= 0);
- QVERIFY(player.duration() <= 0);
- QCOMPARE(player.state(), QMediaPlayer::StoppedState);
- QCOMPARE(player.mediaStatus(), QMediaPlayer::NoMedia);
- QCOMPARE(player.media(), QMediaContent());
-
- QVERIFY(!stateSpy.isEmpty());
- QVERIFY(!statusSpy.isEmpty());
- QVERIFY(!mediaSpy.isEmpty());
- QVERIFY(!positionSpy.isEmpty());
-}
-
-
-void tst_QMediaPlayerBackend::playPauseStop()
-{
- QMediaPlayer player;
- player.setNotifyInterval(50);
-
- QSignalSpy stateSpy(&player, SIGNAL(stateChanged(QMediaPlayer::State)));
- QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
- QSignalSpy positionSpy(&player, SIGNAL(positionChanged(qint64)));
-
- player.setMedia(localWavFile);
-
- QCOMPARE(player.position(), qint64(0));
-
- player.play();
-
- QCOMPARE(player.state(), QMediaPlayer::PlayingState);
-
- QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::BufferedMedia);
-
- QCOMPARE(stateSpy.count(), 1);
- QCOMPARE(stateSpy.last()[0].value<QMediaPlayer::State>(), QMediaPlayer::PlayingState);
- QTRY_VERIFY(statusSpy.count() > 0 &&
- statusSpy.last()[0].value<QMediaPlayer::MediaStatus>() == QMediaPlayer::BufferedMedia);
-
- QTest::qWait(500);
- QVERIFY(player.position() > 0);
- QVERIFY(player.duration() > 0);
- QVERIFY(positionSpy.count() > 0);
- QVERIFY(positionSpy.last()[0].value<qint64>() > 0);
-
- stateSpy.clear();
- statusSpy.clear();
-
- player.pause();
-
- QCOMPARE(player.state(), QMediaPlayer::PausedState);
- QCOMPARE(player.mediaStatus(), QMediaPlayer::BufferedMedia);
-
- QCOMPARE(stateSpy.count(), 1);
- QCOMPARE(stateSpy.last()[0].value<QMediaPlayer::State>(), QMediaPlayer::PausedState);
-
- stateSpy.clear();
- statusSpy.clear();
-
- player.stop();
-
- QCOMPARE(player.state(), QMediaPlayer::StoppedState);
- QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::LoadedMedia);
-
- QCOMPARE(stateSpy.count(), 1);
- QCOMPARE(stateSpy.last()[0].value<QMediaPlayer::State>(), QMediaPlayer::StoppedState);
- //it's allowed to emit statusChanged() signal async
- QTRY_COMPARE(statusSpy.count(), 1);
- QCOMPARE(statusSpy.last()[0].value<QMediaPlayer::MediaStatus>(), QMediaPlayer::LoadedMedia);
-
- //ensure the position is reset to 0 at stop and positionChanged(0) is emitted
- QCOMPARE(player.position(), qint64(0));
- QCOMPARE(positionSpy.last()[0].value<qint64>(), qint64(0));
- QVERIFY(player.duration() > 0);
-}
-
-
-void tst_QMediaPlayerBackend::processEOS()
-{
- QMediaPlayer player;
- player.setNotifyInterval(50);
-
- QSignalSpy stateSpy(&player, SIGNAL(stateChanged(QMediaPlayer::State)));
- QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
- QSignalSpy positionSpy(&player, SIGNAL(positionChanged(qint64)));
-
- player.setMedia(localWavFile);
-
- player.play();
- player.setPosition(900);
-
- //wait up to 5 seconds for EOS
- QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::EndOfMedia);
-
- QVERIFY(statusSpy.count() > 0);
- QCOMPARE(statusSpy.last()[0].value<QMediaPlayer::MediaStatus>(), QMediaPlayer::EndOfMedia);
-
- //at EOS the position stays at the end of file
- QVERIFY(player.position() > 900);
-
- stateSpy.clear();
- statusSpy.clear();
-
- player.play();
-
- //position is reset to start
- QTRY_VERIFY(player.position() < 100);
-
- QCOMPARE(player.state(), QMediaPlayer::PlayingState);
- QCOMPARE(player.mediaStatus(), QMediaPlayer::BufferedMedia);
-
- QCOMPARE(stateSpy.count(), 1);
- QCOMPARE(stateSpy.last()[0].value<QMediaPlayer::State>(), QMediaPlayer::PlayingState);
- QVERIFY(statusSpy.count() > 0);
- QCOMPARE(statusSpy.last()[0].value<QMediaPlayer::MediaStatus>(), QMediaPlayer::BufferedMedia);
-
- player.setPosition(900);
- //wait up to 5 seconds for EOS
- QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::EndOfMedia);
-
- //ensure the positionChanged() signal is emitted
- QVERIFY(positionSpy.count() > 0);
-
- QCOMPARE(player.mediaStatus(), QMediaPlayer::EndOfMedia);
- //position stays at the end of file
- QVERIFY(player.position() > 900);
-
- //after setPosition EndOfMedia status should be reset to Loaded
- stateSpy.clear();
- statusSpy.clear();
- player.setPosition(500);
-
- //this transition can be async, so allow backend to perform it
- QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::LoadedMedia);
-
- QCOMPARE(stateSpy.count(), 0);
- QTRY_VERIFY(statusSpy.count() > 0 &&
- statusSpy.last()[0].value<QMediaPlayer::MediaStatus>() == QMediaPlayer::LoadedMedia);
-}
-
-void tst_QMediaPlayerBackend::volumeAndMuted()
-{
- //volume and muted properties should be independent
- QMediaPlayer player;
- QVERIFY(player.volume() > 0);
- QVERIFY(!player.isMuted());
-
- player.setMedia(localWavFile);
- player.pause();
-
- QVERIFY(player.volume() > 0);
- QVERIFY(!player.isMuted());
-
- QSignalSpy volumeSpy(&player, SIGNAL(volumeChanged(int)));
- QSignalSpy mutedSpy(&player, SIGNAL(mutedChanged(bool)));
-
- //setting volume to 0 should not trigger muted
- player.setVolume(0);
- QTRY_COMPARE(player.volume(), 0);
- QVERIFY(!player.isMuted());
- QCOMPARE(volumeSpy.count(), 1);
- QCOMPARE(volumeSpy.last()[0].toInt(), player.volume());
- QCOMPARE(mutedSpy.count(), 0);
-
- player.setVolume(50);
- QTRY_COMPARE(player.volume(), 50);
- QVERIFY(!player.isMuted());
- QCOMPARE(volumeSpy.count(), 2);
- QCOMPARE(volumeSpy.last()[0].toInt(), player.volume());
- QCOMPARE(mutedSpy.count(), 0);
-
- player.setMuted(true);
- QTRY_VERIFY(player.isMuted());
- QVERIFY(player.volume() > 0);
- QCOMPARE(volumeSpy.count(), 2);
- QCOMPARE(mutedSpy.count(), 1);
- QCOMPARE(mutedSpy.last()[0].toBool(), player.isMuted());
-
- player.setMuted(false);
- QTRY_VERIFY(!player.isMuted());
- QVERIFY(player.volume() > 0);
- QCOMPARE(volumeSpy.count(), 2);
- QCOMPARE(mutedSpy.count(), 2);
- QCOMPARE(mutedSpy.last()[0].toBool(), player.isMuted());
-
-}
-
-void tst_QMediaPlayerBackend::volumeAcrossFiles_data()
-{
- QTest::addColumn<int>("volume");
- QTest::addColumn<bool>("muted");
-
- QTest::newRow("100 unmuted") << 100 << false;
- QTest::newRow("50 unmuted") << 50 << false;
- QTest::newRow("0 unmuted") << 0 << false;
- QTest::newRow("100 muted") << 100 << true;
- QTest::newRow("50 muted") << 50 << true;
- QTest::newRow("0 muted") << 0 << true;
-}
-
-void tst_QMediaPlayerBackend::volumeAcrossFiles()
-{
- QFETCH(int, volume);
- QFETCH(bool, muted);
-
- QMediaPlayer player;
-
- //volume and muted should not be preserved between player instances
- QVERIFY(player.volume() > 0);
- QVERIFY(!player.isMuted());
-
- player.setVolume(volume);
- player.setMuted(muted);
-
- QTRY_COMPARE(player.volume(), volume);
- QTRY_COMPARE(player.isMuted(), muted);
-
- player.setMedia(localWavFile);
- QCOMPARE(player.volume(), volume);
- QCOMPARE(player.isMuted(), muted);
-
- player.pause();
-
- //to ensure the backend doesn't change volume/muted
- //async during file loading.
- QTest::qWait(50);
-
- QCOMPARE(player.volume(), volume);
- QCOMPARE(player.isMuted(), muted);
-
- player.setMedia(QMediaContent());
- QTest::qWait(50);
- QCOMPARE(player.volume(), volume);
- QCOMPARE(player.isMuted(), muted);
-
- player.setMedia(localWavFile);
- player.pause();
-
- QTest::qWait(50);
-
- QCOMPARE(player.volume(), volume);
- QCOMPARE(player.isMuted(), muted);
-}
-
-
-QTEST_MAIN(tst_QMediaPlayerBackend)
-#include "tst_qmediaplayerbackend.moc"
-
diff --git a/tests/auto/qmediaplayerwidgets/main.cpp b/tests/auto/qmediaplayerwidgets/main.cpp
deleted file mode 100755
index e7614c9..0000000
--- a/tests/auto/qmediaplayerwidgets/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtWidgets/QApplication>
-#include <QtTest/QtTest>
-
-#include "tst_qmediaplayerwidgets.h"
-
-int main(int argc, char**argv)
-{
- QApplication app(argc,argv);
- int ret;
- tst_QMediaPlayerWidgets test_api;
- ret = QTest::qExec(&test_api, argc, argv);
- return ret;
-}
diff --git a/tests/auto/qmediaplayerwidgets/qmediaplayerwidgets.pro b/tests/auto/qmediaplayerwidgets/qmediaplayerwidgets.pro
deleted file mode 100644
index c5c6029..0000000
--- a/tests/auto/qmediaplayerwidgets/qmediaplayerwidgets.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediaplayerwidgets
-
-QT += network multimedia-private multimediawidgets-private testlib widgets
-CONFIG += no_private_qt_headers_warning
-
-HEADERS += tst_qmediaplayerwidgets.h
-SOURCES += main.cpp tst_qmediaplayerwidgets.cpp
-
-include (../qmultimedia_common/mock.pri)
-include (../qmultimedia_common/mockplayer.pri)
diff --git a/tests/auto/qmediaplayerwidgets/tst_qmediaplayerwidgets.cpp b/tests/auto/qmediaplayerwidgets/tst_qmediaplayerwidgets.cpp
deleted file mode 100644
index ac9ffa0..0000000
--- a/tests/auto/qmediaplayerwidgets/tst_qmediaplayerwidgets.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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-#include "tst_qmediaplayerwidgets.h"
-#include "mockvideosurface.h"
-#include <qgraphicsvideoitem.h>
-
-QT_USE_NAMESPACE
-
-void tst_QMediaPlayerWidgets::initTestCase()
-{
- qRegisterMetaType<QMediaPlayer::State>("QMediaPlayer::State");
- qRegisterMetaType<QMediaPlayer::Error>("QMediaPlayer::Error");
- qRegisterMetaType<QMediaPlayer::MediaStatus>("QMediaPlayer::MediaStatus");
- qRegisterMetaType<QMediaContent>("QMediaContent");
-
- mockService = new MockMediaPlayerService;
- mockProvider = new MockMediaServiceProvider(mockService, true);
- player = new QMediaPlayer(0, 0, mockProvider);
-}
-
-void tst_QMediaPlayerWidgets::cleanupTestCase()
-{
- delete player;
-}
-
-void tst_QMediaPlayerWidgets::init()
-{
- mockService->reset();
-}
-
-void tst_QMediaPlayerWidgets::cleanup()
-{
-}
-
-void tst_QMediaPlayerWidgets::testSetVideoOutput()
-{
- QVideoWidget widget;
- QGraphicsVideoItem item;
- MockVideoSurface surface;
-
- MockMediaPlayerService service;
- MockMediaServiceProvider provider(&service);
- QMediaPlayer player(0, 0, &provider);
-
- player.setVideoOutput(&widget);
- QVERIFY(widget.mediaObject() == &player);
-
- player.setVideoOutput(&item);
- QVERIFY(widget.mediaObject() == 0);
- QVERIFY(item.mediaObject() == &player);
-
- player.setVideoOutput(reinterpret_cast<QVideoWidget *>(0));
- QVERIFY(item.mediaObject() == 0);
-
- player.setVideoOutput(&widget);
- QVERIFY(widget.mediaObject() == &player);
-
- player.setVideoOutput(reinterpret_cast<QGraphicsVideoItem *>(0));
- QVERIFY(widget.mediaObject() == 0);
-
- player.setVideoOutput(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
-
- player.setVideoOutput(reinterpret_cast<QAbstractVideoSurface *>(0));
- QVERIFY(service.rendererControl->surface() == 0);
-
- player.setVideoOutput(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
-
- player.setVideoOutput(&widget);
- QVERIFY(service.rendererControl->surface() == 0);
- QVERIFY(widget.mediaObject() == &player);
-
- player.setVideoOutput(&surface);
- QVERIFY(service.rendererControl->surface() == &surface);
- QVERIFY(widget.mediaObject() == 0);
-}
-
-
-void tst_QMediaPlayerWidgets::testSetVideoOutputNoService()
-{
- QVideoWidget widget;
- QGraphicsVideoItem item;
- MockVideoSurface surface;
-
- MockMediaServiceProvider provider(0, true);
- QMediaPlayer player(0, 0, &provider);
-
- player.setVideoOutput(&widget);
- QVERIFY(widget.mediaObject() == 0);
-
- player.setVideoOutput(&item);
- QVERIFY(item.mediaObject() == 0);
-
- player.setVideoOutput(&surface);
- // Nothing we can verify here other than it doesn't assert.
-}
-
-void tst_QMediaPlayerWidgets::testSetVideoOutputNoControl()
-{
- QVideoWidget widget;
- QGraphicsVideoItem item;
- MockVideoSurface surface;
-
- MockMediaPlayerService service;
- service.rendererRef = 1;
- service.windowRef = 1;
-
- MockMediaServiceProvider provider(&service);
- QMediaPlayer player(0, 0, &provider);
-
- player.setVideoOutput(&widget);
- QVERIFY(widget.mediaObject() == 0);
-
- player.setVideoOutput(&item);
- QVERIFY(item.mediaObject() == 0);
-
- player.setVideoOutput(&surface);
- QVERIFY(service.rendererControl->surface() == 0);
-}
-
diff --git a/tests/auto/qmediaplayerwidgets/tst_qmediaplayerwidgets.h b/tests/auto/qmediaplayerwidgets/tst_qmediaplayerwidgets.h
deleted file mode 100755
index e5f9b67..0000000
--- a/tests/auto/qmediaplayerwidgets/tst_qmediaplayerwidgets.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 TST_QMEDIAPLAYER_H
-#define TST_QMEDIAPLAYER_H
-
-#include <QtTest/QtTest>
-#include <QtCore/qdebug.h>
-#include <QtCore/qbuffer.h>
-#include <QtNetwork/qnetworkconfiguration.h>
-
-#include <qabstractvideosurface.h>
-#include <qmediaplayer.h>
-#include <qmediaplayercontrol.h>
-
-#include "mockmediaserviceprovider.h"
-#include "mockmediaplayerservice.h"
-
-QT_USE_NAMESPACE
-
-class tst_QMediaPlayerWidgets: public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
-private slots:
- void testSetVideoOutput();
- void testSetVideoOutputNoService();
- void testSetVideoOutputNoControl();
-
-private:
- MockMediaServiceProvider *mockProvider;
- MockMediaPlayerService *mockService;
- QMediaPlayer *player;
-};
-
-#endif //TST_QMEDIAPLAYER_H
diff --git a/tests/auto/qmediaplaylist/qmediaplaylist.pro b/tests/auto/qmediaplaylist/qmediaplaylist.pro
deleted file mode 100644
index d028343..0000000
--- a/tests/auto/qmediaplaylist/qmediaplaylist.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediaplaylist
-
-# temporarily blacklist test because is fails miserably
-CONFIG += insignificant_test
-
-include (../qmultimedia_common/mockplaylist.pri)
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-DEFINES += TESTDATA_DIR=\\\"$$PWD/\\\"
-
-HEADERS += \
- $$QT.multimedia.sources/../plugins/m3u/qm3uhandler.h
-
-SOURCES += \
- tst_qmediaplaylist.cpp \
- $$QT.multimedia.sources/../plugins/m3u/qm3uhandler.cpp
-
-INCLUDEPATH += $$QT.multimedia.sources/../plugins/m3u
diff --git a/tests/auto/qmediaplaylist/testdata/test.m3u b/tests/auto/qmediaplaylist/testdata/test.m3u
deleted file mode 100644
index e5cb7c8..0000000
--- a/tests/auto/qmediaplaylist/testdata/test.m3u
+++ /dev/null
@@ -1,11 +0,0 @@
-#comment
-
-http://test.host/path
- http://test.host/path
-testfile
-
-
-testdir/testfile
-/testdir/testfile
-file://path/name#suffix
-testfile2#suffix
diff --git a/tests/auto/qmediaplaylist/testdata/testfile b/tests/auto/qmediaplaylist/testdata/testfile
deleted file mode 100644
index e69de29..0000000
--- a/tests/auto/qmediaplaylist/testdata/testfile
+++ /dev/null
diff --git a/tests/auto/qmediaplaylist/testdata/testfile2#suffix b/tests/auto/qmediaplaylist/testdata/testfile2#suffix
deleted file mode 100644
index e69de29..0000000
--- a/tests/auto/qmediaplaylist/testdata/testfile2#suffix
+++ /dev/null
diff --git a/tests/auto/qmediaplaylist/tst_qmediaplaylist.cpp b/tests/auto/qmediaplaylist/tst_qmediaplaylist.cpp
deleted file mode 100644
index e200243..0000000
--- a/tests/auto/qmediaplaylist/tst_qmediaplaylist.cpp
+++ /dev/null
@@ -1,783 +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 <QtTest/QtTest>
-#include <QDebug>
-#include "qmediaservice.h"
-#include "qmediaplaylist.h"
-#include "qmediaplaylistcontrol.h"
-#include "qmediaplaylistsourcecontrol.h"
-#include "qmediaplaylistnavigator.h"
-#include <private/qmediapluginloader_p.h>
-
-#include "qm3uhandler.h"
-
-//TESTED_COMPONENT=src/multimedia
-
-#include "mockplaylistservice.h"
-#include "mockmediaplaylistcontrol.h"
-#include "mockmediaplaylistsourcecontrol.h"
-#include "mockreadonlyplaylistprovider.h"
-
-#ifndef TESTDATA_DIR
-#define TESTDATA_DIR "./"
-#endif
-
-QT_USE_NAMESPACE
-
-class MockReadOnlyPlaylistObject : public QMediaObject
-{
- Q_OBJECT
-public:
- MockReadOnlyPlaylistObject(QObject *parent = 0)
- :QMediaObject(parent, new MockPlaylistService)
- {
- }
-};
-
-class tst_QMediaPlaylist : public QObject
-{
- Q_OBJECT
-public slots:
- void init();
- void cleanup();
- void initTestCase();
-
-private slots:
- void construction();
- void append();
- void insert();
- void clear();
- void removeMedia();
- void currentItem();
- void saveAndLoad();
- void loadM3uFile();
- void playbackMode();
- void playbackMode_data();
- void shuffle();
- void readOnlyPlaylist();
- void setMediaObject();
-
- void testCurrentIndexChanged_signal();
- void testCurrentMediaChanged_signal();
- void testLoaded_signal();
- void testMediaChanged_signal();
- void testPlaybackModeChanged_signal();
- void testEnums();
-
- void mediaPlayListProvider();
- // TC for Abstract control classes
- void mediaPlayListControl();
- void mediaPlayListSourceControl();
-
-
-private:
- QMediaContent content1;
- QMediaContent content2;
- QMediaContent content3;
-};
-
-void tst_QMediaPlaylist::init()
-{
-}
-
-void tst_QMediaPlaylist::initTestCase()
-{
- qRegisterMetaType<QMediaContent>();
- content1 = QMediaContent(QUrl(QLatin1String("file:///1")));
- content2 = QMediaContent(QUrl(QLatin1String("file:///2")));
- content3 = QMediaContent(QUrl(QLatin1String("file:///3")));
-
- QMediaPluginLoader::setStaticPlugins(QLatin1String("playlistformats"), QObjectList() << new QM3uPlaylistPlugin(this));
-}
-
-void tst_QMediaPlaylist::cleanup()
-{
-}
-
-void tst_QMediaPlaylist::construction()
-{
- QMediaPlaylist playlist;
- QCOMPARE(playlist.mediaCount(), 0);
- QVERIFY(playlist.isEmpty());
-}
-
-void tst_QMediaPlaylist::append()
-{
- QMediaPlaylist playlist;
- QVERIFY(!playlist.isReadOnly());
-
- playlist.addMedia(content1);
- QCOMPARE(playlist.mediaCount(), 1);
- QCOMPARE(playlist.media(0), content1);
-
- QSignalSpy aboutToBeInsertedSignalSpy(&playlist, SIGNAL(mediaAboutToBeInserted(int,int)));
- QSignalSpy insertedSignalSpy(&playlist, SIGNAL(mediaInserted(int,int)));
- playlist.addMedia(content2);
- QCOMPARE(playlist.mediaCount(), 2);
- QCOMPARE(playlist.media(1), content2);
-
- QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 1);
-
- QCOMPARE(insertedSignalSpy.count(), 1);
- QCOMPARE(insertedSignalSpy.first()[0].toInt(), 1);
- QCOMPARE(insertedSignalSpy.first()[1].toInt(), 1);
-
- aboutToBeInsertedSignalSpy.clear();
- insertedSignalSpy.clear();
-
- QMediaContent content4(QUrl(QLatin1String("file:///4")));
- QMediaContent content5(QUrl(QLatin1String("file:///5")));
- playlist.addMedia(QList<QMediaContent>() << content3 << content4 << content5);
- QCOMPARE(playlist.mediaCount(), 5);
- QCOMPARE(playlist.media(2), content3);
- QCOMPARE(playlist.media(3), content4);
- QCOMPARE(playlist.media(4), content5);
-
- QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy[0][0].toInt(), 2);
- QCOMPARE(aboutToBeInsertedSignalSpy[0][1].toInt(), 4);
-
- QCOMPARE(insertedSignalSpy.count(), 1);
- QCOMPARE(insertedSignalSpy[0][0].toInt(), 2);
- QCOMPARE(insertedSignalSpy[0][1].toInt(), 4);
-
- aboutToBeInsertedSignalSpy.clear();
- insertedSignalSpy.clear();
-
- playlist.addMedia(QList<QMediaContent>());
- QCOMPARE(aboutToBeInsertedSignalSpy.count(), 0);
- QCOMPARE(insertedSignalSpy.count(), 0);
-}
-
-void tst_QMediaPlaylist::insert()
-{
- QMediaPlaylist playlist;
- QVERIFY(!playlist.isReadOnly());
-
- playlist.addMedia(content1);
- QCOMPARE(playlist.mediaCount(), 1);
- QCOMPARE(playlist.media(0), content1);
-
- playlist.addMedia(content2);
- QCOMPARE(playlist.mediaCount(), 2);
- QCOMPARE(playlist.media(1), content2);
-
- QSignalSpy aboutToBeInsertedSignalSpy(&playlist, SIGNAL(mediaAboutToBeInserted(int,int)));
- QSignalSpy insertedSignalSpy(&playlist, SIGNAL(mediaInserted(int,int)));
-
- playlist.insertMedia(1, content3);
- QCOMPARE(playlist.mediaCount(), 3);
- QCOMPARE(playlist.media(0), content1);
- QCOMPARE(playlist.media(1), content3);
- QCOMPARE(playlist.media(2), content2);
-
- QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 1);
-
- QCOMPARE(insertedSignalSpy.count(), 1);
- QCOMPARE(insertedSignalSpy.first()[0].toInt(), 1);
- QCOMPARE(insertedSignalSpy.first()[1].toInt(), 1);
-
- aboutToBeInsertedSignalSpy.clear();
- insertedSignalSpy.clear();
-
- QMediaContent content4(QUrl(QLatin1String("file:///4")));
- QMediaContent content5(QUrl(QLatin1String("file:///5")));
- playlist.insertMedia(1, QList<QMediaContent>() << content4 << content5);
-
- QCOMPARE(playlist.media(0), content1);
- QCOMPARE(playlist.media(1), content4);
- QCOMPARE(playlist.media(2), content5);
- QCOMPARE(playlist.media(3), content3);
- QCOMPARE(playlist.media(4), content2);
- QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy[0][0].toInt(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy[0][1].toInt(), 2);
-
- QCOMPARE(insertedSignalSpy.count(), 1);
- QCOMPARE(insertedSignalSpy[0][0].toInt(), 1);
- QCOMPARE(insertedSignalSpy[0][1].toInt(), 2);
-
- aboutToBeInsertedSignalSpy.clear();
- insertedSignalSpy.clear();
-
- playlist.insertMedia(1, QList<QMediaContent>());
- QCOMPARE(aboutToBeInsertedSignalSpy.count(), 0);
- QCOMPARE(insertedSignalSpy.count(), 0);
-}
-
-
-void tst_QMediaPlaylist::currentItem()
-{
- QMediaPlaylist playlist;
- playlist.addMedia(content1);
- playlist.addMedia(content2);
-
- QCOMPARE(playlist.currentIndex(), -1);
- QCOMPARE(playlist.currentMedia(), QMediaContent());
-
- QCOMPARE(playlist.nextIndex(), 0);
- QCOMPARE(playlist.nextIndex(2), 1);
- QCOMPARE(playlist.previousIndex(), 1);
- QCOMPARE(playlist.previousIndex(2), 0);
-
- playlist.setCurrentIndex(0);
- QCOMPARE(playlist.currentIndex(), 0);
- QCOMPARE(playlist.currentMedia(), content1);
-
- QCOMPARE(playlist.nextIndex(), 1);
- QCOMPARE(playlist.nextIndex(2), -1);
- QCOMPARE(playlist.previousIndex(), -1);
- QCOMPARE(playlist.previousIndex(2), -1);
-
- playlist.setCurrentIndex(1);
- QCOMPARE(playlist.currentIndex(), 1);
- QCOMPARE(playlist.currentMedia(), content2);
-
- QCOMPARE(playlist.nextIndex(), -1);
- QCOMPARE(playlist.nextIndex(2), -1);
- QCOMPARE(playlist.previousIndex(), 0);
- QCOMPARE(playlist.previousIndex(2), -1);
-
- QTest::ignoreMessage(QtWarningMsg, "QMediaPlaylistNavigator: Jump outside playlist range ");
- playlist.setCurrentIndex(2);
-
- QCOMPARE(playlist.currentIndex(), -1);
- QCOMPARE(playlist.currentMedia(), QMediaContent());
-}
-
-void tst_QMediaPlaylist::clear()
-{
- QMediaPlaylist playlist;
- playlist.addMedia(content1);
- playlist.addMedia(content2);
-
- playlist.clear();
- QVERIFY(playlist.isEmpty());
- QCOMPARE(playlist.mediaCount(), 0);
-}
-
-void tst_QMediaPlaylist::removeMedia()
-{
- QMediaPlaylist playlist;
- playlist.addMedia(content1);
- playlist.addMedia(content2);
- playlist.addMedia(content3);
-
- QSignalSpy aboutToBeRemovedSignalSpy(&playlist, SIGNAL(mediaAboutToBeRemoved(int,int)));
- QSignalSpy removedSignalSpy(&playlist, SIGNAL(mediaRemoved(int,int)));
- playlist.removeMedia(1);
- QCOMPARE(playlist.mediaCount(), 2);
- QCOMPARE(playlist.media(1), content3);
-
- QCOMPARE(aboutToBeRemovedSignalSpy.count(), 1);
- QCOMPARE(aboutToBeRemovedSignalSpy.first()[0].toInt(), 1);
- QCOMPARE(aboutToBeRemovedSignalSpy.first()[1].toInt(), 1);
-
- QCOMPARE(removedSignalSpy.count(), 1);
- QCOMPARE(removedSignalSpy.first()[0].toInt(), 1);
- QCOMPARE(removedSignalSpy.first()[1].toInt(), 1);
-
- aboutToBeRemovedSignalSpy.clear();
- removedSignalSpy.clear();
-
- playlist.removeMedia(0,1);
- QVERIFY(playlist.isEmpty());
-
- QCOMPARE(aboutToBeRemovedSignalSpy.count(), 1);
- QCOMPARE(aboutToBeRemovedSignalSpy.first()[0].toInt(), 0);
- QCOMPARE(aboutToBeRemovedSignalSpy.first()[1].toInt(), 1);
-
- QCOMPARE(removedSignalSpy.count(), 1);
- QCOMPARE(removedSignalSpy.first()[0].toInt(), 0);
- QCOMPARE(removedSignalSpy.first()[1].toInt(), 1);
-
-
- playlist.addMedia(content1);
- playlist.addMedia(content2);
- playlist.addMedia(content3);
-
- playlist.removeMedia(0,1);
- QCOMPARE(playlist.mediaCount(), 1);
- QCOMPARE(playlist.media(0), content3);
-}
-
-void tst_QMediaPlaylist::saveAndLoad()
-{
- QMediaPlaylist playlist;
- playlist.addMedia(content1);
- playlist.addMedia(content2);
- playlist.addMedia(content3);
-
- QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
- QVERIFY(playlist.errorString().isEmpty());
-
- QBuffer buffer;
- buffer.open(QBuffer::ReadWrite);
-
- bool res = playlist.save(&buffer, "unsupported_format");
- QVERIFY(!res);
- QVERIFY(playlist.error() == QMediaPlaylist::FormatNotSupportedError);
- QVERIFY(!playlist.errorString().isEmpty());
-
- QSignalSpy errorSignal(&playlist, SIGNAL(loadFailed()));
- playlist.load(&buffer, "unsupported_format");
- QCOMPARE(errorSignal.size(), 1);
- QVERIFY(playlist.error() != QMediaPlaylist::NoError);
- QVERIFY(!playlist.errorString().isEmpty());
-
- res = playlist.save(QUrl(QLatin1String("tmp.unsupported_format")), "unsupported_format");
- QVERIFY(!res);
- QVERIFY(playlist.error() != QMediaPlaylist::NoError);
- QVERIFY(!playlist.errorString().isEmpty());
-
- errorSignal.clear();
- playlist.load(QUrl(QLatin1String("tmp.unsupported_format")), "unsupported_format");
- QCOMPARE(errorSignal.size(), 1);
- QVERIFY(playlist.error() == QMediaPlaylist::FormatNotSupportedError);
- QVERIFY(!playlist.errorString().isEmpty());
-
- res = playlist.save(&buffer, "m3u");
-
- QVERIFY(res);
- QVERIFY(buffer.pos() > 0);
- buffer.seek(0);
-
- QMediaPlaylist playlist2;
- playlist2.load(&buffer, "m3u");
- QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
-
- QCOMPARE(playlist.mediaCount(), playlist2.mediaCount());
- QCOMPARE(playlist.media(0), playlist2.media(0));
- QCOMPARE(playlist.media(1), playlist2.media(1));
- QCOMPARE(playlist.media(3), playlist2.media(3));
- res = playlist.save(QUrl(QLatin1String("tmp.m3u")), "m3u");
- QVERIFY(res);
-
- playlist2.clear();
- QVERIFY(playlist2.isEmpty());
- playlist2.load(QUrl(QLatin1String("tmp.m3u")), "m3u");
- QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
-
- QCOMPARE(playlist.mediaCount(), playlist2.mediaCount());
- QCOMPARE(playlist.media(0), playlist2.media(0));
- QCOMPARE(playlist.media(1), playlist2.media(1));
- QCOMPARE(playlist.media(3), playlist2.media(3));
-}
-
-void tst_QMediaPlaylist::loadM3uFile()
-{
- QMediaPlaylist playlist;
-
- playlist.load(QUrl::fromLocalFile(QLatin1String(TESTDATA_DIR "testdata/missing_file.m3u")));
- QVERIFY(playlist.error() != QMediaPlaylist::NoError);
-
- playlist.load(QUrl::fromLocalFile(QLatin1String(TESTDATA_DIR "testdata/test.m3u")));
- QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
- QCOMPARE(playlist.mediaCount(), 7);
-
- QCOMPARE(playlist.media(0).canonicalUrl(), QUrl(QLatin1String("http://test.host/path")));
- QCOMPARE(playlist.media(1).canonicalUrl(), QUrl(QLatin1String("http://test.host/path")));
- QCOMPARE(playlist.media(2).canonicalUrl(),
- QUrl(QLatin1String("file://" TESTDATA_DIR "testdata/testfile")));
- QCOMPARE(playlist.media(3).canonicalUrl(),
- QUrl(QLatin1String("file://" TESTDATA_DIR "testdata/testdir/testfile")));
- QCOMPARE(playlist.media(4).canonicalUrl(), QUrl(QLatin1String("file:///testdir/testfile")));
- QCOMPARE(playlist.media(5).canonicalUrl(), QUrl(QLatin1String("file://path/name#suffix")));
- //ensure #2 suffix is not stripped from path
- QCOMPARE(playlist.media(6).canonicalUrl(), QUrl::fromLocalFile(TESTDATA_DIR "testdata/testfile2#suffix"));
-}
-
-void tst_QMediaPlaylist::playbackMode_data()
-{
- QTest::addColumn<QMediaPlaylist::PlaybackMode>("playbackMode");
- QTest::addColumn<int>("expectedPrevious");
- QTest::addColumn<int>("pos");
- QTest::addColumn<int>("expectedNext");
-
- QTest::newRow("Sequential, 0") << QMediaPlaylist::Sequential << -1 << 0 << 1;
- QTest::newRow("Sequential, 1") << QMediaPlaylist::Sequential << 0 << 1 << 2;
- QTest::newRow("Sequential, 2") << QMediaPlaylist::Sequential << 1 << 2 << -1;
-
- QTest::newRow("Loop, 0") << QMediaPlaylist::Loop << 2 << 0 << 1;
- QTest::newRow("Loop, 1") << QMediaPlaylist::Loop << 0 << 1 << 2;
- QTest::newRow("Lopp, 2") << QMediaPlaylist::Loop << 1 << 2 << 0;
-
- QTest::newRow("ItemOnce, 1") << QMediaPlaylist::CurrentItemOnce << -1 << 1 << -1;
- QTest::newRow("ItemInLoop, 1") << QMediaPlaylist::CurrentItemInLoop << 1 << 1 << 1;
-
- // Bit difficult to test random this way
-}
-
-void tst_QMediaPlaylist::playbackMode()
-{
- QFETCH(QMediaPlaylist::PlaybackMode, playbackMode);
- QFETCH(int, expectedPrevious);
- QFETCH(int, pos);
- QFETCH(int, expectedNext);
-
- QMediaPlaylist playlist;
- playlist.addMedia(content1);
- playlist.addMedia(content2);
- playlist.addMedia(content3);
-
- QCOMPARE(playlist.playbackMode(), QMediaPlaylist::Sequential);
- QCOMPARE(playlist.currentIndex(), -1);
-
- playlist.setPlaybackMode(playbackMode);
- QCOMPARE(playlist.playbackMode(), playbackMode);
-
- playlist.setCurrentIndex(pos);
- QCOMPARE(playlist.currentIndex(), pos);
- QCOMPARE(playlist.nextIndex(), expectedNext);
- QCOMPARE(playlist.previousIndex(), expectedPrevious);
-
- playlist.next();
- QCOMPARE(playlist.currentIndex(), expectedNext);
-
- playlist.setCurrentIndex(pos);
- playlist.previous();
- QCOMPARE(playlist.currentIndex(), expectedPrevious);
-}
-
-void tst_QMediaPlaylist::shuffle()
-{
- QMediaPlaylist playlist;
- QList<QMediaContent> contentList;
-
- for (int i=0; i<100; i++) {
- QMediaContent content(QUrl(QString::number(i)));
- contentList.append(content);
- playlist.addMedia(content);
- }
-
- playlist.shuffle();
-
- QList<QMediaContent> shuffledContentList;
- for (int i=0; i<playlist.mediaCount(); i++)
- shuffledContentList.append(playlist.media(i));
-
- QVERIFY(contentList != shuffledContentList);
-
-}
-
-void tst_QMediaPlaylist::readOnlyPlaylist()
-{
- MockReadOnlyPlaylistObject mediaObject;
- QMediaPlaylist playlist;
- mediaObject.bind(&playlist);
-
- QVERIFY(playlist.isReadOnly());
- QVERIFY(!playlist.isEmpty());
- QCOMPARE(playlist.mediaCount(), 3);
-
- QCOMPARE(playlist.media(0), content1);
- QCOMPARE(playlist.media(1), content2);
- QCOMPARE(playlist.media(2), content3);
- QCOMPARE(playlist.media(3), QMediaContent());
-
- //it's a read only playlist, so all the modification should fail
- QVERIFY(!playlist.addMedia(content1));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(!playlist.addMedia(QList<QMediaContent>() << content1 << content2));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(!playlist.insertMedia(1, content1));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(!playlist.insertMedia(1, QList<QMediaContent>() << content1 << content2));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(!playlist.removeMedia(1));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(!playlist.removeMedia(0,2));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(!playlist.clear());
- QCOMPARE(playlist.mediaCount(), 3);
-
- //but it is still allowed to append/insert an empty list
- QVERIFY(playlist.addMedia(QList<QMediaContent>()));
- QVERIFY(playlist.insertMedia(1, QList<QMediaContent>()));
-
- playlist.shuffle();
- //it's still the same
- QCOMPARE(playlist.media(0), content1);
- QCOMPARE(playlist.media(1), content2);
- QCOMPARE(playlist.media(2), content3);
- QCOMPARE(playlist.media(3), QMediaContent());
-
-
- //load to read only playlist should fail,
- //unless underlaying provider supports it
- QBuffer buffer;
- buffer.open(QBuffer::ReadWrite);
- buffer.write(QByteArray("file:///1\nfile:///2"));
- buffer.seek(0);
-
- QSignalSpy errorSignal(&playlist, SIGNAL(loadFailed()));
- playlist.load(&buffer, "m3u");
- QCOMPARE(errorSignal.size(), 1);
- QCOMPARE(playlist.error(), QMediaPlaylist::AccessDeniedError);
- QVERIFY(!playlist.errorString().isEmpty());
- QCOMPARE(playlist.mediaCount(), 3);
-
- errorSignal.clear();
- playlist.load(QUrl(QLatin1String("tmp.m3u")), "m3u");
-
- QCOMPARE(errorSignal.size(), 1);
- QCOMPARE(playlist.error(), QMediaPlaylist::AccessDeniedError);
- QVERIFY(!playlist.errorString().isEmpty());
- QCOMPARE(playlist.mediaCount(), 3);
-}
-
-void tst_QMediaPlaylist::setMediaObject()
-{
- MockReadOnlyPlaylistObject mediaObject;
-
- QMediaPlaylist playlist;
- QVERIFY(playlist.mediaObject() == 0);
- QVERIFY(!playlist.isReadOnly());
-
- mediaObject.bind(&playlist);
- QCOMPARE(playlist.mediaObject(), qobject_cast<QMediaObject*>(&mediaObject));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(playlist.isReadOnly());
-
- mediaObject.unbind(&playlist);
- QVERIFY(playlist.mediaObject() == 0);
- QCOMPARE(playlist.mediaCount(), 0);
- QVERIFY(!playlist.isReadOnly());
-
- mediaObject.bind(&playlist);
- QCOMPARE(playlist.mediaObject(), qobject_cast<QMediaObject*>(&mediaObject));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(playlist.isReadOnly());
-}
-
-void tst_QMediaPlaylist::testCurrentIndexChanged_signal()
-{
- //create an instance of QMediaPlaylist class.
- QMediaPlaylist playlist;
- playlist.addMedia(content1); //set the media to playlist
- playlist.addMedia(content2); //set the media to playlist
-
- QSignalSpy spy(&playlist, SIGNAL(currentIndexChanged(int)));
- QVERIFY(spy.size()== 0);
- QCOMPARE(playlist.currentIndex(), -1);
-
- //set the current index for playlist.
- playlist.setCurrentIndex(0);
- QVERIFY(spy.size()== 1); //verify the signal emission.
- QCOMPARE(playlist.currentIndex(), 0); //verify the current index of playlist
-
- //set the current index for playlist.
- playlist.setCurrentIndex(1);
- QVERIFY(spy.size()== 2); //verify the signal emission.
- QCOMPARE(playlist.currentIndex(), 1); //verify the current index of playlist
-}
-
-void tst_QMediaPlaylist::testCurrentMediaChanged_signal()
-{
- //create an instance of QMediaPlaylist class.
- QMediaPlaylist playlist;
- playlist.addMedia(content1); //set the media to playlist
- playlist.addMedia(content2); //set the media to playlist
-
- QSignalSpy spy(&playlist, SIGNAL(currentMediaChanged(QMediaContent)));
- QVERIFY(spy.size()== 0);
- QCOMPARE(playlist.currentIndex(), -1);
- QCOMPARE(playlist.currentMedia(), QMediaContent());
-
- //set the current index for playlist.
- playlist.setCurrentIndex(0);
- QVERIFY(spy.size()== 1); //verify the signal emission.
- QCOMPARE(playlist.currentIndex(), 0); //verify the current index of playlist
- QCOMPARE(playlist.currentMedia(), content1); //verify the current media of playlist
-
- //set the current index for playlist.
- playlist.setCurrentIndex(1);
- QVERIFY(spy.size()== 2); //verify the signal emission.
- QCOMPARE(playlist.currentIndex(), 1); //verify the current index of playlist
- QCOMPARE(playlist.currentMedia(), content2); //verify the current media of playlist
-}
-
-void tst_QMediaPlaylist::testLoaded_signal()
-{
- //create an instance of QMediaPlaylist class.
- QMediaPlaylist playlist;
- playlist.addMedia(content1); //set the media to playlist
- playlist.addMedia(content2); //set the media to playlist
- playlist.addMedia(content3); //set the media to playlist
-
- QSignalSpy spy(&playlist, SIGNAL(loaded()));
- QVERIFY(spy.size()== 0);
-
- QBuffer buffer;
- buffer.open(QBuffer::ReadWrite);
-
- //load the playlist
- playlist.load(&buffer,"m3u");
- QVERIFY(spy.size()== 1); //verify the signal emission.
-}
-
-void tst_QMediaPlaylist::testMediaChanged_signal()
-{
- //create an instance of QMediaPlaylist class.
- QMediaPlaylist playlist;
-
- QSignalSpy spy(&playlist, SIGNAL(mediaChanged(int,int)));
-
- // Add media to playlist
- playlist.addMedia(content1); //set the media to playlist
- playlist.addMedia(content2); //set the media to playlist
- playlist.addMedia(content3); //set the media to playlist
-
- // Adds/inserts do not cause change signals
- QVERIFY(spy.size() == 0);
-
- // Now change the list
- playlist.shuffle();
-
- QVERIFY(spy.size() == 1);
- spy.clear();
-
- //create media.
- QMediaContent content4(QUrl(QLatin1String("file:///4")));
- QMediaContent content5(QUrl(QLatin1String("file:///5")));
-
- //insert media to playlist
- playlist.insertMedia(1, content4);
- playlist.insertMedia(2, content5);
- // Adds/inserts do not cause change signals
- QVERIFY(spy.size() == 0);
-
- // And again
- playlist.shuffle();
-
- QVERIFY(spy.size() == 1);
-}
-
-void tst_QMediaPlaylist::testPlaybackModeChanged_signal()
-{
- //create an instance of QMediaPlaylist class.
- QMediaPlaylist playlist;
- playlist.addMedia(content1); //set the media to playlist
- playlist.addMedia(content2); //set the media to playlist
- playlist.addMedia(content3); //set the media to playlist
-
- QSignalSpy spy(&playlist, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)));
- QVERIFY(playlist.playbackMode()== QMediaPlaylist::Sequential);
- QVERIFY(spy.size() == 0);
-
- // Set playback mode to the playlist
- playlist.setPlaybackMode(QMediaPlaylist::CurrentItemOnce);
- QVERIFY(playlist.playbackMode()== QMediaPlaylist::CurrentItemOnce);
- QVERIFY(spy.size() == 1);
-
- // Set playback mode to the playlist
- playlist.setPlaybackMode(QMediaPlaylist::CurrentItemInLoop);
- QVERIFY(playlist.playbackMode()== QMediaPlaylist::CurrentItemInLoop);
- QVERIFY(spy.size() == 2);
-
- // Set playback mode to the playlist
- playlist.setPlaybackMode(QMediaPlaylist::Sequential);
- QVERIFY(playlist.playbackMode()== QMediaPlaylist::Sequential);
- QVERIFY(spy.size() == 3);
-
- // Set playback mode to the playlist
- playlist.setPlaybackMode(QMediaPlaylist::Loop);
- QVERIFY(playlist.playbackMode()== QMediaPlaylist::Loop);
- QVERIFY(spy.size() == 4);
-
- // Set playback mode to the playlist
- playlist.setPlaybackMode(QMediaPlaylist::Random);
- QVERIFY(playlist.playbackMode()== QMediaPlaylist::Random);
- QVERIFY(spy.size() == 5);
-}
-
-void tst_QMediaPlaylist::testEnums()
-{
- //create an instance of QMediaPlaylist class.
- QMediaPlaylist playlist;
- playlist.addMedia(content1); //set the media to playlist
- playlist.addMedia(content2); //set the media to playlist
- playlist.addMedia(content3); //set the media to playlist
- QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
-
- QBuffer buffer;
- buffer.open(QBuffer::ReadWrite);
-
- // checking for QMediaPlaylist::FormatNotSupportedError enum
- QVERIFY(!playlist.save(&buffer, "unsupported_format"));
- QVERIFY(playlist.error() == QMediaPlaylist::FormatNotSupportedError);
-
- playlist.load(&buffer,"unsupported_format");
- QVERIFY(playlist.error() == QMediaPlaylist::FormatNotSupportedError);
-}
-
-// MaemoAPI-1849:test QMediaPlayListControl constructor
-void tst_QMediaPlaylist::mediaPlayListControl()
-{
- // To check changes in abstract classe's pure virtual functions
- QObject parent;
- MockMediaPlaylistControl plylistctrl(&parent);
-}
-
-// MaemoAPI-1850:test QMediaPlayListSourceControl constructor
-void tst_QMediaPlaylist::mediaPlayListSourceControl()
-{
- // To check changes in abstract classe's pure virtual functions
- QObject parent;
- MockPlaylistSourceControl plylistsrcctrl(&parent);
-}
-
-// MaemoAPI-1852:test constructor
-void tst_QMediaPlaylist::mediaPlayListProvider()
-{
- // srcs of QMediaPlaylistProvider is incomplete
- QObject parent;
- MockReadOnlyPlaylistProvider provider(&parent);
-}
-
-QTEST_MAIN(tst_QMediaPlaylist)
-#include "tst_qmediaplaylist.moc"
-
diff --git a/tests/auto/qmediaplaylistnavigator/qmediaplaylistnavigator.pro b/tests/auto/qmediaplaylistnavigator/qmediaplaylistnavigator.pro
deleted file mode 100644
index 305d63b..0000000
--- a/tests/auto/qmediaplaylistnavigator/qmediaplaylistnavigator.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediaplaylistnavigator
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qmediaplaylistnavigator.cpp
-
diff --git a/tests/auto/qmediaplaylistnavigator/tst_qmediaplaylistnavigator.cpp b/tests/auto/qmediaplaylistnavigator/tst_qmediaplaylistnavigator.cpp
deleted file mode 100644
index a888847..0000000
--- a/tests/auto/qmediaplaylistnavigator/tst_qmediaplaylistnavigator.cpp
+++ /dev/null
@@ -1,525 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include <QDebug>
-#include "qlocalmediaplaylistprovider.h"
-#include "qmediaplaylistnavigator.h"
-
-QT_USE_NAMESPACE
-class tst_QMediaPlaylistNavigator : public QObject
-{
- Q_OBJECT
-public slots:
- void init();
- void cleanup();
-
-private slots:
- void construction();
- void setPlaylist();
- void linearPlayback();
- void loopPlayback();
- void currentItemOnce();
- void currentItemInLoop();
- void randomPlayback();
-
- void testItemAt();
- void testNextIndex();
- void testPreviousIndex();
- void testCurrentIndexChangedSignal();
- void testPlaybackModeChangedSignal();
- void testSurroundingItemsChangedSignal();
- void testActivatedSignal();
-};
-
-void tst_QMediaPlaylistNavigator::init()
-{
- qRegisterMetaType<QMediaPlaylist::PlaybackMode>("QMediaPlaylist::PlaybackMode");
- qRegisterMetaType<QMediaContent>("QMediaContent");
-}
-
-void tst_QMediaPlaylistNavigator::cleanup()
-{
-}
-
-void tst_QMediaPlaylistNavigator::construction()
-{
- QLocalMediaPlaylistProvider playlist;
- QCOMPARE(playlist.mediaCount(), 0);
-
- QMediaPlaylistNavigator navigator(&playlist);
- QVERIFY(navigator.currentItem().isNull());
- QCOMPARE(navigator.currentIndex(), -1);
-}
-
-void tst_QMediaPlaylistNavigator::setPlaylist()
-{
- QMediaPlaylistNavigator navigator(0);
- QVERIFY(navigator.playlist() != 0);
- QCOMPARE(navigator.playlist()->mediaCount(), 0);
- QCOMPARE(navigator.playlist()->media(0), QMediaContent());
- QVERIFY(navigator.playlist()->isReadOnly() );
-
- QLocalMediaPlaylistProvider playlist;
- QCOMPARE(playlist.mediaCount(), 0);
-
- navigator.setPlaylist(&playlist);
- QCOMPARE(navigator.playlist(), (QMediaPlaylistProvider*)&playlist);
- QCOMPARE(navigator.playlist()->mediaCount(), 0);
- QVERIFY(!navigator.playlist()->isReadOnly() );
-}
-
-void tst_QMediaPlaylistNavigator::linearPlayback()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
-
- navigator.setPlaybackMode(QMediaPlaylist::Sequential);
- QTest::ignoreMessage(QtWarningMsg, "QMediaPlaylistNavigator: Jump outside playlist range ");
- navigator.jump(0);//it's ok to have warning here
- QVERIFY(navigator.currentItem().isNull());
- QCOMPARE(navigator.currentIndex(), -1);
-
- QMediaContent content1(QUrl(QLatin1String("file:///1")));
- playlist.addMedia(content1);
- navigator.jump(0);
- QVERIFY(!navigator.currentItem().isNull());
-
- QCOMPARE(navigator.currentIndex(), 0);
- QCOMPARE(navigator.currentItem(), content1);
- QCOMPARE(navigator.nextItem(), QMediaContent());
- QCOMPARE(navigator.nextItem(2), QMediaContent());
- QCOMPARE(navigator.previousItem(), QMediaContent());
- QCOMPARE(navigator.previousItem(2), QMediaContent());
-
- QMediaContent content2(QUrl(QLatin1String("file:///2")));
- playlist.addMedia(content2);
- QCOMPARE(navigator.currentIndex(), 0);
- QCOMPARE(navigator.currentItem(), content1);
- QCOMPARE(navigator.nextItem(), content2);
- QCOMPARE(navigator.nextItem(2), QMediaContent());
- QCOMPARE(navigator.previousItem(), QMediaContent());
- QCOMPARE(navigator.previousItem(2), QMediaContent());
-
- navigator.jump(1);
- QCOMPARE(navigator.currentIndex(), 1);
- QCOMPARE(navigator.currentItem(), content2);
- QCOMPARE(navigator.nextItem(), QMediaContent());
- QCOMPARE(navigator.nextItem(2), QMediaContent());
- QCOMPARE(navigator.previousItem(), content1);
- QCOMPARE(navigator.previousItem(2), QMediaContent());
-
- navigator.jump(0);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.next();//jump to the first item
- QCOMPARE(navigator.currentIndex(), 0);
-
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.previous();//jump to the last item
- QCOMPARE(navigator.currentIndex(), 1);
-}
-
-void tst_QMediaPlaylistNavigator::loopPlayback()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
-
- navigator.setPlaybackMode(QMediaPlaylist::Loop);
- QTest::ignoreMessage(QtWarningMsg, "QMediaPlaylistNavigator: Jump outside playlist range ");
- navigator.jump(0);
- QVERIFY(navigator.currentItem().isNull());
- QCOMPARE(navigator.currentIndex(), -1);
-
- QMediaContent content1(QUrl(QLatin1String("file:///1")));
- playlist.addMedia(content1);
- navigator.jump(0);
- QVERIFY(!navigator.currentItem().isNull());
-
- QCOMPARE(navigator.currentIndex(), 0);
- QCOMPARE(navigator.currentItem(), content1);
- QCOMPARE(navigator.nextItem(), content1);
- QCOMPARE(navigator.nextItem(2), content1);
- QCOMPARE(navigator.previousItem(), content1);
- QCOMPARE(navigator.previousItem(2), content1);
-
- QMediaContent content2(QUrl(QLatin1String("file:///2")));
- playlist.addMedia(content2);
- QCOMPARE(navigator.currentIndex(), 0);
- QCOMPARE(navigator.currentItem(), content1);
- QCOMPARE(navigator.nextItem(), content2);
- QCOMPARE(navigator.nextItem(2), content1); //loop over end of the list
- QCOMPARE(navigator.previousItem(), content2);
- QCOMPARE(navigator.previousItem(2), content1);
-
- navigator.jump(1);
- QCOMPARE(navigator.currentIndex(), 1);
- QCOMPARE(navigator.currentItem(), content2);
- QCOMPARE(navigator.nextItem(), content1);
- QCOMPARE(navigator.nextItem(2), content2);
- QCOMPARE(navigator.previousItem(), content1);
- QCOMPARE(navigator.previousItem(2), content2);
-
- navigator.jump(0);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), 0);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), 0);
-}
-
-void tst_QMediaPlaylistNavigator::currentItemOnce()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
-
- navigator.setPlaybackMode(QMediaPlaylist::CurrentItemOnce);
-
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::CurrentItemOnce);
- QCOMPARE(navigator.currentIndex(), -1);
-
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///1"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///2"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///3"))));
-
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), -1);
-
- navigator.jump(1);
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.jump(1);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), -1);
-}
-
-void tst_QMediaPlaylistNavigator::currentItemInLoop()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
-
- navigator.setPlaybackMode(QMediaPlaylist::CurrentItemInLoop);
-
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::CurrentItemInLoop);
- QCOMPARE(navigator.currentIndex(), -1);
-
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///1"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///2"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///3"))));
-
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.jump(1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), 1);
-}
-
-void tst_QMediaPlaylistNavigator::randomPlayback()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
-
- navigator.setPlaybackMode(QMediaPlaylist::Random);
-
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::Random);
- QCOMPARE(navigator.currentIndex(), -1);
-
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///1"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///2"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///3"))));
-
- playlist.shuffle();
-
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.next();
- int pos1 = navigator.currentIndex();
- navigator.next();
- int pos2 = navigator.currentIndex();
- navigator.next();
- int pos3 = navigator.currentIndex();
-
- QVERIFY(pos1 != -1);
- QVERIFY(pos2 != -1);
- QVERIFY(pos3 != -1);
-
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), pos2);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), pos3);
- navigator.next();
- int pos4 = navigator.currentIndex();
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), pos3);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), pos2);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), pos1);
- navigator.previous();
- int pos0 = navigator.currentIndex();
- QVERIFY(pos0 != -1);
- navigator.next();
- navigator.next();
- navigator.next();
- navigator.next();
- QCOMPARE(navigator.currentIndex(), pos4);
-
-}
-
-void tst_QMediaPlaylistNavigator::testItemAt()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
- navigator.setPlaybackMode(QMediaPlaylist::Random);
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::Random);
- QCOMPARE(navigator.currentIndex(), -1);
-
- //Adding the media to the playlist
- QMediaContent content = QMediaContent(QUrl(QLatin1String("file:///1")));
- playlist.addMedia(content);
-
- //Currently it is not pointing to any index , Returns Null mediacontent
- QCOMPARE(navigator.currentIndex(), -1);
- QCOMPARE(navigator.itemAt(navigator.currentIndex()),QMediaContent());
- navigator.next();
-
- //Points to the added media
- int pos1 = navigator.currentIndex();
- QCOMPARE(content,navigator.itemAt(pos1));
-}
-
-void tst_QMediaPlaylistNavigator::testNextIndex()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
- navigator.setPlaybackMode(QMediaPlaylist::Random);
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::Random);
- QCOMPARE(navigator.currentIndex(), -1);
-
- //Adding the media to the playlist
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///1"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///2"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///3"))));
-
- playlist.shuffle();
-
- //Currently it is not pointing to any index
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.next();
- int pos1 = navigator.currentIndex();
- //Pointing to the next index
- navigator.next();
- int pos2 = navigator.currentIndex();
- navigator.next();
- int pos3 = navigator.currentIndex();
-
- //Pointing to the previous index
- navigator.previous();
- QCOMPARE(navigator.nextIndex(1), pos3);
- navigator.previous();
- QCOMPARE(navigator.nextIndex(1), pos2);
- QCOMPARE(navigator.nextIndex(2), pos3);
- navigator.previous();
- QCOMPARE(navigator.nextIndex(1), pos1);
-}
-
-void tst_QMediaPlaylistNavigator::testPreviousIndex()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
- navigator.setPlaybackMode(QMediaPlaylist::Random);
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::Random);
- QCOMPARE(navigator.currentIndex(), -1);
-
- //Adding the media to the playlist
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///1"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///2"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///3"))));
- playlist.shuffle();
-
- //Currently it is not pointing to any index
- QCOMPARE(navigator.currentIndex(), -1);
-
- //pointing to next index
- navigator.next();
- int pos1 = navigator.currentIndex();
- navigator.next();
- int pos2 = navigator.currentIndex();
- navigator.next();
- int pos3 = navigator.currentIndex();
- QCOMPARE(navigator.previousIndex(1), pos2);
- QCOMPARE(navigator.previousIndex(2), pos1);
- navigator.next();
- QCOMPARE(navigator.previousIndex(1), pos3);
-}
-
-void tst_QMediaPlaylistNavigator::testCurrentIndexChangedSignal()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
- navigator.setPlaybackMode(QMediaPlaylist::Random);
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::Random);
- QCOMPARE(navigator.currentIndex(), -1);
-
- //Creating a QSignalSpy object for currentIndexChanged() signal
- QSignalSpy spy(&navigator,SIGNAL(currentIndexChanged(int)));
- QVERIFY(spy.count() == 0);
-
- //Adding the media to the playlist
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///1"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///2"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///3"))));
-
- //Currently it is not pointing to any index
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.next();
- QVERIFY(spy.count() == 1);
- int pos1 = navigator.currentIndex();
- //Pointing to the next index
- navigator.next();
- QVERIFY(navigator.previousIndex(1) == pos1);
- QVERIFY(spy.count() == 2);
-}
-
-void tst_QMediaPlaylistNavigator::testPlaybackModeChangedSignal()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
- navigator.setPlaybackMode(QMediaPlaylist::Random);
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::Random);
- QCOMPARE(navigator.currentIndex(), -1);
-
- //Creating a QSignalSpy object for currentIndexChanged() signal
- QSignalSpy spy(&navigator,SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)));
- QVERIFY(spy.count() == 0);
-
- //Adding the media to the playlist
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///1"))));
-
- //set the play back mode to sequential
- navigator.setPlaybackMode(QMediaPlaylist::Sequential);
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::Sequential);
- QVERIFY(spy.count() == 1);
-
- //set the play back mode to loop
- navigator.setPlaybackMode(QMediaPlaylist::Loop);
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::Loop);
- QVERIFY(spy.count() == 2);
-}
-
-void tst_QMediaPlaylistNavigator::testSurroundingItemsChangedSignal()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
- navigator.setPlaybackMode(QMediaPlaylist::Random);
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::Random);
- QCOMPARE(navigator.currentIndex(), -1);
-
- //Creating a QSignalSpy object for surroundingItemsChanged()signal
- QSignalSpy spy(&navigator,SIGNAL(surroundingItemsChanged()));
- QVERIFY(spy.count() == 0);
-
- //Adding the media to the playlist
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///1"))));
- QVERIFY(spy.count() == 1);
-
- //set the play back mode to sequential
- navigator.setPlaybackMode(QMediaPlaylist::Sequential);
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::Sequential);
- QVERIFY(spy.count() == 2);
-
- //Point to the next index
- navigator.next();
- QVERIFY(spy.count() == 3);
-}
-
-void tst_QMediaPlaylistNavigator::testActivatedSignal()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
- navigator.setPlaybackMode(QMediaPlaylist::Random);
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::Random);
- QCOMPARE(navigator.currentIndex(), -1);
-
- //Creating a QSignalSpy object for surroundingItemsChanged()signal
- QSignalSpy spy(&navigator,SIGNAL(activated(QMediaContent)));
- QVERIFY(spy.count() == 0);
-
- //Adding the media to the playlist
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///1"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///2"))));
- playlist.shuffle();
-
- //Point to the next index
- navigator.next();
- QVERIFY(spy.count() == 1);
-
- //Jump to 0th item
- navigator.jump(0);
- QVERIFY(spy.count() == 2);
-
- //move to previous item
- navigator.previous();
- QVERIFY(spy.count() == 3);
-}
-
-QTEST_MAIN(tst_QMediaPlaylistNavigator)
-#include "tst_qmediaplaylistnavigator.moc"
diff --git a/tests/auto/qmediapluginloader/qmediapluginloader.pro b/tests/auto/qmediapluginloader/qmediapluginloader.pro
deleted file mode 100644
index f5947c6..0000000
--- a/tests/auto/qmediapluginloader/qmediapluginloader.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediapluginloader
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qmediapluginloader.cpp
-
-wince* {
- PLUGIN_DEPLOY.sources = $$OUTPUT_DIR/plugins/mediaservice/*.dll
- PLUGIN_DEPLOY.path = mediaservice
- DEPLOYMENT += PLUGIN_DEPLOY
-}
-
diff --git a/tests/auto/qmediapluginloader/tst_qmediapluginloader.cpp b/tests/auto/qmediapluginloader/tst_qmediapluginloader.cpp
deleted file mode 100644
index 198d950..0000000
--- a/tests/auto/qmediapluginloader/tst_qmediapluginloader.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <private/qmediapluginloader_p.h>
-#include <qmediaserviceproviderplugin.h>
-
-#include <QtTest/QtTest>
-#include <QDebug>
-
-QT_USE_NAMESPACE
-
-class tst_QMediaPluginLoader : public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- void testInstance();
- void testInstances();
- void testInvalidKey();
-
-private:
- QMediaPluginLoader *loader;
-};
-
-void tst_QMediaPluginLoader::initTestCase()
-{
- loader = new QMediaPluginLoader(QMediaServiceProviderFactoryInterface_iid,
- QLatin1String("/mediaservice"),
- Qt::CaseInsensitive);
-}
-
-void tst_QMediaPluginLoader::cleanupTestCase()
-{
- delete loader;
-}
-
-void tst_QMediaPluginLoader::testInstance()
-{
- const QStringList keys = loader->keys();
-
- if (keys.isEmpty()) // Test is invalidated, skip.
- QSKIP("No plug-ins available", SkipAll);
-
- foreach (const QString &key, keys)
- QVERIFY(loader->instance(key) != 0);
-}
-
-void tst_QMediaPluginLoader::testInstances()
-{
- const QStringList keys = loader->keys();
-
- if (keys.isEmpty()) // Test is invalidated, skip.
- QSKIP("No plug-ins available", SkipAll);
-
- foreach (const QString &key, keys)
- QVERIFY(loader->instances(key).size() > 0);
-}
-
-// Last so as to not interfere with the other tests if there is a failure.
-void tst_QMediaPluginLoader::testInvalidKey()
-{
- const QString key(QLatin1String("invalid-key"));
-
- // This test assumes there is no 'invalid-key' in the key list, verify that.
- if (loader->keys().contains(key))
- QSKIP("a plug-in includes the invalid key", SkipAll);
-
- QVERIFY(loader->instance(key) == 0);
-
- // Test looking up the key hasn't inserted it into the list. See QMap::operator[].
- QVERIFY(!loader->keys().contains(key));
-
- QVERIFY(loader->instances(key).isEmpty());
- QVERIFY(!loader->keys().contains(key));
-}
-
-QTEST_MAIN(tst_QMediaPluginLoader)
-
-#include "tst_qmediapluginloader.moc"
diff --git a/tests/auto/qmediarecorder/main.cpp b/tests/auto/qmediarecorder/main.cpp
deleted file mode 100755
index cda3faf..0000000
--- a/tests/auto/qmediarecorder/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-
-#include "tst_qmediarecorder.h"
-
-int main(int argc, char**argv)
-{
- QCoreApplication app(argc,argv);
- int ret;
- tst_QMediaRecorder test_api;
- ret = QTest::qExec(&test_api, argc, argv);
- return ret;
-}
diff --git a/tests/auto/qmediarecorder/qmediarecorder.pro b/tests/auto/qmediarecorder/qmediarecorder.pro
deleted file mode 100644
index 1efaba0..0000000
--- a/tests/auto/qmediarecorder/qmediarecorder.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediarecorder
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-include (../qmultimedia_common/mock.pri)
-include (../qmultimedia_common/mockrecorder.pri)
-
-HEADERS += tst_qmediarecorder.h
-SOURCES += main.cpp tst_qmediarecorder.cpp
-
diff --git a/tests/auto/qmediarecorder/tst_qmediarecorder.cpp b/tests/auto/qmediarecorder/tst_qmediarecorder.cpp
deleted file mode 100644
index d99d73c..0000000
--- a/tests/auto/qmediarecorder/tst_qmediarecorder.cpp
+++ /dev/null
@@ -1,1286 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 "tst_qmediarecorder.h"
-
-QT_USE_NAMESPACE
-
-void tst_QMediaRecorder::initTestCase()
-{
- qRegisterMetaType<QMediaRecorder::State>("QMediaRecorder::State");
- qRegisterMetaType<QMediaRecorder::Error>("QMediaRecorder::Error");
-
- mock = new MockMediaRecorderControl(this);
- service = new MockMediaRecorderService(this, mock);
- object = new MockMediaObject(this, service);
- capture = new QMediaRecorder(object);
-
- audio = qobject_cast<QAudioEndpointSelector*>(service->requestControl(QAudioEndpointSelector_iid));
- encode = qobject_cast<QAudioEncoderControl*>(service->requestControl(QAudioEncoderControl_iid));
- videoEncode = qobject_cast<QVideoEncoderControl*>(service->requestControl(QVideoEncoderControl_iid));
-}
-
-void tst_QMediaRecorder::cleanupTestCase()
-{
- delete capture;
- delete object;
- delete service;
- delete mock;
-}
-
-void tst_QMediaRecorder::testNullService()
-{
- const QString id(QLatin1String("application/x-format"));
-
- MockMediaObject object(0, 0);
- QMediaRecorder recorder(&object);
-
- QCOMPARE(recorder.outputLocation(), QUrl());
- QCOMPARE(recorder.state(), QMediaRecorder::StoppedState);
- QCOMPARE(recorder.error(), QMediaRecorder::NoError);
- QCOMPARE(recorder.duration(), qint64(0));
- QCOMPARE(recorder.supportedContainers(), QStringList());
- QCOMPARE(recorder.containerDescription(id), QString());
- QCOMPARE(recorder.supportedAudioCodecs(), QStringList());
- QCOMPARE(recorder.audioCodecDescription(id), QString());
- QCOMPARE(recorder.supportedAudioSampleRates(), QList<int>());
- QCOMPARE(recorder.supportedVideoCodecs(), QStringList());
- QCOMPARE(recorder.videoCodecDescription(id), QString());
- bool continuous = true;
- QCOMPARE(recorder.supportedResolutions(QVideoEncoderSettings(), &continuous), QList<QSize>());
- QCOMPARE(continuous, false);
- continuous = true;
- QCOMPARE(recorder.supportedFrameRates(QVideoEncoderSettings(), &continuous), QList<qreal>());
- QCOMPARE(continuous, false);
- QCOMPARE(recorder.audioSettings(), QAudioEncoderSettings());
- QCOMPARE(recorder.videoSettings(), QVideoEncoderSettings());
- QCOMPARE(recorder.containerMimeType(), QString());
- QVERIFY(!recorder.isMuted());
- recorder.setMuted(true);
- QVERIFY(!recorder.isMuted());
-}
-
-void tst_QMediaRecorder::testNullControls()
-{
- const QString id(QLatin1String("application/x-format"));
-
- MockMediaRecorderService service(0, 0);
- service.hasControls = false;
- MockMediaObject object(0, &service);
- QMediaRecorder recorder(&object);
-
- QCOMPARE(recorder.outputLocation(), QUrl());
- QCOMPARE(recorder.state(), QMediaRecorder::StoppedState);
- QCOMPARE(recorder.error(), QMediaRecorder::NoError);
- QCOMPARE(recorder.duration(), qint64(0));
- QCOMPARE(recorder.supportedContainers(), QStringList());
- QCOMPARE(recorder.containerDescription(id), QString());
- QCOMPARE(recorder.supportedAudioCodecs(), QStringList());
- QCOMPARE(recorder.audioCodecDescription(id), QString());
- QCOMPARE(recorder.supportedAudioSampleRates(), QList<int>());
- QCOMPARE(recorder.supportedVideoCodecs(), QStringList());
- QCOMPARE(recorder.videoCodecDescription(id), QString());
- bool continuous = true;
- QCOMPARE(recorder.supportedResolutions(QVideoEncoderSettings(), &continuous), QList<QSize>());
- QCOMPARE(continuous, false);
- continuous = true;
- QCOMPARE(recorder.supportedFrameRates(QVideoEncoderSettings(), &continuous), QList<qreal>());
- QCOMPARE(continuous, false);
- QCOMPARE(recorder.audioSettings(), QAudioEncoderSettings());
- QCOMPARE(recorder.videoSettings(), QVideoEncoderSettings());
- QCOMPARE(recorder.containerMimeType(), QString());
-
- recorder.setOutputLocation(QUrl("file://test/save/file.mp4"));
- QCOMPARE(recorder.outputLocation(), QUrl());
-
- QAudioEncoderSettings audio;
- audio.setCodec(id);
- audio.setQuality(QtMultimedia::LowQuality);
-
- QVideoEncoderSettings video;
- video.setCodec(id);
- video.setResolution(640, 480);
-
- recorder.setEncodingSettings(audio, video, id);
-
- QCOMPARE(recorder.audioSettings(), QAudioEncoderSettings());
- QCOMPARE(recorder.videoSettings(), QVideoEncoderSettings());
- QCOMPARE(recorder.containerMimeType(), QString());
-
- QSignalSpy spy(&recorder, SIGNAL(stateChanged(QMediaRecorder::State)));
-
- recorder.record();
- QCOMPARE(recorder.state(), QMediaRecorder::StoppedState);
- QCOMPARE(recorder.error(), QMediaRecorder::NoError);
- QCOMPARE(spy.count(), 0);
-
- recorder.pause();
- QCOMPARE(recorder.state(), QMediaRecorder::StoppedState);
- QCOMPARE(recorder.error(), QMediaRecorder::NoError);
- QCOMPARE(spy.count(), 0);
-
- recorder.stop();
- QCOMPARE(recorder.state(), QMediaRecorder::StoppedState);
- QCOMPARE(recorder.error(), QMediaRecorder::NoError);
- QCOMPARE(spy.count(), 0);
-}
-
-void tst_QMediaRecorder::testDeleteMediaObject()
-{
- MockMediaRecorderControl *mock = new MockMediaRecorderControl(this);
- MockMediaRecorderService *service = new MockMediaRecorderService(this, mock);
- MockMediaObject *object = new MockMediaObject(this, service);
- QMediaRecorder *capture = new QMediaRecorder(object);
-
- QVERIFY(capture->mediaObject() == object);
- QVERIFY(capture->isAvailable());
-
- delete object;
- delete service;
- delete mock;
-
- QVERIFY(capture->mediaObject() == 0);
- QVERIFY(!capture->isAvailable());
-
- delete capture;
-}
-
-void tst_QMediaRecorder::testError()
-{
- const QString errorString(QLatin1String("format error"));
-
- QSignalSpy spy(capture, SIGNAL(error(QMediaRecorder::Error)));
-
- QCOMPARE(capture->error(), QMediaRecorder::NoError);
- QCOMPARE(capture->errorString(), QString());
-
- mock->error(QMediaRecorder::FormatError, errorString);
- QCOMPARE(capture->error(), QMediaRecorder::FormatError);
- QCOMPARE(capture->errorString(), errorString);
- QCOMPARE(spy.count(), 1);
-
- QCOMPARE(spy.last()[0].value<QMediaRecorder::Error>(), QMediaRecorder::FormatError);
-}
-
-void tst_QMediaRecorder::testSink()
-{
- capture->setOutputLocation(QUrl("test.tmp"));
- QUrl s = capture->outputLocation();
- QCOMPARE(s.toString(), QString("test.tmp"));
-}
-
-void tst_QMediaRecorder::testRecord()
-{
- QSignalSpy stateSignal(capture,SIGNAL(stateChanged(QMediaRecorder::State)));
- QSignalSpy progressSignal(capture, SIGNAL(durationChanged(qint64)));
- capture->record();
- QCOMPARE(capture->state(), QMediaRecorder::RecordingState);
- QCOMPARE(capture->error(), QMediaRecorder::NoError);
- QCOMPARE(capture->errorString(), QString());
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(stateSignal.count(), 1);
- QCOMPARE(stateSignal.last()[0].value<QMediaRecorder::State>(), QMediaRecorder::RecordingState);
- QVERIFY(progressSignal.count() > 0);
- capture->pause();
- QCOMPARE(capture->state(), QMediaRecorder::PausedState);
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(stateSignal.count(), 2);
- capture->stop();
- QCOMPARE(capture->state(), QMediaRecorder::StoppedState);
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(stateSignal.count(), 3);
- mock->stop();
- QCOMPARE(stateSignal.count(), 3);
-
-}
-
-void tst_QMediaRecorder::testMute()
-{
- QSignalSpy mutedChanged(capture, SIGNAL(mutedChanged(bool)));
- QVERIFY(!capture->isMuted());
- capture->setMuted(true);
-
- QCOMPARE(mutedChanged.size(), 1);
- QCOMPARE(mutedChanged[0][0].toBool(), true);
- QVERIFY(capture->isMuted());
-
- capture->setMuted(false);
-
- QCOMPARE(mutedChanged.size(), 2);
- QCOMPARE(mutedChanged[1][0].toBool(), false);
- QVERIFY(!capture->isMuted());
-
- capture->setMuted(false);
- QCOMPARE(mutedChanged.size(), 2);
-}
-
-void tst_QMediaRecorder::testAudioDeviceControl()
-{
- QSignalSpy readSignal(audio,SIGNAL(activeEndpointChanged(QString)));
- QVERIFY(audio->availableEndpoints().size() == 3);
- QVERIFY(audio->defaultEndpoint().compare("device1") == 0);
- audio->setActiveEndpoint("device2");
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(audio->activeEndpoint().compare("device2") == 0);
- QVERIFY(readSignal.count() == 1);
- QVERIFY(audio->endpointDescription("device2").compare("dev2 comment") == 0);
-}
-
-void tst_QMediaRecorder::testAudioEncodeControl()
-{
- QStringList codecs = capture->supportedAudioCodecs();
- QVERIFY(codecs.count() == 2);
- QVERIFY(capture->audioCodecDescription("audio/pcm") == "Pulse Code Modulation");
- QStringList options = encode->supportedEncodingOptions("audio/mpeg");
- QCOMPARE(options.count(), 4);
- QVERIFY(encode->encodingOption("audio/mpeg","bitrate").isNull());
- encode->setEncodingOption("audio/mpeg", "bitrate", QString("vbr"));
- QCOMPARE(encode->encodingOption("audio/mpeg","bitrate").toString(), QString("vbr"));
- QList<int> rates;
- rates << 8000 << 11025 << 22050 << 44100;
- QCOMPARE(capture->supportedAudioSampleRates(), rates);
-}
-
-void tst_QMediaRecorder::testMediaFormatsControl()
-{
- QCOMPARE(capture->supportedContainers(), QStringList() << "wav" << "mp3" << "mov");
-
- QCOMPARE(capture->containerDescription("wav"), QString("WAV format"));
- QCOMPARE(capture->containerDescription("mp3"), QString("MP3 format"));
- QCOMPARE(capture->containerDescription("ogg"), QString());
-}
-
-void tst_QMediaRecorder::testVideoEncodeControl()
-{
- bool continuous = false;
- QList<QSize> sizes = capture->supportedResolutions(QVideoEncoderSettings(), &continuous);
- QCOMPARE(sizes.count(), 2);
- QCOMPARE(continuous, true);
-
- QList<qreal> rates = capture->supportedFrameRates(QVideoEncoderSettings(), &continuous);
- QCOMPARE(rates.count(), 3);
- QCOMPARE(continuous, false);
-
- QStringList vCodecs = capture->supportedVideoCodecs();
- QVERIFY(vCodecs.count() == 2);
- QCOMPARE(capture->videoCodecDescription("video/3gpp"), QString("video/3gpp"));
-
- QStringList options = videoEncode->supportedEncodingOptions("video/3gpp");
- QCOMPARE(options.count(), 2);
-
- QVERIFY(encode->encodingOption("video/3gpp","me").isNull());
- encode->setEncodingOption("video/3gpp", "me", QString("dia"));
- QCOMPARE(encode->encodingOption("video/3gpp","me").toString(), QString("dia"));
-
-}
-
-void tst_QMediaRecorder::testEncodingSettings()
-{
- QAudioEncoderSettings audioSettings = capture->audioSettings();
- QCOMPARE(audioSettings.codec(), QString("audio/pcm"));
- QCOMPARE(audioSettings.bitRate(), 128*1024);
- QCOMPARE(audioSettings.sampleRate(), 8000);
- QCOMPARE(audioSettings.quality(), QtMultimedia::NormalQuality);
- QCOMPARE(audioSettings.channelCount(), -1);
-
- QCOMPARE(audioSettings.encodingMode(), QtMultimedia::ConstantQualityEncoding);
-
- QVideoEncoderSettings videoSettings = capture->videoSettings();
- QCOMPARE(videoSettings.codec(), QString());
- QCOMPARE(videoSettings.bitRate(), -1);
- QCOMPARE(videoSettings.resolution(), QSize());
- QCOMPARE(videoSettings.frameRate(), 0.0);
- QCOMPARE(videoSettings.quality(), QtMultimedia::NormalQuality);
- QCOMPARE(videoSettings.encodingMode(), QtMultimedia::ConstantQualityEncoding);
-
- QString format = capture->containerMimeType();
- QCOMPARE(format, QString());
-
- audioSettings.setCodec("audio/mpeg");
- audioSettings.setSampleRate(44100);
- audioSettings.setBitRate(256*1024);
- audioSettings.setQuality(QtMultimedia::HighQuality);
- audioSettings.setEncodingMode(QtMultimedia::AverageBitRateEncoding);
-
- videoSettings.setCodec("video/3gpp");
- videoSettings.setBitRate(800);
- videoSettings.setFrameRate(24*1024);
- videoSettings.setResolution(QSize(800,600));
- videoSettings.setQuality(QtMultimedia::HighQuality);
- audioSettings.setEncodingMode(QtMultimedia::TwoPassEncoding);
-
- format = QString("mov");
-
- capture->setEncodingSettings(audioSettings,videoSettings,format);
-
- QCOMPARE(capture->audioSettings(), audioSettings);
- QCOMPARE(capture->videoSettings(), videoSettings);
- QCOMPARE(capture->containerMimeType(), format);
-}
-
-void tst_QMediaRecorder::testAudioSettings()
-{
- QAudioEncoderSettings settings;
- QVERIFY(settings.isNull());
- QVERIFY(settings == QAudioEncoderSettings());
-
- QCOMPARE(settings.codec(), QString());
- settings.setCodec(QLatin1String("codecName"));
- QCOMPARE(settings.codec(), QLatin1String("codecName"));
- QVERIFY(!settings.isNull());
- QVERIFY(settings != QAudioEncoderSettings());
-
- settings = QAudioEncoderSettings();
- QCOMPARE(settings.bitRate(), -1);
- settings.setBitRate(128000);
- QCOMPARE(settings.bitRate(), 128000);
- QVERIFY(!settings.isNull());
-
- settings = QAudioEncoderSettings();
- QCOMPARE(settings.quality(), QtMultimedia::NormalQuality);
- settings.setQuality(QtMultimedia::HighQuality);
- QCOMPARE(settings.quality(), QtMultimedia::HighQuality);
- QVERIFY(!settings.isNull());
-
- settings = QAudioEncoderSettings();
- QCOMPARE(settings.sampleRate(), -1);
- settings.setSampleRate(44100);
- QCOMPARE(settings.sampleRate(), 44100);
- QVERIFY(!settings.isNull());
-
- settings = QAudioEncoderSettings();
- QCOMPARE(settings.channelCount(), -1);
- settings.setChannelCount(2);
- QCOMPARE(settings.channelCount(), 2);
- QVERIFY(!settings.isNull());
-
- settings = QAudioEncoderSettings();
- QVERIFY(settings.isNull());
- QCOMPARE(settings.codec(), QString());
- QCOMPARE(settings.bitRate(), -1);
- QCOMPARE(settings.quality(), QtMultimedia::NormalQuality);
- QCOMPARE(settings.sampleRate(), -1);
-
- {
- QAudioEncoderSettings settings1;
- QAudioEncoderSettings settings2;
- QCOMPARE(settings2, settings1);
-
- settings2 = settings1;
- QCOMPARE(settings2, settings1);
- QVERIFY(settings2.isNull());
-
- settings1.setQuality(QtMultimedia::HighQuality);
-
- QVERIFY(settings2.isNull());
- QVERIFY(!settings1.isNull());
- QVERIFY(settings1 != settings2);
- }
-
- {
- QAudioEncoderSettings settings1;
- QAudioEncoderSettings settings2(settings1);
- QCOMPARE(settings2, settings1);
-
- settings2 = settings1;
- QCOMPARE(settings2, settings1);
- QVERIFY(settings2.isNull());
-
- settings1.setQuality(QtMultimedia::HighQuality);
-
- QVERIFY(settings2.isNull());
- QVERIFY(!settings1.isNull());
- QVERIFY(settings1 != settings2);
- }
-
- QAudioEncoderSettings settings1;
- settings1.setBitRate(1);
- QAudioEncoderSettings settings2;
- settings2.setBitRate(1);
- QVERIFY(settings1 == settings2);
- settings2.setBitRate(2);
- QVERIFY(settings1 != settings2);
-
- settings1 = QAudioEncoderSettings();
- settings1.setChannelCount(1);
- settings2 = QAudioEncoderSettings();
- settings2.setChannelCount(1);
- QVERIFY(settings1 == settings2);
- settings2.setChannelCount(2);
- QVERIFY(settings1 != settings2);
-
- settings1 = QAudioEncoderSettings();
- settings1.setCodec("codec1");
- settings2 = QAudioEncoderSettings();
- settings2.setCodec("codec1");
- QVERIFY(settings1 == settings2);
- settings2.setCodec("codec2");
- QVERIFY(settings1 != settings2);
-
- settings1 = QAudioEncoderSettings();
- settings1.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- settings2 = QAudioEncoderSettings();
- settings2.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- QVERIFY(settings1 == settings2);
- settings2.setEncodingMode(QtMultimedia::TwoPassEncoding);
- QVERIFY(settings1 != settings2);
-
- settings1 = QAudioEncoderSettings();
- settings1.setQuality(QtMultimedia::NormalQuality);
- settings2 = QAudioEncoderSettings();
- settings2.setQuality(QtMultimedia::NormalQuality);
- QVERIFY(settings1 == settings2);
- settings2.setQuality(QtMultimedia::LowQuality);
- QVERIFY(settings1 != settings2);
-
- settings1 = QAudioEncoderSettings();
- settings1.setSampleRate(1);
- settings2 = QAudioEncoderSettings();
- settings2.setSampleRate(1);
- QVERIFY(settings1 == settings2);
- settings2.setSampleRate(2);
- QVERIFY(settings1 != settings2);
-}
-
-void tst_QMediaRecorder::testVideoSettings()
-{
- QVideoEncoderSettings settings;
- QVERIFY(settings.isNull());
- QVERIFY(settings == QVideoEncoderSettings());
-
- QCOMPARE(settings.codec(), QString());
- settings.setCodec(QLatin1String("codecName"));
- QCOMPARE(settings.codec(), QLatin1String("codecName"));
- QVERIFY(!settings.isNull());
- QVERIFY(settings != QVideoEncoderSettings());
-
- settings = QVideoEncoderSettings();
- QCOMPARE(settings.bitRate(), -1);
- settings.setBitRate(128000);
- QCOMPARE(settings.bitRate(), 128000);
- QVERIFY(!settings.isNull());
-
- settings = QVideoEncoderSettings();
- QCOMPARE(settings.quality(), QtMultimedia::NormalQuality);
- settings.setQuality(QtMultimedia::HighQuality);
- QCOMPARE(settings.quality(), QtMultimedia::HighQuality);
- QVERIFY(!settings.isNull());
-
- settings = QVideoEncoderSettings();
- QCOMPARE(settings.frameRate(), qreal());
- settings.setFrameRate(30000.0/10001);
- QVERIFY(qFuzzyCompare(settings.frameRate(), qreal(30000.0/10001)));
- settings.setFrameRate(24.0);
- QVERIFY(qFuzzyCompare(settings.frameRate(), qreal(24.0)));
- QVERIFY(!settings.isNull());
-
- settings = QVideoEncoderSettings();
- QCOMPARE(settings.resolution(), QSize());
- settings.setResolution(QSize(320,240));
- QCOMPARE(settings.resolution(), QSize(320,240));
- settings.setResolution(800,600);
- QCOMPARE(settings.resolution(), QSize(800,600));
- QVERIFY(!settings.isNull());
-
- settings = QVideoEncoderSettings();
- QVERIFY(settings.isNull());
- QCOMPARE(settings.codec(), QString());
- QCOMPARE(settings.bitRate(), -1);
- QCOMPARE(settings.quality(), QtMultimedia::NormalQuality);
- QCOMPARE(settings.frameRate(), qreal());
- QCOMPARE(settings.resolution(), QSize());
-
- {
- QVideoEncoderSettings settings1;
- QVideoEncoderSettings settings2;
- QCOMPARE(settings2, settings1);
-
- settings2 = settings1;
- QCOMPARE(settings2, settings1);
- QVERIFY(settings2.isNull());
-
- settings1.setQuality(QtMultimedia::HighQuality);
-
- QVERIFY(settings2.isNull());
- QVERIFY(!settings1.isNull());
- QVERIFY(settings1 != settings2);
- }
-
- {
- QVideoEncoderSettings settings1;
- QVideoEncoderSettings settings2(settings1);
- QCOMPARE(settings2, settings1);
-
- settings2 = settings1;
- QCOMPARE(settings2, settings1);
- QVERIFY(settings2.isNull());
-
- settings1.setQuality(QtMultimedia::HighQuality);
-
- QVERIFY(settings2.isNull());
- QVERIFY(!settings1.isNull());
- QVERIFY(settings1 != settings2);
- }
-
- QVideoEncoderSettings settings1;
- settings1.setBitRate(1);
- QVideoEncoderSettings settings2;
- settings2.setBitRate(1);
- QVERIFY(settings1 == settings2);
- settings2.setBitRate(2);
- QVERIFY(settings1 != settings2);
-
- settings1 = QVideoEncoderSettings();
- settings1.setResolution(800,600);
- settings2 = QVideoEncoderSettings();
- settings2.setResolution(QSize(800,600));
- QVERIFY(settings1 == settings2);
- settings2.setResolution(QSize(400,300));
- QVERIFY(settings1 != settings2);
-
- settings1 = QVideoEncoderSettings();
- settings1.setCodec("codec1");
- settings2 = QVideoEncoderSettings();
- settings2.setCodec("codec1");
- QVERIFY(settings1 == settings2);
- settings2.setCodec("codec2");
- QVERIFY(settings1 != settings2);
-
- settings1 = QVideoEncoderSettings();
- settings1.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- settings2 = QVideoEncoderSettings();
- settings2.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- QVERIFY(settings1 == settings2);
- settings2.setEncodingMode(QtMultimedia::TwoPassEncoding);
- QVERIFY(settings1 != settings2);
-
- settings1 = QVideoEncoderSettings();
- settings1.setQuality(QtMultimedia::NormalQuality);
- settings2 = QVideoEncoderSettings();
- settings2.setQuality(QtMultimedia::NormalQuality);
- QVERIFY(settings1 == settings2);
- settings2.setQuality(QtMultimedia::LowQuality);
- QVERIFY(settings1 != settings2);
-
- settings1 = QVideoEncoderSettings();
- settings1.setFrameRate(1);
- settings2 = QVideoEncoderSettings();
- settings2.setFrameRate(1);
- QVERIFY(settings1 == settings2);
- settings2.setFrameRate(2);
- QVERIFY(settings1 != settings2);
-}
-
-
-void tst_QMediaRecorder::nullMetaDataControl()
-{
- const QString titleKey(QLatin1String("Title"));
- const QString title(QLatin1String("Host of Seraphim"));
-
- MockMediaRecorderControl recorderControl(0);
- MockMediaRecorderService service(0, &recorderControl);
- service.hasControls = false;
- MockMediaObject object(0, &service);
-
- QMediaRecorder recorder(&object);
-
- QSignalSpy spy(&recorder, SIGNAL(metaDataChanged()));
-
- QCOMPARE(recorder.isMetaDataAvailable(), false);
- QCOMPARE(recorder.isMetaDataWritable(), false);
-
- recorder.setMetaData(QtMultimedia::Title, title);
- recorder.setExtendedMetaData(titleKey, title);
-
- QCOMPARE(recorder.metaData(QtMultimedia::Title).toString(), QString());
- QCOMPARE(recorder.extendedMetaData(titleKey).toString(), QString());
- QCOMPARE(recorder.availableMetaData(), QList<QtMultimedia::MetaData>());
- QCOMPARE(recorder.availableExtendedMetaData(), QStringList());
- QCOMPARE(spy.count(), 0);
-}
-
-void tst_QMediaRecorder::isMetaDataAvailable()
-{
- MockMediaRecorderControl recorderControl(0);
- MockMediaRecorderService service(0, &recorderControl);
- service.mockMetaDataControl->setMetaDataAvailable(false);
- MockMediaObject object(0, &service);
-
- QMediaRecorder recorder(&object);
- QCOMPARE(recorder.isMetaDataAvailable(), false);
-
- QSignalSpy spy(&recorder, SIGNAL(metaDataAvailableChanged(bool)));
- service.mockMetaDataControl->setMetaDataAvailable(true);
-
- QCOMPARE(recorder.isMetaDataAvailable(), true);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toBool(), true);
-
- service.mockMetaDataControl->setMetaDataAvailable(false);
-
- QCOMPARE(recorder.isMetaDataAvailable(), false);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.at(1).at(0).toBool(), false);
-}
-
-void tst_QMediaRecorder::isWritable()
-{
- MockMediaRecorderControl recorderControl(0);
- MockMediaRecorderService service(0, &recorderControl);
- service.mockMetaDataControl->setWritable(false);
-
- MockMediaObject object(0, &service);
-
- QMediaRecorder recorder(&object);
-
- QSignalSpy spy(&recorder, SIGNAL(metaDataWritableChanged(bool)));
-
- QCOMPARE(recorder.isMetaDataWritable(), false);
-
- service.mockMetaDataControl->setWritable(true);
-
- QCOMPARE(recorder.isMetaDataWritable(), true);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toBool(), true);
-
- service.mockMetaDataControl->setWritable(false);
-
- QCOMPARE(recorder.isMetaDataWritable(), false);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.at(1).at(0).toBool(), false);
-}
-
-void tst_QMediaRecorder::metaDataChanged()
-{
- MockMediaRecorderControl recorderControl(0);
- MockMediaRecorderService service(0, &recorderControl);
- MockMediaObject object(0, &service);
-
- QMediaRecorder recorder(&object);
-
- QSignalSpy spy(&recorder, SIGNAL(metaDataChanged()));
-
- service.mockMetaDataControl->metaDataChanged();
- QCOMPARE(spy.count(), 1);
-
- service.mockMetaDataControl->metaDataChanged();
- QCOMPARE(spy.count(), 2);
-}
-
-void tst_QMediaRecorder::metaData_data()
-{
- QTest::addColumn<QString>("artist");
- QTest::addColumn<QString>("title");
- QTest::addColumn<QString>("genre");
-
- QTest::newRow("")
- << QString::fromLatin1("Dead Can Dance")
- << QString::fromLatin1("Host of Seraphim")
- << QString::fromLatin1("Awesome");
-}
-
-void tst_QMediaRecorder::metaData()
-{
- QFETCH(QString, artist);
- QFETCH(QString, title);
- QFETCH(QString, genre);
-
- MockMediaRecorderControl recorderControl(0);
- MockMediaRecorderService service(0, &recorderControl);
- service.mockMetaDataControl->populateMetaData();
-
- MockMediaObject object(0, &service);
-
- QMediaRecorder recorder(&object);
- QVERIFY(object.availableMetaData().isEmpty());
-
- service.mockMetaDataControl->m_data.insert(QtMultimedia::AlbumArtist, artist);
- service.mockMetaDataControl->m_data.insert(QtMultimedia::Title, title);
- service.mockMetaDataControl->m_data.insert(QtMultimedia::Genre, genre);
-
- QCOMPARE(recorder.metaData(QtMultimedia::AlbumArtist).toString(), artist);
- QCOMPARE(recorder.metaData(QtMultimedia::Title).toString(), title);
-
- QList<QtMultimedia::MetaData> metaDataKeys = recorder.availableMetaData();
- QCOMPARE(metaDataKeys.size(), 3);
- QVERIFY(metaDataKeys.contains(QtMultimedia::AlbumArtist));
- QVERIFY(metaDataKeys.contains(QtMultimedia::Title));
- QVERIFY(metaDataKeys.contains(QtMultimedia::Genre));
-}
-
-void tst_QMediaRecorder::setMetaData_data()
-{
- QTest::addColumn<QString>("title");
-
- QTest::newRow("")
- << QString::fromLatin1("In the Kingdom of the Blind the One eyed are Kings");
-}
-
-void tst_QMediaRecorder::setMetaData()
-{
- QFETCH(QString, title);
-
- MockMediaRecorderControl recorderControl(0);
- MockMediaRecorderService service(0, &recorderControl);
- service.mockMetaDataControl->populateMetaData();
-
- MockMediaObject object(0, &service);
-
- QMediaRecorder recorder(&object);
-
- recorder.setMetaData(QtMultimedia::Title, title);
- QCOMPARE(recorder.metaData(QtMultimedia::Title).toString(), title);
- QCOMPARE(service.mockMetaDataControl->m_data.value(QtMultimedia::Title).toString(), title);
-}
-
-void tst_QMediaRecorder::extendedMetaData()
-{
- QFETCH(QString, artist);
- QFETCH(QString, title);
- QFETCH(QString, genre);
-
- MockMediaRecorderControl recorderControl(0);
- MockMediaRecorderService service(0, &recorderControl);
- MockMediaObject object(0, &service);
-
- QMediaRecorder recorder(&object);
- QVERIFY(recorder.availableExtendedMetaData().isEmpty());
-
- service.mockMetaDataControl->m_extendedData.insert(QLatin1String("Artist"), artist);
- service.mockMetaDataControl->m_extendedData.insert(QLatin1String("Title"), title);
- service.mockMetaDataControl->m_extendedData.insert(QLatin1String("Genre"), genre);
-
- QCOMPARE(recorder.extendedMetaData(QLatin1String("Artist")).toString(), artist);
- QCOMPARE(recorder.extendedMetaData(QLatin1String("Title")).toString(), title);
-
- QStringList extendedKeys = recorder.availableExtendedMetaData();
- QCOMPARE(extendedKeys.size(), 3);
- QVERIFY(extendedKeys.contains(QLatin1String("Artist")));
- QVERIFY(extendedKeys.contains(QLatin1String("Title")));
- QVERIFY(extendedKeys.contains(QLatin1String("Genre")));
-}
-
-void tst_QMediaRecorder::setExtendedMetaData()
-{
- MockMediaRecorderControl recorderControl(0);
- MockMediaRecorderService service(0, &recorderControl);
- service.mockMetaDataControl->populateMetaData();
-
- MockMediaObject object(0, &service);
-
- QMediaRecorder recorder(&object);
-
- QString title(QLatin1String("In the Kingdom of the Blind the One eyed are Kings"));
-
- recorder.setExtendedMetaData(QLatin1String("Title"), title);
- QCOMPARE(recorder.extendedMetaData(QLatin1String("Title")).toString(), title);
- QCOMPARE(service.mockMetaDataControl->m_extendedData.value(QLatin1String("Title")).toString(), title);
-}
-
-
-void tst_QMediaRecorder::testAudioSettingsCopyConstructor()
-{
- /* create an object for AudioEncodersettings */
- QAudioEncoderSettings audiosettings;
- QVERIFY(audiosettings.isNull());
-
- /* setting the desired properties for the AudioEncoder */
- audiosettings.setBitRate(128*1000);
- audiosettings.setChannelCount(4);
- audiosettings.setCodec("audio/pcm");
- audiosettings.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- audiosettings.setQuality(QtMultimedia::LowQuality);
- audiosettings.setSampleRate(44100);
-
- /* Copy constructor */
- QAudioEncoderSettings other(audiosettings);
- QVERIFY(!(other.isNull()));
-
- /* Verifying whether data is copied properly or not */
- QVERIFY(other.bitRate() == audiosettings.bitRate());
- QVERIFY(other.sampleRate() == audiosettings.sampleRate());
- QVERIFY(other.channelCount() == audiosettings.channelCount());
- QCOMPARE(other.codec(), audiosettings.codec());
- QVERIFY(other.encodingMode() == audiosettings.encodingMode());
- QVERIFY(other.quality() == audiosettings.quality());
-}
-
-void tst_QMediaRecorder::testAudioSettingsOperatorNotEqual()
-{
- /* create an object for AudioEncodersettings */
- QAudioEncoderSettings audiosettings1;
- QVERIFY(audiosettings1.isNull());
-
- QAudioEncoderSettings audiosettings2;
- QVERIFY(audiosettings2.isNull());
-
- /* setting the desired properties to for the AudioEncoder */
- audiosettings1.setBitRate(128*1000);
- audiosettings1.setChannelCount(4);
- audiosettings1.setCodec("audio/pcm");
- audiosettings1.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- audiosettings1.setQuality(QtMultimedia::LowQuality);
- audiosettings1.setSampleRate(44100);
-
- /* setting the desired properties for the AudioEncoder */
- audiosettings2.setBitRate(128*1000);
- audiosettings2.setChannelCount(4);
- audiosettings2.setCodec("audio/pcm");
- audiosettings2.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- audiosettings2.setQuality(QtMultimedia::LowQuality);
- audiosettings2.setSampleRate(44100);
-
- /* verify the both are equal or not */
- QVERIFY(!(audiosettings1 != audiosettings2));
-
- /* Modify the settings value for one object */
- audiosettings2.setBitRate(64*1000);
- audiosettings2.setEncodingMode(QtMultimedia::ConstantQualityEncoding);
-
- /* verify the not equal opertor */
- QVERIFY(audiosettings1 != audiosettings2);
-
- QVERIFY(audiosettings2.bitRate() != audiosettings1.bitRate());
- QVERIFY(audiosettings2.encodingMode() != audiosettings1.encodingMode());
-}
-
-void tst_QMediaRecorder::testAudioSettingsOperatorEqual()
-{
- /* create an object for AudioEncodersettings */
- QAudioEncoderSettings audiosettings1;
- QVERIFY(audiosettings1.isNull());
-
- /* setting the desired properties to for the AudioEncoder */
- audiosettings1.setBitRate(128*1000);
- audiosettings1.setChannelCount(4);
- audiosettings1.setCodec("audio/pcm");
- audiosettings1.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- audiosettings1.setQuality(QtMultimedia::LowQuality);
- audiosettings1.setSampleRate(44100);
-
- QAudioEncoderSettings audiosettings2;
- QVERIFY(audiosettings2.isNull());
-
- /* setting the desired properties for the AudioEncoder */
- audiosettings2.setBitRate(128*1000);
- audiosettings2.setChannelCount(4);
- audiosettings2.setCodec("audio/pcm");
- audiosettings2.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- audiosettings2.setQuality(QtMultimedia::LowQuality);
- audiosettings2.setSampleRate(44100);
-
- /* verify both the values are same or not */
- QVERIFY(audiosettings1 == audiosettings2);
- audiosettings2.setChannelCount(2);
- QVERIFY(audiosettings1 != audiosettings2);
-}
-
-void tst_QMediaRecorder::testAudioSettingsOperatorAssign()
-{
-
- /* create an object for AudioEncodersettings */
- QAudioEncoderSettings audiosettings1;
- QVERIFY(audiosettings1.isNull());
-
- /* setting the desired properties for the AudioEncoder */
- audiosettings1.setBitRate(128*1000);
- audiosettings1.setChannelCount(4);
- audiosettings1.setCodec("audio/pcm");
- audiosettings1.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- audiosettings1.setQuality(QtMultimedia::LowQuality);
- audiosettings1.setSampleRate(44100);
-
- QAudioEncoderSettings audiosettings2;
- audiosettings2 = audiosettings1;
- /* Verifying whether data is copied properly or not */
- QVERIFY(audiosettings2.bitRate() == audiosettings1.bitRate());
- QVERIFY(audiosettings2.sampleRate() == audiosettings1.sampleRate());
- QVERIFY(audiosettings2.channelCount() == audiosettings1.channelCount());
- QCOMPARE(audiosettings2.codec(), audiosettings1.codec());
- QVERIFY(audiosettings2.encodingMode() == audiosettings1.encodingMode());
- QVERIFY(audiosettings2.quality() == audiosettings1.quality());
-}
-
-void tst_QMediaRecorder::testAudioSettingsDestructor()
-{
- /* Creating null object for the audioencodersettings */
- QAudioEncoderSettings * audiosettings = new QAudioEncoderSettings;
-
- /* Verifying the object is null or not */
- QVERIFY(audiosettings->isNull());
- /* delete the allocated memory */
- delete audiosettings;
-}
-
-/* availabilityError() API test. */
-void tst_QMediaRecorder::testAvailabilityError()
-{
- MockMediaRecorderService service(0, 0);
- MockMediaObject object(0, &service);
- QMediaRecorder recorder(&object);
- QCOMPARE(recorder.availabilityError(), QtMultimedia::ServiceMissingError);
-
- MockMediaRecorderControl recorderControl(0);
- MockMediaRecorderService service1(0, &recorderControl);
- service1.mockMetaDataControl->populateMetaData();
- MockMediaObject object1(0, &service1);
- QMediaRecorder recorder1(&object1);
- QCOMPARE(recorder1.availabilityError(), QtMultimedia::NoError);
-}
-
-/* isAvailable() API test. */
-void tst_QMediaRecorder::testIsAvailable()
-{
- MockMediaRecorderService service(0, 0);
- MockMediaObject object(0, &service);
- QMediaRecorder recorder(&object);
- QCOMPARE(recorder.isAvailable(), false);
-
- MockMediaRecorderControl recorderControl(0);
- MockMediaRecorderService service1(0, &recorderControl);
- service1.mockMetaDataControl->populateMetaData();
- MockMediaObject object1(0, &service1);
- QMediaRecorder recorder1(&object1);
- QCOMPARE(recorder1.isAvailable(), true);
-}
-
-/* mediaObject() API test. */
-void tst_QMediaRecorder::testMediaObject()
-{
- MockMediaRecorderService service(0, 0);
- service.hasControls = false;
- MockMediaObject object(0, &service);
- QMediaRecorder recorder(&object);
-
- QMediaObject *medobj = recorder.mediaObject();
- QVERIFY(medobj == NULL);
-
- QMediaObject *medobj1 = capture->mediaObject();
- QVERIFY(medobj1 != NULL);
-}
-
-/* enum QMediaRecorder::ResourceError property test. */
-void tst_QMediaRecorder::testEnum()
-{
- const QString errorString(QLatin1String("resource error"));
-
- QSignalSpy spy(capture, SIGNAL(error(QMediaRecorder::Error)));
-
- QCOMPARE(capture->error(), QMediaRecorder::NoError);
- QCOMPARE(capture->errorString(), QString());
-
- mock->error(QMediaRecorder::ResourceError, errorString);
- QCOMPARE(capture->error(), QMediaRecorder::ResourceError);
- QCOMPARE(capture->errorString(), errorString);
- QCOMPARE(spy.count(), 1);
-
- QCOMPARE(spy.last()[0].value<QMediaRecorder::Error>(), QMediaRecorder::ResourceError);
-}
-
-/* Test the QVideoEncoderSettings quality API*/
-void tst_QMediaRecorder::testVideoSettingsQuality()
-{
- /* Create the instance*/
- QVideoEncoderSettings settings;
- QVERIFY(settings.isNull());
- QVERIFY(settings == QVideoEncoderSettings());
-
- /* Verify the default value is intialised correctly*/
- QCOMPARE(settings.quality(), QtMultimedia::NormalQuality);
-
- /* Set all types of Quality parameter and Verify if it is set correctly*/
- settings.setQuality(QtMultimedia::HighQuality);
- QCOMPARE(settings.quality(), QtMultimedia::HighQuality);
- QVERIFY(!settings.isNull());
-
- settings.setQuality(QtMultimedia::VeryLowQuality);
- QCOMPARE(settings.quality(), QtMultimedia::VeryLowQuality);
-
- settings.setQuality(QtMultimedia::LowQuality);
- QCOMPARE(settings.quality(), QtMultimedia::LowQuality);
-
- settings.setQuality(QtMultimedia::VeryHighQuality);
- QCOMPARE(settings.quality(), QtMultimedia::VeryHighQuality);
-}
-
-/* Test QVideoEncoderSettings encodingMode */
-void tst_QMediaRecorder::testVideoSettingsEncodingMode()
-{
- /* Create the instance*/
- QVideoEncoderSettings settings;
- QVERIFY(settings.isNull());
- QVERIFY(settings == QVideoEncoderSettings());
-
- /* Verify the default values are initialised correctly*/
- QCOMPARE(settings.encodingMode(), QtMultimedia::ConstantQualityEncoding);
- QVERIFY(settings.isNull());
-
- /* Set each type of encoding mode and Verify if it is set correctly*/
- settings.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- QCOMPARE(settings.encodingMode(),QtMultimedia::ConstantBitRateEncoding);
- QVERIFY(!settings.isNull());
-
- settings.setEncodingMode(QtMultimedia::AverageBitRateEncoding);
- QCOMPARE(settings.encodingMode(), QtMultimedia::AverageBitRateEncoding);
-
- settings.setEncodingMode(QtMultimedia::TwoPassEncoding);
- QCOMPARE(settings.encodingMode(), QtMultimedia::TwoPassEncoding);
-}
-
-/* Test QVideoEncoderSettings copy constructor */
-void tst_QMediaRecorder::testVideoSettingsCopyConstructor()
-{
- /* Create the instance and initialise it*/
- QVideoEncoderSettings settings1;
- settings1.setCodec(QLatin1String("codecName"));
- settings1.setBitRate(128000);
- settings1.setQuality(QtMultimedia::HighQuality);
- settings1.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- settings1.setFrameRate(30000.0/10001);
- settings1.setResolution(QSize(320,240));
-
- /* Create another instance with instance1 as argument*/
- QVideoEncoderSettings settings2(settings1);
-
- /* Verify if all the parameters are copied correctly*/
- QCOMPARE(settings2 != settings1, false);
- QCOMPARE(settings2.codec(), QLatin1String("codecName"));
- QCOMPARE(settings2.bitRate(), 128000);
- QCOMPARE(settings2.encodingMode(), QtMultimedia::ConstantBitRateEncoding);
- QVERIFY(qFuzzyCompare(settings2.frameRate(), qreal(30000.0/10001)));
- QCOMPARE(settings2.resolution(), QSize(320,240));
- QCOMPARE(settings2.quality(), QtMultimedia::HighQuality);
-
- /* Verify both the instances are equal*/
- QCOMPARE(settings2, settings1);
- QVERIFY(!settings2.isNull());
-}
-
-/* Test QVideoEncoderSettings Overloaded Operator assignment*/
-void tst_QMediaRecorder::testVideoSettingsOperatorAssignment()
-{
- /* Create two instances.*/
- QVideoEncoderSettings settings1;
- QVideoEncoderSettings settings2;
- QCOMPARE(settings2, settings1);
- QVERIFY(settings2.isNull());
-
- /* Initialize all the parameters */
- settings1.setCodec(QLatin1String("codecName"));
- settings1.setBitRate(128000);
- settings1.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- settings1.setFrameRate(30000.0/10001);
- settings1.setResolution(QSize(320,240));
- settings1.setQuality(QtMultimedia::HighQuality);
- /* Assign one object to other*/
- settings2 = settings1;
-
- /* Verify all the parameters are copied correctly*/
- QCOMPARE(settings2, settings1);
- QCOMPARE(settings2.codec(), QLatin1String("codecName"));
- QCOMPARE(settings2.bitRate(), 128000);
- QCOMPARE(settings2.encodingMode(), QtMultimedia::ConstantBitRateEncoding);
- QVERIFY(qFuzzyCompare(settings2.frameRate(), qreal(30000.0/10001)));
- QCOMPARE(settings2.resolution(), QSize(320,240));
- QCOMPARE(settings2.quality(), QtMultimedia::HighQuality);
- QCOMPARE(settings2, settings1);
- QVERIFY(!settings2.isNull());
-}
-
-/* Test QVideoEncoderSettings Overloaded OperatorNotEqual*/
-void tst_QMediaRecorder::testVideoSettingsOperatorNotEqual()
-{
- /* Create the instance and set the bit rate and Verify objects with OperatorNotEqual*/
- QVideoEncoderSettings settings1;
- settings1.setBitRate(1);
- QVideoEncoderSettings settings2;
- settings2.setBitRate(1);
- /* OperatorNotEqual returns false when both objects are equal*/
- QCOMPARE(settings1 != settings2, false);
- settings2.setBitRate(2);
- /* OperatorNotEqual returns true when both objects are not equal*/
- QVERIFY(settings1 != settings2);
-
- /* Verify Resolution with not equal operator*/
- settings1 = QVideoEncoderSettings();
- settings1.setResolution(800,600);
- settings2 = QVideoEncoderSettings();
- settings2.setResolution(QSize(800,600));
- /* OperatorNotEqual returns false when both objects are equal*/
- QCOMPARE(settings1 != settings2, false);
- settings2.setResolution(QSize(400,300));
- /* OperatorNotEqual returns true when both objects are not equal*/
- QVERIFY(settings1 != settings2);
-
- /* Verify Codec with not equal operator*/
- settings1 = QVideoEncoderSettings();
- settings1.setCodec("codec1");
- settings2 = QVideoEncoderSettings();
- settings2.setCodec("codec1");
- /* OperatorNotEqual returns false when both objects are equal*/
- QCOMPARE(settings1 != settings2, false);
- settings2.setCodec("codec2");
- /* OperatorNotEqual returns true when both objects are not equal*/
- QVERIFY(settings1 != settings2);
-
- /* Verify EncodingMode with not equal operator*/
- settings1 = QVideoEncoderSettings();
- settings1.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- settings2 = QVideoEncoderSettings();
- settings2.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- /* OperatorNotEqual returns false when both objects are equal*/
- QCOMPARE(settings1 != settings2, false);
- settings2.setEncodingMode(QtMultimedia::TwoPassEncoding);
- /* OperatorNotEqual returns true when both objects are not equal*/
- QVERIFY(settings1 != settings2);
-
- /* Verify Quality with not equal operator*/
- settings1 = QVideoEncoderSettings();
- settings1.setQuality(QtMultimedia::NormalQuality);
- settings2 = QVideoEncoderSettings();
- settings2.setQuality(QtMultimedia::NormalQuality);
- /* OperatorNotEqual returns false when both objects are equal*/
- QCOMPARE(settings1 != settings2, false);
- settings2.setQuality(QtMultimedia::LowQuality);
- /* OperatorNotEqual returns true when both objects are not equal*/
- QVERIFY(settings1 != settings2);
-
- /* Verify FrameRate with not equal operator*/
- settings1 = QVideoEncoderSettings();
- settings1.setFrameRate(1);
- settings2 = QVideoEncoderSettings();
- settings2.setFrameRate(1);
- /* OperatorNotEqual returns false when both objects are equal*/
- QCOMPARE(settings1 != settings2, false);
- settings2.setFrameRate(2);
- /* OperatorNotEqual returns true when both objects are not equal*/
- QVERIFY(settings1 != settings2);
-}
-
-/* Test QVideoEncoderSettings Overloaded comparison operator*/
-void tst_QMediaRecorder::testVideoSettingsOperatorComparison()
-{
- /* Create the instance and set the bit rate and Verify objects with comparison operator*/
- QVideoEncoderSettings settings1;
- settings1.setBitRate(1);
- QVideoEncoderSettings settings2;
- settings2.setBitRate(1);
-
- /* Comparison operator returns true when both objects are equal*/
- QVERIFY(settings1 == settings2);
- settings2.setBitRate(2);
- /* Comparison operator returns false when both objects are not equal*/
- QCOMPARE(settings1 == settings2, false);
-
- /* Verify resolution with comparison operator*/
- settings1 = QVideoEncoderSettings();
- settings1.setResolution(800,600);
- settings2 = QVideoEncoderSettings();
- settings2.setResolution(QSize(800,600));
- /* Comparison operator returns true when both objects are equal*/
- QVERIFY(settings1 == settings2);
- settings2.setResolution(QSize(400,300));
- /* Comparison operator returns false when both objects are not equal*/
- QCOMPARE(settings1 == settings2, false);
-
- /* Verify Codec with comparison operator*/
- settings1 = QVideoEncoderSettings();
- settings1.setCodec("codec1");
- settings2 = QVideoEncoderSettings();
- settings2.setCodec("codec1");
- /* Comparison operator returns true when both objects are equal*/
- QVERIFY(settings1 == settings2);
- settings2.setCodec("codec2");
- /* Comparison operator returns false when both objects are not equal*/
- QCOMPARE(settings1 == settings2, false);
-
- /* Verify EncodingMode with comparison operator*/
- settings1 = QVideoEncoderSettings();
- settings1.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- settings2 = QVideoEncoderSettings();
- settings2.setEncodingMode(QtMultimedia::ConstantBitRateEncoding);
- /* Comparison operator returns true when both objects are equal*/
- QVERIFY(settings1 == settings2);
- settings2.setEncodingMode(QtMultimedia::TwoPassEncoding);
- /* Comparison operator returns false when both objects are not equal*/
- QCOMPARE(settings1 == settings2, false);
-
- /* Verify Quality with comparison operator*/
- settings1 = QVideoEncoderSettings();
- settings1.setQuality(QtMultimedia::NormalQuality);
- settings2 = QVideoEncoderSettings();
- settings2.setQuality(QtMultimedia::NormalQuality);
- /* Comparison operator returns true when both objects are equal*/
- QVERIFY(settings1 == settings2);
- settings2.setQuality(QtMultimedia::LowQuality);
- /* Comparison operator returns false when both objects are not equal*/
- QCOMPARE(settings1 == settings2, false);
-
- /* Verify FrameRate with comparison operator*/
- settings1 = QVideoEncoderSettings();
- settings1.setFrameRate(1);
- settings2 = QVideoEncoderSettings();
- settings2.setFrameRate(1);
- /* Comparison operator returns true when both objects are equal*/
- QVERIFY(settings1 == settings2);
- settings2.setFrameRate(2);
- /* Comparison operator returns false when both objects are not equal*/
- QCOMPARE(settings1 == settings2, false);
-}
-
-/* Test the destuctor of the QVideoEncoderSettings*/
-void tst_QMediaRecorder::testVideoSettingsDestructor()
-{
- /* Create the instance on heap and verify if object deleted correctly*/
- QVideoEncoderSettings *settings1 = new QVideoEncoderSettings();
- QVERIFY(settings1 != NULL);
- QVERIFY(settings1->isNull());
- delete settings1;
-
- /* Create the instance on heap and initialise it and verify if object deleted correctly.*/
- QVideoEncoderSettings *settings2 = new QVideoEncoderSettings();
- QVERIFY(settings2 != NULL);
- settings2->setCodec(QString("codec"));
- QVERIFY(!settings2->isNull());
- delete settings2;
-}
diff --git a/tests/auto/qmediarecorder/tst_qmediarecorder.h b/tests/auto/qmediarecorder/tst_qmediarecorder.h
deleted file mode 100755
index d0202a0..0000000
--- a/tests/auto/qmediarecorder/tst_qmediarecorder.h
+++ /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$
-**
-****************************************************************************/
-#ifndef TST_QMEDIARECORDER_H
-#define TST_QMEDIARECORDER_H
-
-#include <QtTest/QtTest>
-#include <QDebug>
-#include <qmediaobject.h>
-#include <qmediacontrol.h>
-#include <qmediaservice.h>
-#include <qmediarecordercontrol.h>
-#include <qmediarecorder.h>
-#include <qmetadatawritercontrol.h>
-#include <qaudioendpointselector.h>
-#include <qaudioencodercontrol.h>
-#include <qmediacontainercontrol.h>
-#include <qvideoencodercontrol.h>
-
-#include <qaudioformat.h>
-
-#include "mockmediarecorderservice.h"
-#include "mockmediaobject.h"
-
-class tst_QMediaRecorder: public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- void testNullService();
- void testNullControls();
- void testDeleteMediaObject();
- void testError();
- void testSink();
- void testRecord();
- void testMute();
- void testAudioDeviceControl();
- void testAudioEncodeControl();
- void testMediaFormatsControl();
- void testVideoEncodeControl();
- void testEncodingSettings();
- void testAudioSettings();
- void testVideoSettings();
-
- void nullMetaDataControl();
- void isMetaDataAvailable();
- void isWritable();
- void metaDataChanged();
- void metaData_data();
- void metaData();
- void setMetaData_data();
- void setMetaData();
- void extendedMetaData_data() { metaData_data(); }
- void extendedMetaData();
- void setExtendedMetaData_data() { extendedMetaData_data(); }
- void setExtendedMetaData();
-
- void testAudioSettingsCopyConstructor();
- void testAudioSettingsOperatorNotEqual();
- void testAudioSettingsOperatorEqual();
- void testAudioSettingsOperatorAssign();
- void testAudioSettingsDestructor();
-
- void testAvailabilityError();
- void testIsAvailable();
- void testMediaObject();
- void testEnum();
-
- void testVideoSettingsQuality();
- void testVideoSettingsEncodingMode();
- void testVideoSettingsCopyConstructor();
- void testVideoSettingsOperatorAssignment();
- void testVideoSettingsOperatorNotEqual();
- void testVideoSettingsOperatorComparison();
- void testVideoSettingsDestructor();
-
-private:
- QAudioEncoderControl* encode;
- QAudioEndpointSelector* audio;
- MockMediaObject *object;
- MockMediaRecorderService*service;
- MockMediaRecorderControl *mock;
- QMediaRecorder *capture;
- QVideoEncoderControl* videoEncode;
-};
-#endif //TST_QMEDIARECORDER_H
diff --git a/tests/auto/qmediaresource/qmediaresource.pro b/tests/auto/qmediaresource/qmediaresource.pro
deleted file mode 100644
index b6c1e71..0000000
--- a/tests/auto/qmediaresource/qmediaresource.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediaresource
-
-QT += network multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qmediaresource.cpp
-
diff --git a/tests/auto/qmediaresource/tst_qmediaresource.cpp b/tests/auto/qmediaresource/tst_qmediaresource.cpp
deleted file mode 100644
index 8051deb..0000000
--- a/tests/auto/qmediaresource/tst_qmediaresource.cpp
+++ /dev/null
@@ -1,700 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-
-#include "qmediaresource.h"
-
-QT_USE_NAMESPACE
-class tst_QMediaResource : public QObject
-{
- Q_OBJECT
-private slots:
- void constructNull();
- void construct_data();
- void construct();
- void setResolution();
- void equality();
- void copy();
- void assign();
-
- void constructorRequest();
- void copyConstructor();
-};
-
-void tst_QMediaResource::constructNull()
-{
- QMediaResource resource;
-
- QCOMPARE(resource.isNull(), true);
- QCOMPARE(resource.url(), QUrl());
- QCOMPARE(resource.request(), QNetworkRequest());
- QCOMPARE(resource.mimeType(), QString());
- QCOMPARE(resource.language(), QString());
- QCOMPARE(resource.audioCodec(), QString());
- QCOMPARE(resource.videoCodec(), QString());
- QCOMPARE(resource.dataSize(), qint64(0));
- QCOMPARE(resource.audioBitRate(), 0);
- QCOMPARE(resource.sampleRate(), 0);
- QCOMPARE(resource.channelCount(), 0);
- QCOMPARE(resource.videoBitRate(), 0);
- QCOMPARE(resource.resolution(), QSize());
-}
-
-void tst_QMediaResource::construct_data()
-{
- QTest::addColumn<QUrl>("url");
- QTest::addColumn<QNetworkRequest>("request");
- QTest::addColumn<QString>("mimeType");
- QTest::addColumn<QString>("language");
- QTest::addColumn<QString>("audioCodec");
- QTest::addColumn<QString>("videoCodec");
- QTest::addColumn<qint64>("dataSize");
- QTest::addColumn<int>("audioBitRate");
- QTest::addColumn<int>("sampleRate");
- QTest::addColumn<int>("channelCount");
- QTest::addColumn<int>("videoBitRate");
- QTest::addColumn<QSize>("resolution");
-
- QTest::newRow("audio content")
- << QUrl(QString::fromLatin1("http:://test.com/test.mp3"))
- << QNetworkRequest(QUrl(QString::fromLatin1("http:://test.com/test.mp3")))
- << QString::fromLatin1("audio/mpeg")
- << QString::fromLatin1("eng")
- << QString::fromLatin1("mp3")
- << QString()
- << qint64(5465433)
- << 128000
- << 44100
- << 2
- << 0
- << QSize();
- QTest::newRow("image content")
- << QUrl(QString::fromLatin1("http:://test.com/test.jpg"))
- << QNetworkRequest(QUrl(QString::fromLatin1("http:://test.com/test.jpg")))
- << QString::fromLatin1("image/jpeg")
- << QString()
- << QString()
- << QString()
- << qint64(23600)
- << 0
- << 0
- << 0
- << 0
- << QSize(640, 480);
- QTest::newRow("video content")
- << QUrl(QString::fromLatin1("http:://test.com/test.mp4"))
- << QNetworkRequest(QUrl(QString::fromLatin1("http:://test.com/test.mp4")))
- << QString::fromLatin1("video/mp4")
- << QString()
- << QString::fromLatin1("aac")
- << QString::fromLatin1("h264")
- << qint64(36245851)
- << 96000
- << 44000
- << 5
- << 750000
- << QSize(720, 576);
- QTest::newRow("thumbnail")
- << QUrl(QString::fromLatin1("file::///thumbs/test.png"))
- << QNetworkRequest(QUrl(QString::fromLatin1("file::///thumbs/test.png")))
- << QString::fromLatin1("image/png")
- << QString()
- << QString()
- << QString()
- << qint64(2360)
- << 0
- << 0
- << 0
- << 0
- << QSize(128, 128);
-}
-
-void tst_QMediaResource::construct()
-{
- QFETCH(QUrl, url);
- QFETCH(QNetworkRequest, request);
- QFETCH(QString, mimeType);
- QFETCH(QString, language);
- QFETCH(QString, audioCodec);
- QFETCH(QString, videoCodec);
- QFETCH(qint64, dataSize);
- QFETCH(int, audioBitRate);
- QFETCH(int, sampleRate);
- QFETCH(int, channelCount);
- QFETCH(int, videoBitRate);
- QFETCH(QSize, resolution);
-
- {
- QMediaResource resource(url);
-
- QCOMPARE(resource.isNull(), false);
- QCOMPARE(resource.url(), url);
- QCOMPARE(resource.mimeType(), QString());
- QCOMPARE(resource.language(), QString());
- QCOMPARE(resource.audioCodec(), QString());
- QCOMPARE(resource.videoCodec(), QString());
- QCOMPARE(resource.dataSize(), qint64(0));
- QCOMPARE(resource.audioBitRate(), 0);
- QCOMPARE(resource.sampleRate(), 0);
- QCOMPARE(resource.channelCount(), 0);
- QCOMPARE(resource.videoBitRate(), 0);
- QCOMPARE(resource.resolution(), QSize());
- }
- {
- QMediaResource resource(url, mimeType);
-
- QCOMPARE(resource.isNull(), false);
- QCOMPARE(resource.url(), url);
- QCOMPARE(resource.request(), request);
- QCOMPARE(resource.mimeType(), mimeType);
- QCOMPARE(resource.language(), QString());
- QCOMPARE(resource.audioCodec(), QString());
- QCOMPARE(resource.videoCodec(), QString());
- QCOMPARE(resource.dataSize(), qint64(0));
- QCOMPARE(resource.audioBitRate(), 0);
- QCOMPARE(resource.sampleRate(), 0);
- QCOMPARE(resource.channelCount(), 0);
- QCOMPARE(resource.videoBitRate(), 0);
- QCOMPARE(resource.resolution(), QSize());
-
- resource.setLanguage(language);
- resource.setAudioCodec(audioCodec);
- resource.setVideoCodec(videoCodec);
- resource.setDataSize(dataSize);
- resource.setAudioBitRate(audioBitRate);
- resource.setSampleRate(sampleRate);
- resource.setChannelCount(channelCount);
- resource.setVideoBitRate(videoBitRate);
- resource.setResolution(resolution);
-
- QCOMPARE(resource.language(), language);
- QCOMPARE(resource.audioCodec(), audioCodec);
- QCOMPARE(resource.videoCodec(), videoCodec);
- QCOMPARE(resource.dataSize(), dataSize);
- QCOMPARE(resource.audioBitRate(), audioBitRate);
- QCOMPARE(resource.sampleRate(), sampleRate);
- QCOMPARE(resource.channelCount(), channelCount);
- QCOMPARE(resource.videoBitRate(), videoBitRate);
- QCOMPARE(resource.resolution(), resolution);
- }
- {
- QMediaResource resource(request, mimeType);
-
- QCOMPARE(resource.isNull(), false);
- QCOMPARE(resource.url(), url);
- QCOMPARE(resource.request(), request);
- QCOMPARE(resource.mimeType(), mimeType);
- QCOMPARE(resource.language(), QString());
- QCOMPARE(resource.audioCodec(), QString());
- QCOMPARE(resource.videoCodec(), QString());
- QCOMPARE(resource.dataSize(), qint64(0));
- QCOMPARE(resource.audioBitRate(), 0);
- QCOMPARE(resource.sampleRate(), 0);
- QCOMPARE(resource.channelCount(), 0);
- QCOMPARE(resource.videoBitRate(), 0);
- QCOMPARE(resource.resolution(), QSize());
-
- resource.setLanguage(language);
- resource.setAudioCodec(audioCodec);
- resource.setVideoCodec(videoCodec);
- resource.setDataSize(dataSize);
- resource.setAudioBitRate(audioBitRate);
- resource.setSampleRate(sampleRate);
- resource.setChannelCount(channelCount);
- resource.setVideoBitRate(videoBitRate);
- resource.setResolution(resolution);
-
- QCOMPARE(resource.language(), language);
- QCOMPARE(resource.audioCodec(), audioCodec);
- QCOMPARE(resource.videoCodec(), videoCodec);
- QCOMPARE(resource.dataSize(), dataSize);
- QCOMPARE(resource.audioBitRate(), audioBitRate);
- QCOMPARE(resource.sampleRate(), sampleRate);
- QCOMPARE(resource.channelCount(), channelCount);
- QCOMPARE(resource.videoBitRate(), videoBitRate);
- QCOMPARE(resource.resolution(), resolution);
- }
-}
-
-void tst_QMediaResource::setResolution()
-{
- QMediaResource resource(
- QUrl(QString::fromLatin1("file::///thumbs/test.png")),
- QString::fromLatin1("image/png"));
-
- QCOMPARE(resource.resolution(), QSize());
-
- resource.setResolution(QSize(120, 80));
- QCOMPARE(resource.resolution(), QSize(120, 80));
-
- resource.setResolution(QSize(-1, 23));
- QCOMPARE(resource.resolution(), QSize(-1, 23));
-
- resource.setResolution(QSize(-43, 34));
- QCOMPARE(resource.resolution(), QSize(-43, 34));
-
- resource.setResolution(QSize(64, -1));
- QCOMPARE(resource.resolution(), QSize(64, -1));
-
- resource.setResolution(QSize(64, -83));
- QCOMPARE(resource.resolution(), QSize(64, -83));
-
- resource.setResolution(QSize(-12, -83));
- QCOMPARE(resource.resolution(), QSize(-12, -83));
-
- resource.setResolution(QSize());
- QCOMPARE(resource.resolution(), QSize(-1, -1));
-
- resource.setResolution(120, 80);
- QCOMPARE(resource.resolution(), QSize(120, 80));
-
- resource.setResolution(-1, 23);
- QCOMPARE(resource.resolution(), QSize(-1, 23));
-
- resource.setResolution(-43, 34);
- QCOMPARE(resource.resolution(), QSize(-43, 34));
-
- resource.setResolution(64, -1);
- QCOMPARE(resource.resolution(), QSize(64, -1));
-
- resource.setResolution(64, -83);
- QCOMPARE(resource.resolution(), QSize(64, -83));
-
- resource.setResolution(-12, -83);
- QCOMPARE(resource.resolution(), QSize(-12, -83));
-
- resource.setResolution(-1, -1);
- QCOMPARE(resource.resolution(), QSize());
-}
-
-void tst_QMediaResource::equality()
-{
- QMediaResource resource1(
- QUrl(QString::fromLatin1("http://test.com/test.mp4")),
- QString::fromLatin1("video/mp4"));
- QMediaResource resource2(
- QUrl(QString::fromLatin1("http://test.com/test.mp4")),
- QString::fromLatin1("video/mp4"));
- QMediaResource resource3(
- QUrl(QString::fromLatin1("file:///thumbs/test.jpg")));
- QMediaResource resource4(
- QUrl(QString::fromLatin1("file:///thumbs/test.jpg")));
- QMediaResource resource5(
- QUrl(QString::fromLatin1("http://test.com/test.mp3")),
- QString::fromLatin1("audio/mpeg"));
-
- QNetworkRequest request(QUrl("http://test.com/test.mp3"));
- QString requestMimeType("audio/mp3");
-
- QMediaResource requestResource1(request, requestMimeType);
- QMediaResource requestResource2(request, requestMimeType);
-
- QCOMPARE(requestResource1 == requestResource2, true);
- QCOMPARE(requestResource1 != requestResource2, false);
- QCOMPARE(requestResource1 != resource5, true);
-
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- QCOMPARE(resource3 == resource4, true);
- QCOMPARE(resource3 != resource4, false);
-
- QCOMPARE(resource1 == resource3, false);
- QCOMPARE(resource1 != resource3, true);
-
- QCOMPARE(resource1 == resource5, false);
- QCOMPARE(resource1 != resource5, true);
-
- resource1.setAudioCodec(QString::fromLatin1("mp3"));
- resource2.setAudioCodec(QString::fromLatin1("aac"));
-
- // Not equal differing audio codecs.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource1.setAudioCodec(QString::fromLatin1("aac"));
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setVideoCodec(QString());
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setVideoCodec(QString::fromLatin1("h264"));
-
- // Not equal differing video codecs.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource2.setVideoCodec(QString::fromLatin1("h264"));
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource2.setDataSize(0);
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setDataSize(546423);
-
- // Not equal differing video codecs.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource2.setDataSize(546423);
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setAudioBitRate(96000);
- resource1.setSampleRate(48000);
- resource2.setSampleRate(44100);
- resource1.setChannelCount(0);
- resource1.setVideoBitRate(900000);
- resource2.setLanguage(QString::fromLatin1("eng"));
-
- // Not equal, audio bit rate, sample rate, video bit rate, and
- // language.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource2.setAudioBitRate(96000);
- resource1.setSampleRate(44100);
-
- // Not equal, differing video bit rate, and language.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource2.setVideoBitRate(900000);
- resource1.setLanguage(QString::fromLatin1("eng"));
-
- // Equal
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setResolution(QSize());
-
- // Equal
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource2.setResolution(-1, -1);
-
- // Equal
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setResolution(QSize(-640, -480));
-
- // Not equal, differing resolution.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
- resource1.setResolution(QSize(640, 480));
- resource2.setResolution(QSize(800, 600));
-
- // Not equal, differing resolution.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource1.setResolution(800, 600);
-
- // Equal
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- /* equality tests for constructor of QMediaresource(QNetworkrequest,mimeType)*/
- QNetworkRequest request2(QUrl(QString::fromLatin1("http://test.com/test.mp4")));
- QUrl url(QString::fromLatin1("http://test.com/test.mp4"));
- QString mimeType(QLatin1String("video/mp4"));
-
- QMediaResource resource6(request2,mimeType);
- QMediaResource resource7(request2,mimeType);
-
-
- QVERIFY(resource6.request()==request2);
- QVERIFY(resource6.mimeType()==mimeType);
-
-
- QVERIFY(resource7.request()==request2);
- QVERIFY(resource7.mimeType()==mimeType);
-
- QVERIFY(resource6.request()==resource7.request());
- QVERIFY(resource6.mimeType()==resource7.mimeType());
-
- QVERIFY(resource6==resource7);
-
- /*for copy constructor*/
- QMediaResource resource8(resource7);
-
- QVERIFY(resource8.request()==request2);
- QVERIFY(resource8.mimeType()==mimeType);
-
-
- QVERIFY(resource7.request()==request2);
- QVERIFY(resource7.mimeType()==mimeType);
-
- QVERIFY(resource8.request()==resource7.request());
- QVERIFY(resource8.mimeType()==resource7.mimeType());
-
-
- QVERIFY(resource8==resource7);
-
- /*for assign constructor*/
-
- QMediaResource resource9(request2,mimeType);
-
- QMediaResource resource10=resource9;
-
- QVERIFY(resource10.request()==request2);
- QVERIFY(resource10.mimeType()==mimeType);
-
-
- QVERIFY(resource9.request()==request2);
- QVERIFY(resource9.mimeType()==mimeType);
-
- QVERIFY(resource8.request()==resource7.request());
- QVERIFY(resource8.mimeType()==resource7.mimeType());
-
- QVERIFY(resource8==resource7);
-}
-
-void tst_QMediaResource::copy()
-{
- const QUrl url(QString::fromLatin1("http://test.com/test.mp4"));
- const QString mimeType(QLatin1String("video/mp4"));
- const QString amrCodec(QLatin1String("amr"));
- const QString mp3Codec(QLatin1String("mp3"));
- const QString aacCodec(QLatin1String("aac"));
- const QString h264Codec(QLatin1String("h264"));
-
- QMediaResource original(url, mimeType);
- original.setAudioCodec(amrCodec);
-
- QMediaResource copy(original);
-
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
- QCOMPARE(copy.audioCodec(), amrCodec);
-
- QCOMPARE(original == copy, true);
- QCOMPARE(original != copy, false);
-
- original.setAudioCodec(mp3Codec);
-
- QCOMPARE(copy.audioCodec(), amrCodec);
- QCOMPARE(original == copy, false);
- QCOMPARE(original != copy, true);
-
- copy.setAudioCodec(aacCodec);
- copy.setVideoCodec(h264Codec);
-
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
-
- QCOMPARE(original.audioCodec(), mp3Codec);
-}
-
-void tst_QMediaResource::assign()
-{
- const QUrl url(QString::fromLatin1("http://test.com/test.mp4"));
- const QString mimeType(QLatin1String("video/mp4"));
- const QString amrCodec(QLatin1String("amr"));
- const QString mp3Codec(QLatin1String("mp3"));
- const QString aacCodec(QLatin1String("aac"));
- const QString h264Codec(QLatin1String("h264"));
-
- QNetworkRequest request(QUrl(QString::fromLatin1("http://test.com/test.mp4")));
- const qint64 dataSize(23600);
- int audioBitRate = 1, sampleRate = 2, channelCount = 3, videoBitRate = 4;
- QSize resolution(QSize(640, 480));
- QString language("eng");
-
- QMediaResource copy(QUrl(QString::fromLatin1("file:///thumbs/test.jpg")));
-
- QMediaResource original(url, mimeType);
- original.setAudioCodec(amrCodec);
-
- copy = original;
-
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
- QCOMPARE(copy.audioCodec(), amrCodec);
-
- QCOMPARE(original == copy, true);
- QCOMPARE(original != copy, false);
-
- original.setAudioCodec(mp3Codec);
-
- QCOMPARE(copy.audioCodec(), amrCodec);
- QCOMPARE(original == copy, false);
- QCOMPARE(original != copy, true);
-
- copy.setAudioCodec(aacCodec);
- copy.setVideoCodec(h264Codec);
-
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
-
- QCOMPARE(original.audioCodec(), mp3Codec);
-
- /* for constructor of QMediaresource(QNetworkrequest,mimeType)*/
-
- QMediaResource copy1(QNetworkRequest(QUrl(QString::fromLatin1("file:///thumbs/test.jpg"))));
-
- QMediaResource original1(request, mimeType);
-
- original1.setAudioCodec(amrCodec);
- original1.setLanguage(QString("eng"));
- original1.setVideoCodec(h264Codec);
- original1.setDataSize(dataSize);
- original1.setAudioBitRate(audioBitRate);
- original1.setSampleRate(sampleRate);
- original1.setChannelCount(channelCount);
- original1.setVideoBitRate(videoBitRate);
- original1.setResolution(resolution);
-
- copy1 = original1;
-
- QCOMPARE(original1 == copy1, true);
-}
-
-// Constructor for request without passing mimetype.
-void tst_QMediaResource::constructorRequest()
-{
- //Initialise the request and url.
- QNetworkRequest request(QUrl(QString::fromLatin1("http:://test.com/test.mp3")));
- QUrl url(QString::fromLatin1("http:://test.com/test.mp3"));
-
- // Create the instance with request as parameter.
- QMediaResource resource(request);
-
- // Verify all the parameters of objects.
- QCOMPARE(resource.isNull(), false);
- QCOMPARE(resource.url(), url);
- QCOMPARE(resource.request(), request);
- QCOMPARE(resource.mimeType(), QString());
- QCOMPARE(resource.language(), QString());
- QCOMPARE(resource.audioCodec(), QString());
- QCOMPARE(resource.videoCodec(), QString());
- QCOMPARE(resource.dataSize(), qint64(0));
- QCOMPARE(resource.audioBitRate(), 0);
- QCOMPARE(resource.sampleRate(), 0);
- QCOMPARE(resource.channelCount(), 0);
- QCOMPARE(resource.videoBitRate(), 0);
- QCOMPARE(resource.resolution(), QSize());
-}
-
-// Copy constructor with all the parameter and copy constructor for constructor with request and mimetype as parameter.
-void tst_QMediaResource::copyConstructor()
-{
- // Initialise all the parameters.
- const QUrl url(QString::fromLatin1("http://test.com/test.mp4"));
- const QString mimeType(QLatin1String("video/mp4"));
- const QString amrCodec(QLatin1String("amr"));
- const QString h264Codec(QLatin1String("h264"));
-
- const qint64 dataSize(23600);
- int audioBitRate = 1, sampleRate = 2, channelCount = 3, videoBitRate = 4;
- QSize resolution(QSize(640, 480));
- QString language("eng");
-
- // Create the instance with url and mimetype.
- QMediaResource original(url, mimeType);
-
- // Set all the parameters.
- original.setAudioCodec(amrCodec);
- original.setLanguage(QString("eng"));
- original.setVideoCodec(h264Codec);
- original.setDataSize(dataSize);
- original.setAudioBitRate(audioBitRate);
- original.setSampleRate(sampleRate);
- original.setChannelCount(channelCount);
- original.setVideoBitRate(videoBitRate);
- original.setResolution(resolution);
-
- // Copy the instance to new object.
- QMediaResource copy(original);
-
- // Verify all the parameters of the copied object.
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
- QCOMPARE(copy.audioCodec(), amrCodec);
- QCOMPARE(copy.language(), language );
- QCOMPARE(copy.videoCodec(), h264Codec);
- QCOMPARE(copy.dataSize(), dataSize);
- QCOMPARE(copy.audioBitRate(), audioBitRate);
- QCOMPARE(copy.sampleRate(), sampleRate);
- QCOMPARE(copy.channelCount(), channelCount);
- QCOMPARE(copy.videoBitRate(), videoBitRate);
- QCOMPARE(copy.resolution(), resolution);
-
- // Compare both the objects are equal.
- QCOMPARE(original == copy, true);
- QCOMPARE(original != copy, false);
-
- // Initialise the request parameter.
- QNetworkRequest request1(QUrl(QString::fromLatin1("http://test.com/test.mp4")));
-
- // Constructor with rerquest and mimetype.
- QMediaResource original1(request1, mimeType);
-
- // Copy the object and verify if both are eqaul or not.
- QMediaResource copy1(original1);
- QCOMPARE(copy1.url(), url);
- QCOMPARE(copy1.mimeType(), mimeType);
- QCOMPARE(copy1.request(), request1);
- QCOMPARE(original1 == copy1, true);
-}
-
-QTEST_MAIN(tst_QMediaResource)
-
-#include "tst_qmediaresource.moc"
diff --git a/tests/auto/qmediaservice/qmediaservice.pro b/tests/auto/qmediaservice/qmediaservice.pro
deleted file mode 100644
index 9ae2c54..0000000
--- a/tests/auto/qmediaservice/qmediaservice.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediaservice
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qmediaservice.cpp
diff --git a/tests/auto/qmediaservice/tst_qmediaservice.cpp b/tests/auto/qmediaservice/tst_qmediaservice.cpp
deleted file mode 100644
index 3a46c56..0000000
--- a/tests/auto/qmediaservice/tst_qmediaservice.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-
-#include <qvideodevicecontrol.h>
-#include <qmediacontrol.h>
-#include <qmediaservice.h>
-
-#include <QtCore/qcoreapplication.h>
-
-QT_BEGIN_NAMESPACE
-
-class QtTestMediaService;
-
-class QtTestMediaControlA : public QMediaControl
-{
- Q_OBJECT
-};
-
-#define QtTestMediaControlA_iid "com.nokia.QtTestMediaControlA"
-Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlA, QtTestMediaControlA_iid)
-
-class QtTestMediaControlB : public QMediaControl
-{
- Q_OBJECT
-};
-
-#define QtTestMediaControlB_iid "com.nokia.QtTestMediaControlB"
-Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlB, QtTestMediaControlB_iid)
-
-
-class QtTestMediaControlC : public QMediaControl
-{
- Q_OBJECT
-};
-
-#define QtTestMediaControlC_iid "com.nokia.QtTestMediaControlC"
-Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlC, QtTestMediaControlA_iid) // Yes A.
-
-class QtTestMediaControlD : public QMediaControl
-{
- Q_OBJECT
-};
-
-#define QtTestMediaControlD_iid "com.nokia.QtTestMediaControlD"
-Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlD, QtTestMediaControlD_iid)
-
-//unimplemented service
-#define QtTestMediaControlE_iid "com.nokia.QtTestMediaControlF"
-class QtTestMediaControlE : public QMediaControl
-{
- Q_OBJECT
-};
-
-/* implementation of child class by inheriting The QMediaService base class for media service implementations. */
-class QtTestMediaService : public QMediaService
-{
- Q_OBJECT
-public:
- int refA;
- int refB;
- int refC;
- QtTestMediaControlA controlA;
- QtTestMediaControlB controlB;
- QtTestMediaControlC controlC;
-
- //constructor
- QtTestMediaService(): QMediaService(0), refA(0), refB(0), refC(0)
- {
- }
-
- //requestControl() pure virtual function of QMediaService class.
- QMediaControl *requestControl(const char *name)
- {
- if (strcmp(name, QtTestMediaControlA_iid) == 0) {
- refA += 1;
-
- return &controlA;
- } else if (strcmp(name, QtTestMediaControlB_iid) == 0) {
- refB += 1;
-
- return &controlB;
- } else if (strcmp(name, QtTestMediaControlC_iid) == 0) {
- refA += 1;
-
- return &controlA;
- } else {
- return 0;
- }
- }
-
- //releaseControl() pure virtual function of QMediaService class.
- void releaseControl(QMediaControl *control)
- {
- if (control == &controlA)
- refA -= 1;
- else if (control == &controlB)
- refB -= 1;
- else if (control == &controlC)
- refC -= 1;
- }
-
- //requestControl() function of QMediaService class.
- using QMediaService::requestControl;
-};
-
-/* Test case implementation for QMediaService class which provides a common base class for media service implementations.*/
-class tst_QMediaService : public QObject
-{
- Q_OBJECT
-private slots:
- void tst_destructor();
- void tst_releaseControl();
- void tst_requestControl();
- void tst_requestControlTemplate();
-
- void initTestCase();
-
- void control_iid();
- void control();
-
-};
-
-/*MaemoAPI-1668 :destructor property test. */
-void tst_QMediaService::tst_destructor()
-{
- QtTestMediaService *service = new QtTestMediaService;
- delete service;
-}
-
-void tst_QMediaService::initTestCase()
-{
-}
-
-/*MaemoAPI-1669 :releaseControl() API property test. */
-void tst_QMediaService::tst_releaseControl()
-{
- //test class instance creation
- QtTestMediaService service;
-
- //Get a pointer to the media control implementing interface and verify.
- QMediaControl* controlA = service.requestControl(QtTestMediaControlA_iid);
- QCOMPARE(controlA, &service.controlA);
- service.releaseControl(controlA); //Controls must be returned to the service when no longer needed
- QVERIFY(service.refA == 0);
-
- //Get a pointer to the media control implementing interface and verify.
- QMediaControl* controlB = service.requestControl(QtTestMediaControlB_iid);
- QCOMPARE(controlB, &service.controlB);
- service.releaseControl(controlB); //Controls must be returned to the service when no longer needed
- QVERIFY(service.refB == 0);
-}
-
-/*MaemoAPI-1670 :requestControl() API property test. */
-void tst_QMediaService::tst_requestControl()
-{
- //test class instance creation
- QtTestMediaService service;
-
- //Get a pointer to the media control implementing interface and verify.
- QMediaControl* controlA = service.requestControl(QtTestMediaControlA_iid);
- QCOMPARE(controlA, &service.controlA);
- service.releaseControl(controlA); //Controls must be returned to the service when no longer needed
-
- //Get a pointer to the media control implementing interface and verify.
- QMediaControl* controlB = service.requestControl(QtTestMediaControlB_iid);
- QCOMPARE(controlB, &service.controlB);
- service.releaseControl(controlB); //Controls must be returned to the service when no longer needed
-
- //If the service does not implement the control, a null pointer is returned instead.
- QMediaControl* controlE = service.requestControl(QtTestMediaControlE_iid);
- QVERIFY(!controlE); //should return null pointer
- service.releaseControl(controlE); //Controls must be returned to the service when no longer needed
-
- //If the service is unavailable a null pointer is returned instead.
- QMediaControl* control = service.requestControl("");
- QVERIFY(!control); //should return null pointer
- service.releaseControl(control); //Controls must be returned to the service when no longer needed
-}
-
-/*MaemoAPI-1671 :requestControl() API property test. */
-void tst_QMediaService::tst_requestControlTemplate()
-{
- //test class instance creation
- QtTestMediaService service;
-
- //Get a pointer to the media control of type T implemented by a media service.
- QtTestMediaControlA *controlA = service.requestControl<QtTestMediaControlA *>();
- QCOMPARE(controlA, &service.controlA);
- service.releaseControl(controlA);
-
- //Get a pointer to the media control of type T implemented by a media service.
- QtTestMediaControlB *controlB = service.requestControl<QtTestMediaControlB *>();
- QCOMPARE(controlB, &service.controlB);
- service.releaseControl(controlB);
-
- QVERIFY(!service.requestControl<QtTestMediaControlC *>()); // Faulty implementation returns A.
- QCOMPARE(service.refA, 0); // Verify the control was released.
-
- QVERIFY(!service.requestControl<QtTestMediaControlD *>()); // No control of that type.
-}
-
-
-void tst_QMediaService::control_iid()
-{
- const char *nullString = 0;
-
- // Default implementation.
- QCOMPARE(qmediacontrol_iid<QtTestMediaControlE *>(), nullString);
-
- // Partial template.
- QVERIFY(qstrcmp(qmediacontrol_iid<QtTestMediaControlA *>(), QtTestMediaControlA_iid) == 0);
-}
-
-void tst_QMediaService::control()
-{
- QtTestMediaService service;
-
- QtTestMediaControlA *controlA = service.requestControl<QtTestMediaControlA *>();
- QCOMPARE(controlA, &service.controlA);
- service.releaseControl(controlA);
-
- QtTestMediaControlB *controlB = service.requestControl<QtTestMediaControlB *>();
- QCOMPARE(controlB, &service.controlB);
- service.releaseControl(controlB);
-
- QVERIFY(!service.requestControl<QtTestMediaControlC *>()); // Faulty implementation returns A, but is wrong class
- QCOMPARE(service.refA, 0); // Verify the control was released.
-
- QVERIFY(!service.requestControl<QtTestMediaControlD *>()); // No control of that type.
-}
-
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-QTEST_MAIN(tst_QMediaService)
-
-#include "tst_qmediaservice.moc"
diff --git a/tests/auto/qmediaserviceprovider/qmediaserviceprovider.pro b/tests/auto/qmediaserviceprovider/qmediaserviceprovider.pro
deleted file mode 100644
index d74c936..0000000
--- a/tests/auto/qmediaserviceprovider/qmediaserviceprovider.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediaserviceprovider
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qmediaserviceprovider.cpp
-
diff --git a/tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp b/tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp
deleted file mode 100644
index c70401f..0000000
--- a/tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp
+++ /dev/null
@@ -1,499 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include <QDebug>
-#include <QStringList>
-
-#include <qmediaserviceprovider.h>
-#include <qmediaserviceproviderplugin.h>
-#include <private/qmediapluginloader_p.h>
-#include <qmediaobject.h>
-#include <qmediaservice.h>
-#include <qmediaplayer.h>
-#include <qaudiocapturesource.h>
-
-QT_USE_NAMESPACE
-class MockMediaService : public QMediaService
-{
- Q_OBJECT
-public:
- MockMediaService(const QString& name, QObject *parent = 0) : QMediaService(parent)
- { setObjectName(name); }
- ~MockMediaService() {}
-
- QMediaControl* requestControl(const char *) {return 0;}
- void releaseControl(QMediaControl *) {}
-};
-
-class MockServicePlugin1 : public QMediaServiceProviderPlugin,
- public QMediaServiceSupportedFormatsInterface,
- public QMediaServiceSupportedDevicesInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedFormatsInterface)
- Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
-public:
- QStringList keys() const
- {
- return QStringList() <<
- QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER);
- }
-
- QMediaService* create(QString const& key)
- {
- if (keys().contains(key))
- return new MockMediaService("MockServicePlugin1");
- else
- return 0;
- }
-
- void release(QMediaService *service)
- {
- delete service;
- }
-
- QtMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const
- {
- if (codecs.contains(QLatin1String("mpeg4")))
- return QtMultimedia::NotSupported;
-
- if (mimeType == "audio/ogg") {
- return QtMultimedia::ProbablySupported;
- }
-
- return QtMultimedia::MaybeSupported;
- }
-
- QStringList supportedMimeTypes() const
- {
- return QStringList("audio/ogg");
- }
-
- QList<QByteArray> devices(const QByteArray &service) const
- {
- QList<QByteArray> res;
- return res;
- }
-
- QString deviceDescription(const QByteArray &service, const QByteArray &device)
- {
- if (devices(service).contains(device))
- return QString(device)+" description";
- else
- return QString();
- }
-};
-
-class MockServicePlugin2 : public QMediaServiceProviderPlugin,
- public QMediaServiceSupportedFormatsInterface,
- public QMediaServiceFeaturesInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedFormatsInterface)
- Q_INTERFACES(QMediaServiceFeaturesInterface)
-public:
- QStringList keys() const
- {
- return QStringList() << QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER)
- << QLatin1String(Q_MEDIASERVICE_RADIO);
- }
-
- QMediaService* create(QString const& key)
- {
- if (keys().contains(key))
- return new MockMediaService("MockServicePlugin2");
- else
- return 0;
- }
-
- void release(QMediaService *service)
- {
- delete service;
- }
-
- QtMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const
- {
- Q_UNUSED(codecs);
-
- if (mimeType == "audio/wav")
- return QtMultimedia::PreferredService;
-
- return QtMultimedia::NotSupported;
- }
-
- QStringList supportedMimeTypes() const
- {
- return QStringList("audio/wav");
- }
-
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const
- {
- if (service == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER))
- return QMediaServiceProviderHint::LowLatencyPlayback;
- else
- return 0;
- }
-};
-
-
-class MockServicePlugin3 : public QMediaServiceProviderPlugin,
- public QMediaServiceSupportedDevicesInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
-public:
- QStringList keys() const
- {
- return QStringList() <<
- QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER) <<
- QLatin1String(Q_MEDIASERVICE_AUDIOSOURCE);
- }
-
- QMediaService* create(QString const& key)
- {
- if (keys().contains(key))
- return new MockMediaService("MockServicePlugin3");
- else
- return 0;
- }
-
- void release(QMediaService *service)
- {
- delete service;
- }
-
- QList<QByteArray> devices(const QByteArray &service) const
- {
- QList<QByteArray> res;
- if (service == QByteArray(Q_MEDIASERVICE_AUDIOSOURCE))
- res << "audiosource1" << "audiosource2";
-
- return res;
- }
-
- QString deviceDescription(const QByteArray &service, const QByteArray &device)
- {
- if (devices(service).contains(device))
- return QString(device)+" description";
- else
- return QString();
- }
-};
-
-class MockServicePlugin4 : public QMediaServiceProviderPlugin,
- public QMediaServiceSupportedFormatsInterface,
- public QMediaServiceFeaturesInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedFormatsInterface)
- Q_INTERFACES(QMediaServiceFeaturesInterface)
-public:
- QStringList keys() const
- {
- return QStringList() << QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER);
- }
-
- QMediaService* create(QString const& key)
- {
- if (keys().contains(key))
- return new MockMediaService("MockServicePlugin4");
- else
- return 0;
- }
-
- void release(QMediaService *service)
- {
- delete service;
- }
-
- QtMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const
- {
- if (codecs.contains(QLatin1String("jpeg2000")))
- return QtMultimedia::NotSupported;
-
- if (supportedMimeTypes().contains(mimeType))
- return QtMultimedia::ProbablySupported;
-
- return QtMultimedia::MaybeSupported;
- }
-
- QStringList supportedMimeTypes() const
- {
- return QStringList() << "video/mp4" << "video/quicktime";
- }
-
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const
- {
- if (service == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER))
- return QMediaServiceProviderHint::StreamPlayback;
- else
- return 0;
- }
-};
-
-
-
-class MockMediaServiceProvider : public QMediaServiceProvider
-{
- QMediaService* requestService(const QByteArray &type, const QMediaServiceProviderHint &)
- {
- Q_UNUSED(type);
- return 0;
- }
-
- void releaseService(QMediaService *service)
- {
- Q_UNUSED(service);
- }
-};
-
-
-class tst_QMediaServiceProvider : public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
-
-private slots:
- void testDefaultProviderAvailable();
- void testObtainService();
- void testHasSupport();
- void testSupportedMimeTypes();
- void testProviderHints();
-
-private:
- QObjectList plugins;
-};
-
-void tst_QMediaServiceProvider::initTestCase()
-{
- plugins << new MockServicePlugin1;
- plugins << new MockServicePlugin2;
- plugins << new MockServicePlugin3;
- plugins << new MockServicePlugin4;
-
- QMediaPluginLoader::setStaticPlugins(QLatin1String("mediaservice"), plugins);
-}
-
-void tst_QMediaServiceProvider::testDefaultProviderAvailable()
-{
- // Must always be a default provider available
- QVERIFY(QMediaServiceProvider::defaultServiceProvider() != 0);
-}
-
-void tst_QMediaServiceProvider::testObtainService()
-{
- QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider();
-
- if (provider == 0)
- QSKIP("No default provider", SkipSingle);
-
- QMediaService *service = 0;
-
- // Player
- service = provider->requestService(Q_MEDIASERVICE_MEDIAPLAYER);
- QVERIFY(service != 0);
- provider->releaseService(service);
-}
-
-void tst_QMediaServiceProvider::testHasSupport()
-{
- MockMediaServiceProvider mockProvider;
- QCOMPARE(mockProvider.hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER), "video/ogv", QStringList()),
- QtMultimedia::MaybeSupported);
-
- QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider();
-
- if (provider == 0)
- QSKIP("No default provider", SkipSingle);
-
- QCOMPARE(provider->hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER), "video/ogv", QStringList()),
- QtMultimedia::MaybeSupported);
-
- QCOMPARE(provider->hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER), "audio/ogg", QStringList()),
- QtMultimedia::ProbablySupported);
-
- //while the service returns PreferredService, provider should return ProbablySupported
- QCOMPARE(provider->hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER), "audio/wav", QStringList()),
- QtMultimedia::ProbablySupported);
-
- //even while all the plugins with "hasSupport" returned NotSupported,
- //MockServicePlugin3 has no "hasSupport" interface, so MaybeSupported
- QCOMPARE(provider->hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER), "video/avi",
- QStringList() << "mpeg4"),
- QtMultimedia::MaybeSupported);
-
- QCOMPARE(provider->hasSupport(QByteArray("non existing service"), "video/ogv", QStringList()),
- QtMultimedia::NotSupported);
-
- QCOMPARE(QMediaPlayer::hasSupport("video/ogv"), QtMultimedia::MaybeSupported);
- QCOMPARE(QMediaPlayer::hasSupport("audio/ogg"), QtMultimedia::ProbablySupported);
- QCOMPARE(QMediaPlayer::hasSupport("audio/wav"), QtMultimedia::ProbablySupported);
-
- //test low latency flag support
- QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList(), QMediaPlayer::LowLatency),
- QtMultimedia::ProbablySupported);
- //plugin1 probably supports audio/ogg, it checked because it doesn't provide features iface
- QCOMPARE(QMediaPlayer::hasSupport("audio/ogg", QStringList(), QMediaPlayer::LowLatency),
- QtMultimedia::ProbablySupported);
- //Plugin4 is not checked here, sine it's known not support low latency
- QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList(), QMediaPlayer::LowLatency),
- QtMultimedia::MaybeSupported);
-
- //test streaming flag support
- QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList(), QMediaPlayer::StreamPlayback),
- QtMultimedia::ProbablySupported);
- //Plugin2 is not checked here, sine it's known not support streaming
- QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList(), QMediaPlayer::StreamPlayback),
- QtMultimedia::MaybeSupported);
-
- //ensure the correct media player plugin is chosen for mime type
- QMediaPlayer simplePlayer(0, QMediaPlayer::LowLatency);
- QCOMPARE(simplePlayer.service()->objectName(), QLatin1String("MockServicePlugin2"));
-
- QMediaPlayer mediaPlayer;
- QVERIFY(mediaPlayer.service()->objectName() != QLatin1String("MockServicePlugin2"));
-
- QMediaPlayer streamPlayer(0, QMediaPlayer::StreamPlayback);
- QCOMPARE(streamPlayer.service()->objectName(), QLatin1String("MockServicePlugin4"));
-}
-
-void tst_QMediaServiceProvider::testSupportedMimeTypes()
-{
- QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider();
-
- if (provider == 0)
- QSKIP("No default provider", SkipSingle);
-
- QVERIFY(provider->supportedMimeTypes(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER)).contains("audio/ogg"));
- QVERIFY(!provider->supportedMimeTypes(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER)).contains("audio/mp3"));
-}
-
-void tst_QMediaServiceProvider::testProviderHints()
-{
- {
- QMediaServiceProviderHint hint;
- QVERIFY(hint.isNull());
- QCOMPARE(hint.type(), QMediaServiceProviderHint::Null);
- QVERIFY(hint.device().isEmpty());
- QVERIFY(hint.mimeType().isEmpty());
- QVERIFY(hint.codecs().isEmpty());
- QCOMPARE(hint.features(), 0);
- }
-
- {
- QByteArray deviceName(QByteArray("testDevice"));
- QMediaServiceProviderHint hint(deviceName);
- QVERIFY(!hint.isNull());
- QCOMPARE(hint.type(), QMediaServiceProviderHint::Device);
- QCOMPARE(hint.device(), deviceName);
- QVERIFY(hint.mimeType().isEmpty());
- QVERIFY(hint.codecs().isEmpty());
- QCOMPARE(hint.features(), 0);
- }
-
- {
- QMediaServiceProviderHint hint(QMediaServiceProviderHint::LowLatencyPlayback);
- QVERIFY(!hint.isNull());
- QCOMPARE(hint.type(), QMediaServiceProviderHint::SupportedFeatures);
- QVERIFY(hint.device().isEmpty());
- QVERIFY(hint.mimeType().isEmpty());
- QVERIFY(hint.codecs().isEmpty());
- QCOMPARE(hint.features(), QMediaServiceProviderHint::LowLatencyPlayback);
- }
-
- {
- QMediaServiceProviderHint hint(QMediaServiceProviderHint::RecordingSupport);
- QVERIFY(!hint.isNull());
- QCOMPARE(hint.type(), QMediaServiceProviderHint::SupportedFeatures);
- QVERIFY(hint.device().isEmpty());
- QVERIFY(hint.mimeType().isEmpty());
- QVERIFY(hint.codecs().isEmpty());
- QCOMPARE(hint.features(), QMediaServiceProviderHint::RecordingSupport);
- }
-
- {
- QString mimeType(QLatin1String("video/ogg"));
- QStringList codecs;
- codecs << "theora" << "vorbis";
-
- QMediaServiceProviderHint hint(mimeType,codecs);
- QVERIFY(!hint.isNull());
- QCOMPARE(hint.type(), QMediaServiceProviderHint::ContentType);
- QVERIFY(hint.device().isEmpty());
- QCOMPARE(hint.mimeType(), mimeType);
- QCOMPARE(hint.codecs(), codecs);
-
- QMediaServiceProviderHint hint2(hint);
-
- QVERIFY(!hint2.isNull());
- QCOMPARE(hint2.type(), QMediaServiceProviderHint::ContentType);
- QVERIFY(hint2.device().isEmpty());
- QCOMPARE(hint2.mimeType(), mimeType);
- QCOMPARE(hint2.codecs(), codecs);
-
- QMediaServiceProviderHint hint3;
- QVERIFY(hint3.isNull());
- hint3 = hint;
- QVERIFY(!hint3.isNull());
- QCOMPARE(hint3.type(), QMediaServiceProviderHint::ContentType);
- QVERIFY(hint3.device().isEmpty());
- QCOMPARE(hint3.mimeType(), mimeType);
- QCOMPARE(hint3.codecs(), codecs);
-
- QCOMPARE(hint, hint2);
- QCOMPARE(hint3, hint2);
-
- QMediaServiceProviderHint hint4(mimeType,codecs);
- QCOMPARE(hint, hint4);
-
- QMediaServiceProviderHint hint5(mimeType,QStringList());
- QVERIFY(hint != hint5);
- }
-}
-
-QTEST_MAIN(tst_QMediaServiceProvider)
-
-#include "tst_qmediaserviceprovider.moc"
diff --git a/tests/auto/qmediastreamscontrol/qmediastreamscontrol.pro b/tests/auto/qmediastreamscontrol/qmediastreamscontrol.pro
deleted file mode 100644
index d271671..0000000
--- a/tests/auto/qmediastreamscontrol/qmediastreamscontrol.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediastreamscontrol
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += \
- tst_qmediastreamscontrol.cpp
-
-include(../multimedia_common.pri)
diff --git a/tests/auto/qmediastreamscontrol/tst_qmediastreamscontrol.cpp b/tests/auto/qmediastreamscontrol/tst_qmediastreamscontrol.cpp
deleted file mode 100644
index d728691..0000000
--- a/tests/auto/qmediastreamscontrol/tst_qmediastreamscontrol.cpp
+++ /dev/null
@@ -1,408 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtCore/QString>
-#include <QtTest/QtTest>
-#include <QtCore/QCoreApplication>
-
-
-#include <qmediaplayercontrol.h>
-#include <qmediaservice.h>
-
-#include <qmediastreamscontrol.h>
-
-#include <QtGui/QImage>
-#include <QtCore/QPointer>
-
-QT_USE_NAMESPACE
-
-
-#define WAIT_FOR_CONDITION(a,e) \
- for (int _i = 0; _i < 500; _i += 1) { \
- if ((a) == (e)) break; \
- QTest::qWait(10);}
-
-class tst_qmediastreamscontrol : public QObject
-{
- Q_OBJECT
-
-public:
- tst_qmediastreamscontrol();
-
-private Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
- void control_iid();
- void control();
- void isActive();
- void streamCount();
- void streamsChanged();
- void metadata();
-};
-
-
-
-class mediaStatusList : public QObject, public QList<QMediaStreamsControl::StreamType>
-{
- Q_OBJECT
-public slots:
- void mediaStatus(QMediaStreamsControl::StreamType status) {
- append(status);
- }
-
-public:
- mediaStatusList(QObject *obj, const char *aSignal)
- : QObject()
- {
- QObject::connect(obj, aSignal, this, SLOT(mediaStatus(QMediaStreamsControl::StreamType)));
- }
-};
-
-class QtTestMediaStreamsControl: public QMediaStreamsControl
-{
-public:
- QtTestMediaStreamsControl(QObject *parent = 0)
- : QMediaStreamsControl(parent)
- {
- }
-
- int streamCount()
- {
- QList <StreamType> m_stype;
-
- return streams.count();
- }
- void setStreamCount(int count)
- {
- streams.resize(count);
- }
-
- StreamType streamType(int index)
- {
- return streams.at(index).type;
- }
- void setStreamType(int index, StreamType type)
- {
- streams[index].type = type;
- }
-
- QVariant metaData(int index, QtMultimedia::MetaData key)
- {
- QtMultimedia::MetaData keys = key;
- return keys;
- }
-
- void setMetaData(int index, QtMultimedia::MetaData key, const QVariant &value)
- {
- streams[index].metaData.insert(key, value);
- }
-
- bool isActive(int index)
- {
- return streams.at(index).active;
- }
- void setActive(int index, bool state)
- {
- streams[index].active = state;
- }
-
- void setAudioOnlyContent()
- {
- mediaContent = audioOnlyContent;
-
- m_player->setMedia(*mediaContent);
- }
-
- void setVideoOnlyContent()
- {
- mediaContent = videoOnlyContent;
- duration = 60000;
-
- m_player->setMedia(*mediaContent);
- }
-
- void setAudioVideoContent()
- {
- if (mediaContent == audioVideoContent)
- {
- mediaContent = audioVideoAltContent;
- duration = 101840;
- }
- else
- {
- mediaContent = audioVideoContent;
- duration = 141000;
- }
-
- m_player->setMedia(*mediaContent);
- }
-
- void setStreamingContent()
- {
- mediaContent = streamingContent;
-
- m_player->setMedia(*mediaContent);
- }
-
-
-
-public:
- struct Stream
- {
- Stream() : type(UnknownStream), active(false) {}
- StreamType type;
- QMap<QtMultimedia::MetaData, QVariant> metaData;
- bool active;
- };
-
- QVector<Stream> streams;
- QMediaContent* audioOnlyContent;
- QMediaContent* videoOnlyContent;
- QMediaContent* audioVideoContent;
- QMediaContent* audioVideoAltContent;
- QMediaContent* mediaContent;
- QMediaContent* streamingContent;
-
- qint64 duration;
- QMediaPlayer *m_player;
- QVideoWidget *m_widget;
- QWidget *m_windowWidget;
-
-
-};
-
-class QTestMediaStreamsControlA : public QMediaControl
-{
- Q_OBJECT
-};
-
-#define QTestMediaStreamsControlA_iid "com.nokia.QTestMediaStreamsControlA"
-Q_MEDIA_DECLARE_CONTROL(QTestMediaStreamsControlA, QTestMediaStreamsControlA_iid)
-
-class QTestMediaStreamsControlB : public QMediaControl
-{
- Q_OBJECT
-public:
- QTestMediaStreamsControlB()
- : QMediaControl(0)
- ,ctrlA(0)
- ,ctrlB(0)
- ,ctrlC(0) {}
-
- bool isActive(int stream)
- {
- return 1;
- }
-
- int ctrlA;
- int ctrlB;
- int ctrlC;
-};
-
-#define QTestMediaStreamsControlB_iid "com.nokia.QTestMediaStreamsControlB"
-Q_MEDIA_DECLARE_CONTROL(QTestMediaStreamsControlB, QTestMediaStreamsControlB_iid)
-
-
-class QTestMediaStreamsControlC : public QMediaControl
-{
- Q_OBJECT
-};
-
-#define QTestMediaStreamsControlC_iid "com.nokia.QTestMediaStreamsControlC"
-Q_MEDIA_DECLARE_CONTROL(QTestMediaStreamsControlC, QTestMediaStreamsControlC_iid) // Yes A.
-
-class QTestMediaStreamsControlD : public QMediaControl
-{
- Q_OBJECT
-};
-
-#define QTestMediaStreamsControlD_iid "com.nokia.QTestMediaStreamsControlD"
-Q_MEDIA_DECLARE_CONTROL(QTestMediaStreamsControlD, QTestMediaStreamsControlD_iid)
-
-
-class QtTestMediaService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestMediaService()
- : QMediaService(0)
- , refA(0)
- , refB(0)
- , refC(0)
- {
- }
-
- QMediaControl *requestControl(const char *name)
- {
- if (strcmp(name, QTestMediaStreamsControlA_iid) == 0) {
- refA += 1;
-
- return &controlA;
- } else if (strcmp(name, QTestMediaStreamsControlB_iid) == 0) {
- refB += 1;
-
- return &controlB;
- } else if (strcmp(name, QTestMediaStreamsControlC_iid) == 0) {
- refA += 1;
-
- return &controlA;
- } else {
- return 0;
- }
- }
-
- void releaseControl(QMediaControl *control)
- {
- if (control == &controlA)
- refA -= 1;
- else if (control == &controlB)
- refB -= 1;
- else if (control == &controlC)
- refC -= 1;
- }
-
- using QMediaService::requestControl;
-
- int refA;
- int refB;
- int refC;
- QTestMediaStreamsControlA controlA;
- QTestMediaStreamsControlB controlB;
- QTestMediaStreamsControlC controlC;
-};
-
-
-tst_qmediastreamscontrol::tst_qmediastreamscontrol()
-{
-}
-
-void tst_qmediastreamscontrol::initTestCase()
-{
-}
-
-void tst_qmediastreamscontrol::cleanupTestCase()
-{
-}
-
-void tst_qmediastreamscontrol::control_iid()
-{
-
- // Default implementation.
- QCOMPARE(qmediacontrol_iid<QTestMediaStreamsControlA *>(), QTestMediaStreamsControlA_iid);
-
- // Partial template.
- QVERIFY(qstrcmp(qmediacontrol_iid<QTestMediaStreamsControlA *>(), QTestMediaStreamsControlA_iid) == 0);
-}
-
-void tst_qmediastreamscontrol::control()
-{
- QtTestMediaService *service = new QtTestMediaService();
- QMediaStreamsControl *control = qobject_cast<QMediaStreamsControl *>
- (service->requestControl("com.nokia.Qt.MediaStreamsControl/1.0"));
- // QCOMPARE(control,service->controlA.objectName());
- QTestMediaStreamsControlA *controlA = (QTestMediaStreamsControlA *)service->requestControl("controlA");
- // QCOMPARE(controlA,service->controlA);
- QVERIFY(service->requestControl<QTestMediaStreamsControlA *>());
-
- service->releaseControl(controlA);
- delete service;
-}
-
-void tst_qmediastreamscontrol::isActive()
-{
- QTestMediaStreamsControlB ser;
- QVERIFY(ser.isActive(1));
- QtTestMediaStreamsControl m_active;
- //setActive
- m_active.setActive(1,1);
- QVERIFY(m_active.isActive(1));
- //set InActive
- m_active.setActive(2,0);
- QVERIFY(!m_active.isActive(0));
-}
-
-//Returns the number of media streams.
-void tst_qmediastreamscontrol::streamCount()
-{
- QtTestMediaStreamsControl m_cnt;
- m_cnt.setStreamType(0,QMediaStreamsControl::UnknownStream);
- m_cnt.setStreamType(1,QMediaStreamsControl::VideoStream);
- m_cnt.setStreamType(2,QMediaStreamsControl::AudioStream);
- m_cnt.setStreamType(3,QMediaStreamsControl::SubPictureStream);
- m_cnt.setStreamType(4,QMediaStreamsControl::DataStream);
- m_cnt.setStreamCount(5);
- QVERIFY(m_cnt.streamCount() == m_cnt.streams.count());
-}
-
-//The signal is emitted when the available streams list is changed.
-void tst_qmediastreamscontrol::streamsChanged()
-{
- QMediaPlayer *m_player = new QMediaPlayer(0);
- QMediaStreamsControl* m_streamControl = (QMediaStreamsControl*)
- (m_player->service()->requestControl(QTestMediaStreamsControlA_iid));
-
- QMediaContent videoOnlyContent;
-
- m_player->setMedia(videoOnlyContent);
- if (m_streamControl) {
- QSignalSpy m_strm_lst_chgSpy(m_streamControl,SIGNAL(streamsChanged()));
- QVERIFY(m_strm_lst_chgSpy.isValid());
- QVERIFY(m_strm_lst_chgSpy.isEmpty());
- WAIT_FOR_CONDITION(m_player->mediaStatus(),QMediaPlayer::LoadedMedia);
- QVERIFY(m_streamControl->streamCount() == 1);
- QVERIFY(m_strm_lst_chgSpy.count() == 1);
- }
-
- delete m_player;
- m_player = NULL;
-}
-
-void tst_qmediastreamscontrol::metadata()
-{
- QtTestMediaStreamsControl m_metadata;
- m_metadata.metaData(1,QtMultimedia::AlbumArtist);
- qDebug() << m_metadata.metaData(1,QtMultimedia::AlbumArtist);
-}
-QTEST_MAIN(tst_qmediastreamscontrol);
-
-#include "tst_qmediastreamscontrol.moc"
diff --git a/tests/auto/qmediatimerange/qmediatimerange.pro b/tests/auto/qmediatimerange/qmediatimerange.pro
deleted file mode 100644
index 0b66260..0000000
--- a/tests/auto/qmediatimerange/qmediatimerange.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediatimerange
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qmediatimerange.cpp
-
diff --git a/tests/auto/qmediatimerange/tst_qmediatimerange.cpp b/tests/auto/qmediatimerange/tst_qmediatimerange.cpp
deleted file mode 100644
index dd8dc5f..0000000
--- a/tests/auto/qmediatimerange/tst_qmediatimerange.cpp
+++ /dev/null
@@ -1,806 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include <QtCore/qdebug.h>
-
-#include <qmediatimerange.h>
-#include <qmediatimerange.h>
-
-QT_USE_NAMESPACE
-
-class tst_QMediaTimeRange: public QObject
-{
- Q_OBJECT
-
-public slots:
-
-private slots:
- void testCtor();
- void testIntervalCtor();
- void testGetters();
- void testAssignment();
- void testIntervalNormalize();
- void testIntervalTranslate();
- void testIntervalContains();
- void testEarliestLatest();
- void testContains();
- void testAddInterval();
- void testAddTimeRange();
- void testRemoveInterval();
- void testRemoveTimeRange();
- void testClear();
- void testComparisons();
- void testArithmetic();
-};
-
-void tst_QMediaTimeRange::testIntervalCtor()
-{
- //Default Ctor for Time Interval
- /* create an instance for the time interval and verify the default cases */
- QMediaTimeInterval tInter;
- QVERIFY(tInter.isNormal());
- QVERIFY(tInter.start() == 0);
- QVERIFY(tInter.end() == 0);
-
- // (qint, qint) Ctor time interval
- /* create an instace of QMediaTimeInterval passing start and end times and verify the all possible scenario's*/
- QMediaTimeInterval time(20,50);
- QVERIFY(time.isNormal());
- QVERIFY(time.start() == 20);
- QVERIFY(time.end() == 50);
-
- // Copy Ctor Time interval
- QMediaTimeInterval other(time);
- QVERIFY(other.isNormal() == time.isNormal());
- QVERIFY(other.start() == time.start());
- QVERIFY(other.end() == time.end());
- QVERIFY(other.contains(20) == time.contains(20));
- QVERIFY(other == time);
-}
-
-void tst_QMediaTimeRange::testIntervalContains()
-{
- QMediaTimeInterval time(20,50);
-
- /* start() <= time <= end(). Returns true if the time interval contains the specified time. */
- QVERIFY(!time.contains(10));
- QVERIFY(time.contains(20));
- QVERIFY(time.contains(30));
- QVERIFY(time.contains(50));
- QVERIFY(!time.contains(60));
-
- QMediaTimeInterval x(20, 10); // denormal
-
- // Check denormal ranges
- QVERIFY(!x.contains(5));
- QVERIFY(x.contains(10));
- QVERIFY(x.contains(15));
- QVERIFY(x.contains(20));
- QVERIFY(!x.contains(25));
-
- QMediaTimeInterval y = x.normalized();
- QVERIFY(!y.contains(5));
- QVERIFY(y.contains(10));
- QVERIFY(y.contains(15));
- QVERIFY(y.contains(20));
- QVERIFY(!y.contains(25));
-}
-
-void tst_QMediaTimeRange::testCtor()
-{
- // Default Ctor
- QMediaTimeRange a;
- QVERIFY(a.isEmpty());
-
- // (qint, qint) Ctor
- QMediaTimeRange b(10, 20);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 20);
-
- // Interval Ctor
- QMediaTimeRange c(QMediaTimeInterval(30, 40));
-
- QVERIFY(!c.isEmpty());
- QVERIFY(c.isContinuous());
- QVERIFY(c.earliestTime() == 30);
- QVERIFY(c.latestTime() == 40);
-
- // Abnormal Interval Ctor
- QMediaTimeRange d(QMediaTimeInterval(20, 10));
-
- QVERIFY(d.isEmpty());
-
- // Copy Ctor
- QMediaTimeRange e(b);
-
- QVERIFY(!e.isEmpty());
- QVERIFY(e.isContinuous());
- QVERIFY(e.earliestTime() == 10);
- QVERIFY(e.latestTime() == 20);
-
- QVERIFY(e == b);
-}
-
-void tst_QMediaTimeRange::testGetters()
-{
- QMediaTimeRange x;
-
- // isEmpty
- QVERIFY(x.isEmpty());
-
- x.addInterval(10, 20);
-
- // isEmpty + isContinuous
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
-
- x.addInterval(30, 40);
-
- // isEmpty + isContinuous + intervals + start + end
- QVERIFY(!x.isEmpty());
- QVERIFY(!x.isContinuous());
- QVERIFY(x.intervals().count() == 2);
- QVERIFY(x.intervals()[0].start() == 10);
- QVERIFY(x.intervals()[0].end() == 20);
- QVERIFY(x.intervals()[1].start() == 30);
- QVERIFY(x.intervals()[1].end() == 40);
-}
-
-void tst_QMediaTimeRange::testAssignment()
-{
- QMediaTimeRange x;
-
- // Range Assignment
- x = QMediaTimeRange(10, 20);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 20);
-
- // Interval Assignment
- x = QMediaTimeInterval(30, 40);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 30);
- QVERIFY(x.latestTime() == 40);
-
- // Shared Data Check
- QMediaTimeRange y;
-
- y = x;
- y.addInterval(10, 20);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 30);
- QVERIFY(x.latestTime() == 40);
-}
-
-void tst_QMediaTimeRange::testIntervalNormalize()
-{
- QMediaTimeInterval x(20, 10);
-
- QVERIFY(!x.isNormal());
- QVERIFY(x.start() == 20);
- QVERIFY(x.end() == 10);
-
- QMediaTimeInterval y = x.normalized();
-
- QVERIFY(y.isNormal());
- QVERIFY(y.start() == 10);
- QVERIFY(y.end() == 20);
- QVERIFY(x != y);
-}
-
-void tst_QMediaTimeRange::testIntervalTranslate()
-{
- QMediaTimeInterval x(10, 20);
- x = x.translated(10);
-
- QVERIFY(x.start() == 20);
- QVERIFY(x.end() == 30);
-
- /* verifying the backward through time with a negative offset.*/
- x = x.translated(-10);
-
- QVERIFY(x.start() == 10);
- QVERIFY(x.end() == 20);
-}
-
-void tst_QMediaTimeRange::testEarliestLatest()
-{
- // Test over a single interval
- QMediaTimeRange x(30, 40);
-
- QVERIFY(x.earliestTime() == 30);
- QVERIFY(x.latestTime() == 40);
-
- // Test over multiple intervals
- x.addInterval(50, 60);
-
- QVERIFY(x.earliestTime() == 30);
- QVERIFY(x.latestTime() == 60);
-}
-
-void tst_QMediaTimeRange::testContains()
-{
- // Test over a single interval
- QMediaTimeRange x(10, 20);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.contains(15));
- QVERIFY(x.contains(10));
- QVERIFY(x.contains(20));
- QVERIFY(!x.contains(25));
-
- // Test over multiple intervals
- x.addInterval(40, 50);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(!x.isContinuous());
- QVERIFY(x.contains(15));
- QVERIFY(x.contains(45));
- QVERIFY(!x.contains(30));
-
- // Test over a concrete interval
- QMediaTimeInterval y(10, 20);
- QVERIFY(y.contains(15));
- QVERIFY(y.contains(10));
- QVERIFY(y.contains(20));
- QVERIFY(!y.contains(25));
-}
-
-void tst_QMediaTimeRange::testAddInterval()
-{
- // All intervals Overlap
- QMediaTimeRange x;
- x.addInterval(10, 40);
- x.addInterval(30, 50);
- x.addInterval(20, 60);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 60);
-
- // 1 adjacent interval, 1 encompassed interval
- x = QMediaTimeRange();
- x.addInterval(10, 40);
- x.addInterval(20, 30);
- x.addInterval(41, 50);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 50);
-
- // 1 overlapping interval, 1 disjoint interval
- x = QMediaTimeRange();
- x.addInterval(10, 30);
- x.addInterval(20, 40);
- x.addInterval(50, 60);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(!x.isContinuous());
- QVERIFY(x.intervals().count() == 2);
- QVERIFY(x.intervals()[0].start() == 10);
- QVERIFY(x.intervals()[0].end() == 40);
- QVERIFY(x.intervals()[1].start() == 50);
- QVERIFY(x.intervals()[1].end() == 60);
-
- // Identical Add
- x = QMediaTimeRange();
- x.addInterval(10, 20);
- x.addInterval(10, 20);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 20);
-
- // Multi-Merge
- x = QMediaTimeRange();
- x.addInterval(10, 20);
- x.addInterval(30, 40);
- x.addInterval(50, 60);
- x.addInterval(15, 55);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 60);
-
- // Interval Parameter - All intervals Overlap
- x = QMediaTimeRange();
- x.addInterval(QMediaTimeInterval(10, 40));
- x.addInterval(QMediaTimeInterval(30, 50));
- x.addInterval(QMediaTimeInterval(20, 60));
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 60);
-
- // Interval Parameter - Abnormal Interval
- x = QMediaTimeRange();
- x.addInterval(QMediaTimeInterval(20, 10));
-
- QVERIFY(x.isEmpty());
-}
-
-void tst_QMediaTimeRange::testAddTimeRange()
-{
- // Add Time Range uses Add Interval internally,
- // so in this test the focus is on combinations of number
- // of intervals added, rather than the different types of
- // merges which can occur.
- QMediaTimeRange a, b;
-
- // Add Single into Single
- a = QMediaTimeRange(10, 30);
- b = QMediaTimeRange(20, 40);
-
- b.addTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 40);
-
- // Add Multiple into Single
- a = QMediaTimeRange();
- a.addInterval(10, 30);
- a.addInterval(40, 60);
-
- b = QMediaTimeRange(20, 50);
-
- b.addTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 60);
-
- // Add Single into Multiple
- a = QMediaTimeRange(20, 50);
-
- b = QMediaTimeRange();
- b.addInterval(10, 30);
- b.addInterval(40, 60);
-
- b.addTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 60);
-
- // Add Multiple into Multiple
- a = QMediaTimeRange();
- a.addInterval(10, 30);
- a.addInterval(40, 70);
- a.addInterval(80, 100);
-
- b = QMediaTimeRange();
- b.addInterval(20, 50);
- b.addInterval(60, 90);
-
- b.addTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 100);
-
- // Add Nothing to Single
- a = QMediaTimeRange();
- b = QMediaTimeRange(10, 20);
-
- b.addTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 20);
-
- // Add Single to Nothing
- a = QMediaTimeRange(10, 20);
- b = QMediaTimeRange();
-
- b.addTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 20);
-
- // Add Nothing to Nothing
- a = QMediaTimeRange();
- b = QMediaTimeRange();
-
- b.addTimeRange(a);
-
- QVERIFY(b.isEmpty());
-}
-
-void tst_QMediaTimeRange::testRemoveInterval()
-{
- // Removing an interval, causing a split
- QMediaTimeRange x;
- x.addInterval(10, 50);
- x.removeInterval(20, 40);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(!x.isContinuous());
- QVERIFY(x.intervals().count() == 2);
- QVERIFY(x.intervals()[0].start() == 10);
- QVERIFY(x.intervals()[0].end() == 19);
- QVERIFY(x.intervals()[1].start() == 41);
- QVERIFY(x.intervals()[1].end() == 50);
-
- // Removing an interval, causing a deletion
- x = QMediaTimeRange();
- x.addInterval(20, 30);
- x.removeInterval(10, 40);
-
- QVERIFY(x.isEmpty());
-
- // Removing an interval, causing a tail trim
- x = QMediaTimeRange();
- x.addInterval(20, 40);
- x.removeInterval(30, 50);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 20);
- QVERIFY(x.latestTime() == 29);
-
- // Removing an interval, causing a head trim
- x = QMediaTimeRange();
- x.addInterval(20, 40);
- x.removeInterval(10, 30);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 31);
- QVERIFY(x.latestTime() == 40);
-
- // Identical Remove
- x = QMediaTimeRange();
- x.addInterval(10, 20);
- x.removeInterval(10, 20);
-
- QVERIFY(x.isEmpty());
-
- // Multi-Trim
- x = QMediaTimeRange();
- x.addInterval(10, 20);
- x.addInterval(30, 40);
- x.removeInterval(15, 35);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(!x.isContinuous());
- QVERIFY(x.intervals().count() == 2);
- QVERIFY(x.intervals()[0].start() == 10);
- QVERIFY(x.intervals()[0].end() == 14);
- QVERIFY(x.intervals()[1].start() == 36);
- QVERIFY(x.intervals()[1].end() == 40);
-
- // Multi-Delete
- x = QMediaTimeRange();
- x.addInterval(10, 20);
- x.addInterval(30, 40);
- x.addInterval(50, 60);
- x.removeInterval(10, 60);
-
- QVERIFY(x.isEmpty());
-
- // Interval Parameter - Removing an interval, causing a split
- x = QMediaTimeRange();
- x.addInterval(10, 50);
- x.removeInterval(QMediaTimeInterval(20, 40));
-
- QVERIFY(!x.isEmpty());
- QVERIFY(!x.isContinuous());
- QVERIFY(x.intervals().count() == 2);
- QVERIFY(x.intervals()[0].start() == 10);
- QVERIFY(x.intervals()[0].end() == 19);
- QVERIFY(x.intervals()[1].start() == 41);
- QVERIFY(x.intervals()[1].end() == 50);
-
- // Interval Parameter - Abnormal Interval
- x = QMediaTimeRange();
- x.addInterval(10, 40);
- x.removeInterval(QMediaTimeInterval(30, 20));
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 40);
-}
-
-void tst_QMediaTimeRange::testRemoveTimeRange()
-{
- // Remove Time Range uses Remove Interval internally,
- // so in this test the focus is on combinations of number
- // of intervals removed, rather than the different types of
- // deletions which can occur.
- QMediaTimeRange a, b;
-
- // Remove Single from Single
- a = QMediaTimeRange(10, 30);
- b = QMediaTimeRange(20, 40);
-
- b.removeTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 31);
- QVERIFY(b.latestTime() == 40);
-
- // Remove Multiple from Single
- a = QMediaTimeRange();
- a.addInterval(10, 30);
- a.addInterval(40, 60);
-
- b = QMediaTimeRange(20, 50);
-
- b.removeTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 31);
- QVERIFY(b.latestTime() == 39);
-
- // Remove Single from Multiple
- a = QMediaTimeRange(20, 50);
-
- b = QMediaTimeRange();
- b.addInterval(10, 30);
- b.addInterval(40, 60);
-
- b.removeTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(!b.isContinuous());
- QVERIFY(b.intervals().count() == 2);
- QVERIFY(b.intervals()[0].start() == 10);
- QVERIFY(b.intervals()[0].end() == 19);
- QVERIFY(b.intervals()[1].start() == 51);
- QVERIFY(b.intervals()[1].end() == 60);
-
- // Remove Multiple from Multiple
- a = QMediaTimeRange();
- a.addInterval(20, 50);
- a.addInterval(50, 90);
-
-
- b = QMediaTimeRange();
- b.addInterval(10, 30);
- b.addInterval(40, 70);
- b.addInterval(80, 100);
-
- b.removeTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(!b.isContinuous());
- QVERIFY(b.intervals().count() == 2);
- QVERIFY(b.intervals()[0].start() == 10);
- QVERIFY(b.intervals()[0].end() == 19);
- QVERIFY(b.intervals()[1].start() == 91);
- QVERIFY(b.intervals()[1].end() == 100);
-
- // Remove Nothing from Single
- a = QMediaTimeRange();
- b = QMediaTimeRange(10, 20);
-
- b.removeTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 20);
-
- // Remove Single from Nothing
- a = QMediaTimeRange(10, 20);
- b = QMediaTimeRange();
-
- b.removeTimeRange(a);
-
- QVERIFY(b.isEmpty());
-
- // Remove Nothing from Nothing
- a = QMediaTimeRange();
- b = QMediaTimeRange();
-
- b.removeTimeRange(a);
-
- QVERIFY(b.isEmpty());
-}
-
-void tst_QMediaTimeRange::testClear()
-{
- QMediaTimeRange x;
-
- // Clear Nothing
- x.clear();
-
- QVERIFY(x.isEmpty());
-
- // Clear Single
- x = QMediaTimeRange(10, 20);
- x.clear();
-
- QVERIFY(x.isEmpty());
-
- // Clear Multiple
- x = QMediaTimeRange();
- x.addInterval(10, 20);
- x.addInterval(30, 40);
- x.clear();
-
- QVERIFY(x.isEmpty());
-}
-
-void tst_QMediaTimeRange::testComparisons()
-{
- // Interval equality
- QVERIFY(QMediaTimeInterval(10, 20) == QMediaTimeInterval(10, 20));
- QVERIFY(QMediaTimeInterval(10, 20) != QMediaTimeInterval(10, 30));
- QVERIFY(!(QMediaTimeInterval(10, 20) != QMediaTimeInterval(10, 20)));
- QVERIFY(!(QMediaTimeInterval(10, 20) == QMediaTimeInterval(10, 30)));
-
- // Time range equality - Single Interval
- QMediaTimeRange a(10, 20), b(20, 30), c(10, 20);
-
- QVERIFY(a == c);
- QVERIFY(!(a == b));
- QVERIFY(a != b);
- QVERIFY(!(a != c));
-
- // Time Range Equality - Multiple Intervals
- QMediaTimeRange x, y, z;
-
- x.addInterval(10, 20);
- x.addInterval(30, 40);
- x.addInterval(50, 60);
-
- y.addInterval(10, 20);
- y.addInterval(35, 45);
- y.addInterval(50, 60);
-
- z.addInterval(10, 20);
- z.addInterval(30, 40);
- z.addInterval(50, 60);
-
- QVERIFY(x == z);
- QVERIFY(!(x == y));
- QVERIFY(x != y);
- QVERIFY(!(x != z));
-}
-
-void tst_QMediaTimeRange::testArithmetic()
-{
- QMediaTimeRange a(10, 20), b(20, 30);
-
- // Test +=
- a += b;
-
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 30);
-
- // Test -=
- a -= b;
-
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 19);
-
- // Test += and -= on intervals
- a -= QMediaTimeInterval(10, 20);
- a += QMediaTimeInterval(40, 50);
-
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 40);
- QVERIFY(a.latestTime() == 50);
-
- // Test Interval + Interval
- a = QMediaTimeInterval(10, 20) + QMediaTimeInterval(20, 30);
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 30);
-
- // Test Range + Interval
- a = a + QMediaTimeInterval(30, 40);
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 40);
-
- // Test Interval + Range
- a = QMediaTimeInterval(40, 50) + a;
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 50);
-
- // Test Range + Range
- a = a + QMediaTimeRange(50, 60);
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 60);
-
- // Test Range - Interval
- a = a - QMediaTimeInterval(50, 60);
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 49);
-
- // Test Range - Range
- a = a - QMediaTimeRange(40, 50);
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 39);
-
- // Test Interval - Range
- b = QMediaTimeInterval(0, 20) - a;
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 0);
- QVERIFY(b.latestTime() == 9);
-
- // Test Interval - Interval
- a = QMediaTimeInterval(10, 20) - QMediaTimeInterval(15, 30);
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 14);
-}
-
-QTEST_MAIN(tst_QMediaTimeRange)
-
-#include "tst_qmediatimerange.moc"
diff --git a/tests/auto/qmetadatareadercontrol/qmetadatareadercontrol.pro b/tests/auto/qmetadatareadercontrol/qmetadatareadercontrol.pro
deleted file mode 100644
index 0793a80..0000000
--- a/tests/auto/qmetadatareadercontrol/qmetadatareadercontrol.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmetadatareadercontrol
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qmetadatareadercontrol.cpp
-
-include (../qmultimedia_common/mockcontainer.pri)
-
diff --git a/tests/auto/qmetadatareadercontrol/tst_qmetadatareadercontrol.cpp b/tests/auto/qmetadatareadercontrol/tst_qmetadatareadercontrol.cpp
deleted file mode 100644
index 30df404..0000000
--- a/tests/auto/qmetadatareadercontrol/tst_qmetadatareadercontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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>
-#include <QtTest/QtTest>
-#include <QtCore/QCoreApplication>
-
-#include "mockmetadatareadercontrol.h"
-
-class tst_QMetaDataReaderControl : public QObject
-{
- Q_OBJECT
-
-private slots:
- // Test case for QMetaDataReaderControl
- void metaDataReaderControlConstructor();
- void metaDataReaderControlAvailableMetaData();
- void metaDataReaderControlExtendedMetaData();
- void metaDataReaderControlIsMetaDataAvailable();
- void metaDataReaderControlMetaData();
- void metaDataReaderControlAvailableExtendedMetaData();
- void metaDataReaderControlMetaDataAvailableChangedSignal();
- void metaDataReaderControlMetaDataChangedSignal();
-};
-
-QTEST_MAIN(tst_QMetaDataReaderControl);
-
-/* Test case for constructor. */
-void tst_QMetaDataReaderControl::metaDataReaderControlConstructor()
-{
- MockMetaDataReaderControl *metaData = new MockMetaDataReaderControl();
- QVERIFY(metaData !=NULL);
- delete metaData;
-}
-
-/* Test case for availableMetaData() */
-void tst_QMetaDataReaderControl::metaDataReaderControlAvailableMetaData()
-{
- MockMetaDataReaderControl *metaData = new MockMetaDataReaderControl();
- QVERIFY(metaData !=NULL);
- metaData->availableMetaData() ;
- delete metaData;
-}
-
-/* Test case for extendedMetaData */
-void tst_QMetaDataReaderControl::metaDataReaderControlExtendedMetaData ()
-{
- const QString titleKey(QLatin1String("Title"));
- MockMetaDataReaderControl *metaData = new MockMetaDataReaderControl();
- QVERIFY(metaData !=NULL);
- metaData->extendedMetaData(titleKey);
- delete metaData;
-}
-
-/* Test case for availableMetaData */
-void tst_QMetaDataReaderControl::metaDataReaderControlIsMetaDataAvailable ()
-{
- MockMetaDataReaderControl *metaData = new MockMetaDataReaderControl();
- QVERIFY(metaData !=NULL);
- metaData->availableMetaData();
- delete metaData;
-}
-
-/* Test case for metaData */
-void tst_QMetaDataReaderControl::metaDataReaderControlMetaData ()
-{
- MockMetaDataReaderControl *metaData = new MockMetaDataReaderControl();
- QVERIFY(metaData !=NULL);
- metaData->metaData(QtMultimedia::Title);
- delete metaData;
-}
-
-/* Test case for availableExtendedMetaData */
-void tst_QMetaDataReaderControl::metaDataReaderControlAvailableExtendedMetaData ()
-{
- MockMetaDataReaderControl *metaData = new MockMetaDataReaderControl();
- QVERIFY(metaData !=NULL);
- metaData->availableExtendedMetaData();
- delete metaData;
-}
-
-/* Test case for signal metaDataAvailableChanged */
-void tst_QMetaDataReaderControl::metaDataReaderControlMetaDataAvailableChangedSignal ()
-{
- MockMetaDataReaderControl *metaData = new MockMetaDataReaderControl();
- QVERIFY(metaData !=NULL);
- QSignalSpy spy(metaData,SIGNAL(metaDataAvailableChanged(bool)));
- metaData->setMetaDataAvailable(true);
- QVERIFY(spy.count() == 1);
- delete metaData;
-}
-
- /* Test case for signal metaDataChanged */
-void tst_QMetaDataReaderControl::metaDataReaderControlMetaDataChangedSignal ()
-{
- MockMetaDataReaderControl *metaData = new MockMetaDataReaderControl();
- QVERIFY(metaData !=NULL);
- QSignalSpy spy(metaData,SIGNAL(metaDataChanged()));
- metaData->metaDataChanged();
- QVERIFY(spy.count () == 1);
- delete metaData;
-}
-
-#include "tst_qmetadatareadercontrol.moc"
-
-
diff --git a/tests/auto/qmetadatawritercontrol/qmetadatawritercontrol.pro b/tests/auto/qmetadatawritercontrol/qmetadatawritercontrol.pro
deleted file mode 100644
index eef5d32..0000000
--- a/tests/auto/qmetadatawritercontrol/qmetadatawritercontrol.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmetadatawritercontrol
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qmetadatawritercontrol.cpp
-
-include (../qmultimedia_common/mockcontainer.pri)
diff --git a/tests/auto/qmetadatawritercontrol/tst_qmetadatawritercontrol.cpp b/tests/auto/qmetadatawritercontrol/tst_qmetadatawritercontrol.cpp
deleted file mode 100644
index 68d4281..0000000
--- a/tests/auto/qmetadatawritercontrol/tst_qmetadatawritercontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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>
-#include <QtTest/QtTest>
-#include <QtCore/QCoreApplication>
-#include "qmetadatawritercontrol.h"
-
-#include "mockmetadatawritercontrol.h"
-
-class tst_QMetaDataWriterControl: public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- void constructor();
-};
-
-void tst_QMetaDataWriterControl::initTestCase()
-{
-
-}
-
-void tst_QMetaDataWriterControl::cleanupTestCase()
-{
-
-}
-
-//MaemoAPI-1862:test constructor
-void tst_QMetaDataWriterControl::constructor()
-{
- QMetaDataWriterControl *mock = new MockMetaDataWriterControl();
- mock->availableExtendedMetaData();
- mock->availableMetaData();
- mock->isMetaDataAvailable();
- mock->isWritable();
- mock->metaData((QtMultimedia::MetaData) 1 );
- mock->extendedMetaData(QString("XYZ"));
- mock->setExtendedMetaData(QString("XYZ"),QVariant());
- mock->setMetaData((QtMultimedia::MetaData) 1,QVariant());
- ((MockMetaDataWriterControl*)mock)->setWritable();
- ((MockMetaDataWriterControl*)mock)->setMetaDataAvailable();
- delete mock;
-}
-
-QTEST_MAIN(tst_QMetaDataWriterControl);
-
-#include "tst_qmetadatawritercontrol.moc"
diff --git a/tests/auto/qmultimedia_common/mock.pri b/tests/auto/qmultimedia_common/mock.pri
deleted file mode 100644
index 8b8f3e7..0000000
--- a/tests/auto/qmultimedia_common/mock.pri
+++ /dev/null
@@ -1,7 +0,0 @@
-INCLUDEPATH += $$PWD \
- ../../../src/multimedia \
-
-HEADERS *= \
- ../qmultimedia_common/mockmediaserviceprovider.h \
- ../qmultimedia_common/mockmediaservice.h \
- ../qmultimedia_common/mockmediaobject.h
diff --git a/tests/auto/qmultimedia_common/mockaudioencodercontrol.h b/tests/auto/qmultimedia_common/mockaudioencodercontrol.h
deleted file mode 100644
index 85d1866..0000000
--- a/tests/auto/qmultimedia_common/mockaudioencodercontrol.h
+++ /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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKAUDIOENCODERCONTROL_H
-#define MOCKAUDIOENCODERCONTROL_H
-
-#include "qaudioencodercontrol.h"
-
-class MockAudioEncoderControl : public QAudioEncoderControl
-{
- Q_OBJECT
-public:
- MockAudioEncoderControl(QObject *parent):
- QAudioEncoderControl(parent)
- {
- m_codecs << "audio/pcm" << "audio/mpeg";
- m_descriptions << "Pulse Code Modulation" << "mp3 format";
- m_supportedEncodeOptions.insert("audio/pcm", QStringList());
- m_supportedEncodeOptions.insert("audio/mpeg", QStringList() << "quality" << "bitrate" << "mode" << "vbr");
- m_audioSettings.setCodec("audio/pcm");
- m_audioSettings.setBitRate(128*1024);
- m_audioSettings.setSampleRate(8000);
- m_freqs << 8000 << 11025 << 22050 << 44100;
- }
-
- ~MockAudioEncoderControl() {}
-
- QAudioEncoderSettings audioSettings() const
- {
- return m_audioSettings;
- }
-
- void setAudioSettings(const QAudioEncoderSettings &settings)
- {
- m_audioSettings = settings;
- }
-
- QList<int> supportedChannelCounts(const QAudioEncoderSettings & = QAudioEncoderSettings()) const
- {
- QList<int> list; list << 1 << 2; return list;
- }
-
- QList<int> supportedSampleRates(const QAudioEncoderSettings & = QAudioEncoderSettings(), bool *continuous = 0) const
- {
- if (continuous)
- *continuous = false;
-
- return m_freqs;
- }
-
- QStringList supportedAudioCodecs() const
- {
- return m_codecs;
- }
-
- QString codecDescription(const QString &codecName) const
- {
- return m_descriptions.value(m_codecs.indexOf(codecName));
- }
-
- QStringList supportedEncodingOptions(const QString &codec) const
- {
- return m_supportedEncodeOptions.value(codec);
- }
-
- QVariant encodingOption(const QString &codec, const QString &name) const
- {
- return m_encodeOptions[codec].value(name);
- }
-
- void setEncodingOption(const QString &codec, const QString &name, const QVariant &value)
- {
- m_encodeOptions[codec][name] = value;
- }
-
-private:
- QAudioEncoderSettings m_audioSettings;
-
- QStringList m_codecs;
- QStringList m_descriptions;
-
- QList<int> m_freqs;
-
- QMap<QString, QStringList> m_supportedEncodeOptions;
- QMap<QString, QMap<QString, QVariant> > m_encodeOptions;
-
-};
-
-#endif // MOCKAUDIOENCODERCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockaudioendpointselector.h b/tests/auto/qmultimedia_common/mockaudioendpointselector.h
deleted file mode 100644
index 2bc118d..0000000
--- a/tests/auto/qmultimedia_common/mockaudioendpointselector.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKAUDIOENDPOINTSELECTOR_H
-#define MOCKAUDIOENDPOINTSELECTOR_H
-
-#include "qaudioendpointselector.h"
-
-class MockAudioEndpointSelector : public QAudioEndpointSelector
-{
- Q_OBJECT
-public:
- MockAudioEndpointSelector(QObject *parent):
- QAudioEndpointSelector(parent)
- {
- m_names << "device1" << "device2" << "device3";
- m_descriptions << "dev1 comment" << "dev2 comment" << "dev3 comment";
- m_audioInput = "device1";
- emit availableEndpointsChanged();
- }
- ~MockAudioEndpointSelector() {}
-
- QList<QString> availableEndpoints() const
- {
- return m_names;
- }
-
- QString 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_descriptions.at(i);
- break;
- }
- }
- return desc;
- }
-
- QString defaultEndpoint() const
- {
- return m_names.at(0);
- }
-
- QString activeEndpoint() const
- {
- return m_audioInput;
- }
-
-public Q_SLOTS:
-
- void setActiveEndpoint(const QString& name)
- {
- m_audioInput = name;
- emit activeEndpointChanged(name);
- }
-
- void addEndpoints()
- {
- m_names << "device4";
- emit availableEndpointsChanged();
- }
-
- void removeEndpoints()
- {
- m_names.clear();
- emit availableEndpointsChanged();
- }
-
-private:
- QString m_audioInput;
- QList<QString> m_names;
- QList<QString> m_descriptions;
-};
-
-
-
-#endif // MOCKAUDIOENDPOINTSELECTOR_H
diff --git a/tests/auto/qmultimedia_common/mockcamera.pri b/tests/auto/qmultimedia_common/mockcamera.pri
deleted file mode 100644
index 233d5b8..0000000
--- a/tests/auto/qmultimedia_common/mockcamera.pri
+++ /dev/null
@@ -1,22 +0,0 @@
-# Camera related mock backend files
-INCLUDEPATH += $$PWD \
- ../../../src/multimedia \
- ../../../src/multimedia/video \
- ../../../src/multimedia/camera
-
-HEADERS *= \
- ../qmultimedia_common/mockcameraservice.h \
- ../qmultimedia_common/mockcameraflashcontrol.h \
- ../qmultimedia_common/mockcameralockscontrol.h \
- ../qmultimedia_common/mockcamerafocuscontrol.h \
- ../qmultimedia_common/mockcameraimageprocessingcontrol.h \
- ../qmultimedia_common/mockcameraimagecapturecontrol.h \
- ../qmultimedia_common/mockcameraexposurecontrol.h \
- ../qmultimedia_common/mockcameracapturedestinationcontrol.h \
- ../qmultimedia_common/mockcameracapturebuffercontrol.h \
- ../qmultimedia_common/mockimageencodercontrol.h \
- ../qmultimedia_common/mockcameracontrol.h \
-
-
-include(mockvideo.pri)
-
diff --git a/tests/auto/qmultimedia_common/mockcameracapturebuffercontrol.h b/tests/auto/qmultimedia_common/mockcameracapturebuffercontrol.h
deleted file mode 100644
index d717946..0000000
--- a/tests/auto/qmultimedia_common/mockcameracapturebuffercontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKCAMERACAPTUREBUFFERCONTROL_H
-#define MOCKCAMERACAPTUREBUFFERCONTROL_H
-
-#include "qcameracapturebufferformatcontrol.h"
-
-class MockCaptureBufferFormatControl : public QCameraCaptureBufferFormatControl
-{
- Q_OBJECT
-public:
- MockCaptureBufferFormatControl(QObject *parent = 0):
- QCameraCaptureBufferFormatControl(parent),
- m_format(QVideoFrame::Format_Jpeg)
- {
- }
-
- QList<QVideoFrame::PixelFormat> supportedBufferFormats() const
- {
- return QList<QVideoFrame::PixelFormat>()
- << QVideoFrame::Format_Jpeg
- << QVideoFrame::Format_RGB32
- << QVideoFrame::Format_AdobeDng;
- }
-
- QVideoFrame::PixelFormat bufferFormat() const
- {
- return m_format;
- }
-
- void setBufferFormat(QVideoFrame::PixelFormat format)
- {
- if (format != m_format && supportedBufferFormats().contains(format)) {
- m_format = format;
- emit bufferFormatChanged(m_format);
- }
- }
-
-private:
- QVideoFrame::PixelFormat m_format;
-};
-
-
-#endif // MOCKCAMERACAPTUREBUFFERCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockcameracapturedestinationcontrol.h b/tests/auto/qmultimedia_common/mockcameracapturedestinationcontrol.h
deleted file mode 100644
index 3f7697d..0000000
--- a/tests/auto/qmultimedia_common/mockcameracapturedestinationcontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKCAMERACAPTUREDESTINATIONCONTROL_H
-#define MOCKCAMERACAPTUREDESTINATIONCONTROL_H
-
-#include "qcameracapturedestinationcontrol.h"
-
-class MockCaptureDestinationControl : public QCameraCaptureDestinationControl
-{
- Q_OBJECT
-public:
- MockCaptureDestinationControl(QObject *parent = 0):
- QCameraCaptureDestinationControl(parent),
- m_destination(QCameraImageCapture::CaptureToFile)
- {
- }
-
- bool isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const
- {
- return destination == QCameraImageCapture::CaptureToBuffer ||
- destination == QCameraImageCapture::CaptureToFile;
- }
-
- QCameraImageCapture::CaptureDestinations captureDestination() const
- {
- return m_destination;
- }
-
- void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination)
- {
- if (isCaptureDestinationSupported(destination) && destination != m_destination) {
- m_destination = destination;
- emit captureDestinationChanged(m_destination);
- }
- }
-
-private:
- QCameraImageCapture::CaptureDestinations m_destination;
-};
-
-#endif // MOCKCAMERACAPTUREDESTINATIONCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockcameracontrol.h b/tests/auto/qmultimedia_common/mockcameracontrol.h
deleted file mode 100644
index 893ecbf..0000000
--- a/tests/auto/qmultimedia_common/mockcameracontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKCAMERACONTROL_H
-#define MOCKCAMERACONTROL_H
-
-#include "qcameracontrol.h"
-
-class MockCameraControl : public QCameraControl
-{
- friend class MockCaptureControl;
- Q_OBJECT
-public:
- MockCameraControl(QObject *parent = 0):
- QCameraControl(parent),
- m_state(QCamera::UnloadedState),
- m_captureMode(QCamera::CaptureStillImage),
- m_status(QCamera::UnloadedStatus),
- m_propertyChangesSupported(false)
- {
- }
-
- ~MockCameraControl() {}
-
- void start() { m_state = QCamera::ActiveState; }
- virtual void stop() { m_state = QCamera::UnloadedState; }
- QCamera::State state() const { return m_state; }
- void setState(QCamera::State state) {
- if (m_state != state) {
- m_state = state;
-
- switch (state) {
- case QCamera::UnloadedState:
- m_status = QCamera::UnloadedStatus;
- break;
- case QCamera::LoadedState:
- m_status = QCamera::LoadedStatus;
- break;
- case QCamera::ActiveState:
- m_status = QCamera::ActiveStatus;
- break;
- default:
- emit error(QCamera::NotSupportedFeatureError, "State not supported.");
- return;
- }
-
- emit stateChanged(m_state);
- emit statusChanged(m_status);
- }
- }
-
- QCamera::Status status() const { return m_status; }
-
- QCamera::CaptureMode captureMode() const { return m_captureMode; }
- void setCaptureMode(QCamera::CaptureMode mode)
- {
- if (m_captureMode != mode) {
- if (m_state == QCamera::ActiveState && !m_propertyChangesSupported)
- return;
- m_captureMode = mode;
- emit captureModeChanged(mode);
- }
- }
-
- bool isCaptureModeSupported(QCamera::CaptureMode mode) const
- {
- return mode == QCamera::CaptureStillImage || mode == QCamera::CaptureVideo;
- }
-
- QCamera::LockTypes supportedLocks() const
- {
- return QCamera::LockExposure | QCamera::LockFocus | QCamera::LockWhiteBalance;
- }
-
- bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const
- {
- Q_UNUSED(status);
- if (changeType == QCameraControl::ImageEncodingSettings && m_captureMode == QCamera::CaptureVideo)
- return true;
- else if (changeType== QCameraControl::VideoEncodingSettings)
- return true;
- else
- return m_propertyChangesSupported;
- }
-
- /* helper method to emit the signal error */
- void setError(QCamera::Error err, QString errorString)
- {
- emit error(err, errorString);
- }
-
- /* helper method to emit the signal statusChaged */
- void setStatus(QCamera::Status newStatus)
- {
- m_status = newStatus;
- emit statusChanged(newStatus);
- }
-
- QCamera::State m_state;
- QCamera::CaptureMode m_captureMode;
- QCamera::Status m_status;
- bool m_propertyChangesSupported;
-};
-
-
-
-#endif // MOCKCAMERACONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockcameraexposurecontrol.h b/tests/auto/qmultimedia_common/mockcameraexposurecontrol.h
deleted file mode 100644
index d89762d..0000000
--- a/tests/auto/qmultimedia_common/mockcameraexposurecontrol.h
+++ /dev/null
@@ -1,282 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKCAMERAEXPOSURECONTROL_H
-#define MOCKCAMERAEXPOSURECONTROL_H
-
-#include "qcameraexposurecontrol.h"
-
-class MockCameraExposureControl : public QCameraExposureControl
-{
- Q_OBJECT
-public:
- MockCameraExposureControl(QObject *parent = 0):
- QCameraExposureControl(parent),
- m_aperture(2.8),
- m_shutterSpeed(0.01),
- m_isoSensitivity(100),
- m_meteringMode(QCameraExposure::MeteringMatrix),
- m_exposureCompensation(0),
- m_exposureMode(QCameraExposure::ExposureAuto),
- m_flashMode(QCameraExposure::FlashAuto)
- {
- m_isoRanges << 100 << 200 << 400 << 800;
- m_apertureRanges << 2.8 << 4.0 << 5.6 << 8.0 << 11.0 << 16.0;
- m_shutterRanges << 0.001 << 0.01 << 0.1 << 1.0;
- m_exposureRanges << -2.0 << 2.0;
- }
-
- ~MockCameraExposureControl() {}
-
- QCameraExposure::FlashModes flashMode() const {return m_flashMode;}
-
- void setFlashMode(QCameraExposure::FlashModes mode)
- {
- if (isFlashModeSupported(mode)) {
- m_flashMode = mode;
- }
- }
-
- bool isFlashModeSupported(QCameraExposure::FlashModes mode) const
- {
- return mode & (QCameraExposure::FlashAuto | QCameraExposure::FlashOff | QCameraExposure::FlashOn);
- }
-
- bool isFlashReady() const { return true;}
-
- QCameraExposure::ExposureMode exposureMode() const { return m_exposureMode; }
-
- void setExposureMode(QCameraExposure::ExposureMode mode)
- {
- if (isExposureModeSupported(mode))
- m_exposureMode = mode;
- }
-
- //Setting the Exposure Mode Supported Enum values
- bool isExposureModeSupported(QCameraExposure::ExposureMode mode) const
- {
- return ( mode == QCameraExposure::ExposureAuto || mode == QCameraExposure::ExposureManual || mode == QCameraExposure::ExposureBacklight ||
- mode == QCameraExposure::ExposureNight || mode == QCameraExposure::ExposureSpotlight ||mode == QCameraExposure::ExposureSports ||
- mode == QCameraExposure::ExposureSnow || mode == QCameraExposure:: ExposureLargeAperture ||mode == QCameraExposure::ExposureSmallAperture ||
- mode == QCameraExposure::ExposurePortrait || mode == QCameraExposure::ExposureModeVendor ||mode == QCameraExposure::ExposureBeach );
- }
-
- bool isParameterSupported(ExposureParameter parameter) const
- {
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- case QCameraExposureControl::ISO:
- case QCameraExposureControl::Aperture:
- case QCameraExposureControl::ShutterSpeed:
- return true;
- default:
- return false;
- }
- }
-
- QVariant exposureParameter(ExposureParameter parameter) const
- {
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- return QVariant(m_exposureCompensation);
- case QCameraExposureControl::ISO:
- return QVariant(m_isoSensitivity);
- case QCameraExposureControl::Aperture:
- return QVariant(m_aperture);
- case QCameraExposureControl::ShutterSpeed:
- return QVariant(m_shutterSpeed);
- default:
- return QVariant();
- }
- }
-
- QVariantList supportedParameterRange(ExposureParameter parameter) const
- {
- QVariantList res;
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- return m_exposureRanges;
- case QCameraExposureControl::ISO:
- return m_isoRanges;
- case QCameraExposureControl::Aperture:
- return m_apertureRanges;
- case QCameraExposureControl::ShutterSpeed:
- return m_shutterRanges;
- default:
- break;
- }
-
- return res;
- }
-
- ParameterFlags exposureParameterFlags(ExposureParameter parameter) const
- {
- ParameterFlags res = 0;
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- case QCameraExposureControl::Aperture:
- case QCameraExposureControl::ShutterSpeed:
- res |= ContinuousRange;
- default:
- break;
- }
-
- return res;
- }
-
- // Added exposureParameterChanged and exposureParameterRangeChanged signal
- bool setExposureParameter(ExposureParameter parameter, const QVariant& value)
- {
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- {
- m_res.clear();
- m_res << -4.0 << 4.0;
- qreal exposureCompensationlocal = qBound<qreal>(-2.0, value.toReal(), 2.0);
- if (exposureParameter(parameter).toReal() != exposureCompensationlocal) {
- m_exposureCompensation = exposureCompensationlocal;
- emit exposureParameterChanged(parameter);
- }
-
- if (m_exposureRanges.last().toReal() != m_res.last().toReal()) {
- m_exposureRanges.clear();
- m_exposureRanges = m_res;
- emit exposureParameterRangeChanged(parameter);
- }
- }
- break;
- case QCameraExposureControl::ISO:
- {
- m_res.clear();
- m_res << 20 << 50;
- qreal exposureCompensationlocal = 100*qRound(qBound(100, value.toInt(), 800)/100.0);
- if (exposureParameter(parameter).toReal() != exposureCompensationlocal) {
- m_isoSensitivity = exposureCompensationlocal;
- emit exposureParameterChanged(parameter);
- }
-
- if (m_isoRanges.last().toInt() != m_res.last().toInt()) {
- m_isoRanges.clear();
- m_isoRanges = m_res;
- emit exposureParameterRangeChanged(parameter);
- }
- }
- break;
- case QCameraExposureControl::Aperture:
- {
- m_res.clear();
- m_res << 12.0 << 18.0 << 20.0;
- qreal exposureCompensationlocal = qBound<qreal>(2.8, value.toReal(), 16.0);
- if (exposureParameter(parameter).toReal() != exposureCompensationlocal) {
- m_aperture = exposureCompensationlocal;
- emit exposureParameterChanged(parameter);
- }
-
- if (m_apertureRanges.last().toReal() != m_res.last().toReal()) {
- m_apertureRanges.clear();
- m_apertureRanges = m_res;
- emit exposureParameterRangeChanged(parameter);
- }
- }
- break;
- case QCameraExposureControl::ShutterSpeed:
- {
- m_res.clear();
- m_res << 0.12 << 1.0 << 2.0;
- qreal exposureCompensationlocal = qBound<qreal>(0.001, value.toReal(), 1.0);
- if (exposureParameter(parameter).toReal() != exposureCompensationlocal) {
- m_shutterSpeed = exposureCompensationlocal;
- emit exposureParameterChanged(parameter);
- }
-
- if (m_shutterRanges.last().toReal() != m_res.last().toReal()) {
- m_shutterRanges.clear();
- m_shutterRanges = m_res;
- emit exposureParameterRangeChanged(parameter);
- }
- }
- break;
- default:
- return false;
- }
-
- emit flashReady(true); // depends on Flashcontrol
-
- return true;
- }
-
- QString extendedParameterName(ExposureParameter)
- {
- return QString();
- }
-
- QCameraExposure::MeteringMode meteringMode() const
- {
- return m_meteringMode;
- }
-
- void setMeteringMode(QCameraExposure::MeteringMode mode)
- {
- if (isMeteringModeSupported(mode))
- m_meteringMode = mode;
- }
-
- //Setting the values for metering mode
- bool isMeteringModeSupported(QCameraExposure::MeteringMode mode) const
- {
- return mode == QCameraExposure::MeteringAverage
- || mode == QCameraExposure::MeteringMatrix
- || mode == QCameraExposure::MeteringAverage
- || mode ==QCameraExposure::MeteringSpot;
- }
-
-private:
- qreal m_aperture;
- qreal m_shutterSpeed;
- int m_isoSensitivity;
- QCameraExposure::MeteringMode m_meteringMode;
- qreal m_exposureCompensation;
- QCameraExposure::ExposureMode m_exposureMode;
- QCameraExposure::FlashModes m_flashMode;
- QVariantList m_isoRanges,m_apertureRanges, m_shutterRanges, m_exposureRanges, m_res;
-};
-
-#endif // MOCKCAMERAEXPOSURECONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockcameraflashcontrol.h b/tests/auto/qmultimedia_common/mockcameraflashcontrol.h
deleted file mode 100644
index f7a7950..0000000
--- a/tests/auto/qmultimedia_common/mockcameraflashcontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKCAMERAFLASHCONTROL_H
-#define MOCKCAMERAFLASHCONTROL_H
-
-#include "qcameraflashcontrol.h"
-
-class MockCameraFlashControl : public QCameraFlashControl
-{
- Q_OBJECT
-public:
- MockCameraFlashControl(QObject *parent = 0):
- QCameraFlashControl(parent),
- m_flashMode(QCameraExposure::FlashAuto)
- {
- }
-
- ~MockCameraFlashControl() {}
-
- QCameraExposure::FlashModes flashMode() const
- {
- return m_flashMode;
- }
-
- void setFlashMode(QCameraExposure::FlashModes mode)
- {
- if (isFlashModeSupported(mode)) {
- m_flashMode = mode;
- }
- emit flashReady(true);
- }
- //Setting the values for Flash mode
-
- bool isFlashModeSupported(QCameraExposure::FlashModes mode) const
- {
- return (mode || (QCameraExposure::FlashAuto | QCameraExposure::FlashOff | QCameraExposure::FlashOn |
- QCameraExposure::FlashFill |QCameraExposure::FlashTorch |QCameraExposure::FlashSlowSyncFrontCurtain |
- QCameraExposure::FlashRedEyeReduction));
- }
-
- bool isFlashReady() const
- {
- return true;
- }
-
-private:
- QCameraExposure::FlashModes m_flashMode;
-};
-
-#endif // MOCKCAMERAFLASHCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockcamerafocuscontrol.h b/tests/auto/qmultimedia_common/mockcamerafocuscontrol.h
deleted file mode 100644
index a0fb481..0000000
--- a/tests/auto/qmultimedia_common/mockcamerafocuscontrol.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKCAMERAFOCUSCONTROL_H
-#define MOCKCAMERAFOCUSCONTROL_H
-
-#include "qcamerafocuscontrol.h"
-#include "qcamerafocus.h"
-
-class MockCameraFocusControl : public QCameraFocusControl
-{
- Q_OBJECT
-public:
- MockCameraFocusControl(QObject *parent = 0):
- QCameraFocusControl(parent),
- m_opticalZoom(1.0),
- m_digitalZoom(1.0),
- m_focusMode(QCameraFocus::AutoFocus),
- m_focusPointMode(QCameraFocus::FocusPointAuto),
- m_focusPoint(0.5, 0.5),
- m_maxOpticalZoom(3.0),
- m_maxDigitalZoom(4.0)
-
- {
- m_zones << QCameraFocusZone(QRectF(0.45, 0.45, 0.1, 0.1));
- }
-
- ~MockCameraFocusControl() {}
-
- QCameraFocus::FocusMode focusMode() const
- {
- return m_focusMode;
- }
-
- void setFocusMode(QCameraFocus::FocusMode mode)
- {
- if (isFocusModeSupported(mode))
- m_focusMode = mode;
- }
-
- bool isFocusModeSupported(QCameraFocus::FocusMode mode) const
- {
- return mode == QCameraFocus::AutoFocus || mode == QCameraFocus::ContinuousFocus;
- }
-
- qreal maximumOpticalZoom() const
- {
- return m_maxOpticalZoom;
- }
-
- qreal maximumDigitalZoom() const
- {
- return m_maxDigitalZoom;
- }
-
- qreal opticalZoom() const
- {
- return m_opticalZoom;
- }
-
- qreal digitalZoom() const
- {
- return m_digitalZoom;
- }
-
- void zoomTo(qreal optical, qreal digital)
- {
- optical = qBound<qreal>(1.0, optical, maximumOpticalZoom());
- digital = qBound<qreal>(1.0, digital, maximumDigitalZoom());
-
- if (!qFuzzyCompare(digital, m_digitalZoom)) {
- m_digitalZoom = digital;
- emit digitalZoomChanged(m_digitalZoom);
- }
-
- if (!qFuzzyCompare(optical, m_opticalZoom)) {
- m_opticalZoom = optical;
- emit opticalZoomChanged(m_opticalZoom);
- }
-
- maxOpticalDigitalZoomChange(4.0, 5.0);
- focusZonesChange(0.50, 0.50, 0.3, 0.3);
- }
-
- QCameraFocus::FocusPointMode focusPointMode() const
- {
- return m_focusPointMode;
- }
-
- void setFocusPointMode(QCameraFocus::FocusPointMode mode)
- {
- if (isFocusPointModeSupported(mode))
- m_focusPointMode = mode;
- }
-
- bool isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const
- {
- switch (mode) {
- case QCameraFocus::FocusPointAuto:
- case QCameraFocus::FocusPointCenter:
- case QCameraFocus::FocusPointCustom:
- return true;
- default:
- return false;
- }
- }
-
- QPointF customFocusPoint() const
- {
- return m_focusPoint;
- }
-
- void setCustomFocusPoint(const QPointF &point)
- {
- m_focusPoint = point;
- }
-
- QCameraFocusZoneList focusZones() const
- {
- return m_zones;
- }
-
- // helper function to emit maximum Optical and Digital Zoom Changed signals
- void maxOpticalDigitalZoomChange(qreal maxOptical, qreal maxDigital)
- {
- if (maxOptical != m_maxOpticalZoom) {
- m_maxOpticalZoom = maxOptical;
- emit maximumOpticalZoomChanged(m_maxOpticalZoom);
- }
-
- if (maxDigital != m_maxDigitalZoom) {
- m_maxDigitalZoom = maxDigital;
- emit maximumDigitalZoomChanged(m_maxDigitalZoom);
- }
- }
-
- // helper function to emit Focus Zones Changed signals
- void focusZonesChange(qreal left, qreal top, qreal width, qreal height)
- {
- QCameraFocusZone myZone(QRectF(left, top, width, height));
- if (m_zones.last().area() != myZone.area()) {
- m_zones.clear();
- m_zones << myZone;
- emit focusZonesChanged();
- }
- }
-
-private:
- qreal m_opticalZoom;
- qreal m_digitalZoom;
- QCameraFocus::FocusMode m_focusMode;
- QCameraFocus::FocusPointMode m_focusPointMode;
- QPointF m_focusPoint;
- // to emit maximum Optical and Digital Zoom Changed signals
- qreal m_maxOpticalZoom;
- qreal m_maxDigitalZoom;
- // to emit focus zone changed signal
- QCameraFocusZoneList m_zones;
-};
-
-#endif // MOCKCAMERAFOCUSCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockcameraimagecapturecontrol.h b/tests/auto/qmultimedia_common/mockcameraimagecapturecontrol.h
deleted file mode 100644
index 5fb3cb1..0000000
--- a/tests/auto/qmultimedia_common/mockcameraimagecapturecontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKCAMERACAPTURECONTROL_H
-#define MOCKCAMERACAPTURECONTROL_H
-
-#include <QDateTime>
-#include <QTimer>
-
-#include "qcameraimagecapturecontrol.h"
-#include "qcameracontrol.h"
-#include "mockcameracontrol.h"
-
-class MockCaptureControl : public QCameraImageCaptureControl
-{
- Q_OBJECT
-public:
- MockCaptureControl(MockCameraControl *cameraControl, QObject *parent = 0)
- : QCameraImageCaptureControl(parent), m_cameraControl(cameraControl), m_captureRequest(0), m_ready(true), m_captureCanceled(false)
- {
- }
-
- ~MockCaptureControl()
- {
- }
-
- QCameraImageCapture::DriveMode driveMode() const { return QCameraImageCapture::SingleImageCapture; }
- void setDriveMode(QCameraImageCapture::DriveMode) {}
-
- bool isReadyForCapture() const { return m_ready && m_cameraControl->state() == QCamera::ActiveState; }
-
- int capture(const QString &fileName)
- {
- if (isReadyForCapture()) {
- m_fileName = fileName;
- m_captureRequest++;
- emit readyForCaptureChanged(m_ready = false);
- QTimer::singleShot(5, this, SLOT(captured()));
- return m_captureRequest;
- } else {
- emit error(-1, QCameraImageCapture::NotReadyError,
- QLatin1String("Could not capture in stopped state"));
- }
-
- return -1;
- }
-
- void cancelCapture()
- {
- m_captureCanceled = true;
- }
-
-private Q_SLOTS:
- void captured()
- {
- if (!m_captureCanceled) {
- emit imageCaptured(m_captureRequest, QImage());
-
- emit imageMetadataAvailable(m_captureRequest,
- QtMultimedia::FocalLengthIn35mmFilm,
- QVariant(50));
-
- emit imageMetadataAvailable(m_captureRequest,
- QtMultimedia::DateTimeOriginal,
- QVariant(QDateTime::currentDateTime()));
-
- emit imageMetadataAvailable(m_captureRequest,
- QLatin1String("Answer to the Ultimate Question of Life, the Universe, and Everything"),
- QVariant(42));
- }
-
- if (!m_ready)
- {
- emit readyForCaptureChanged(m_ready = true);
- emit imageExposed(m_captureRequest);
- }
-
- if (!m_captureCanceled)
- emit imageSaved(m_captureRequest, m_fileName);
-
- m_captureCanceled = false;
- }
-
-private:
- MockCameraControl *m_cameraControl;
- QString m_fileName;
- int m_captureRequest;
- bool m_ready;
- bool m_captureCanceled;
-};
-
-#endif // MOCKCAMERACAPTURECONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockcameraimageprocessingcontrol.h b/tests/auto/qmultimedia_common/mockcameraimageprocessingcontrol.h
deleted file mode 100644
index f02f2b4..0000000
--- a/tests/auto/qmultimedia_common/mockcameraimageprocessingcontrol.h
+++ /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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKCAMERAIMAGEPROCESSINGCONTROL_H
-#define MOCKCAMERAIMAGEPROCESSINGCONTROL_H
-
-#include "qcameraimageprocessingcontrol.h"
-
-class MockImageProcessingControl : public QCameraImageProcessingControl
-{
- Q_OBJECT
-public:
- MockImageProcessingControl(QObject *parent = 0)
- : QCameraImageProcessingControl(parent)
- {
- m_supportedWhiteBalance.insert(QCameraImageProcessing::WhiteBalanceAuto);
- }
-
- QCameraImageProcessing::WhiteBalanceMode whiteBalanceMode() const
- {
- return m_whiteBalanceMode;
- }
- void setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode)
- {
- m_whiteBalanceMode = mode;
- }
-
- bool isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const
- {
- return m_supportedWhiteBalance.contains(mode);
- }
-
- void setSupportedWhiteBalanceModes(QSet<QCameraImageProcessing::WhiteBalanceMode> modes)
- {
- m_supportedWhiteBalance = modes;
- }
-
- bool isProcessingParameterSupported(ProcessingParameter parameter) const
- {
- //return parameter == Contrast || parameter == Sharpening || parameter == ColorTemperature;
- switch (parameter)
- {
- case Contrast:
- case Brightness:
- case Sharpening:
- case Saturation:
- case Denoising:
- case ColorTemperature:
- case ExtendedParameter:
- return true;
- default :
- return false;
- }
- }
- QVariant processingParameter(ProcessingParameter parameter) const
- {
- switch (parameter) {
- case Contrast:
- return m_contrast;
- case Saturation:
- return m_saturation;
- case Brightness:
- return m_brightness;
- case Sharpening:
- return m_sharpeningLevel;
- case Denoising:
- return m_denoising;
- case ColorTemperature:
- return m_manualWhiteBalance;
- case ExtendedParameter:
- return m_extendedParameter;
- default:
- return QVariant();
- }
- }
- void setProcessingParameter(ProcessingParameter parameter, QVariant value)
- {
- switch (parameter) {
- case Contrast:
- m_contrast = value;
- break;
- case Saturation:
- m_saturation = value;
- break;
- case Brightness:
- m_brightness = value;
- break;
- case Sharpening:
- m_sharpeningLevel = value;
- break;
- case Denoising:
- m_denoising = value;
- break;
- case ColorTemperature:
- m_manualWhiteBalance = value;
- break;
- case ExtendedParameter:
- m_extendedParameter = value;
- break;
- default:
- break;
- }
- }
-
-
-private:
- QCameraImageProcessing::WhiteBalanceMode m_whiteBalanceMode;
- QSet<QCameraImageProcessing::WhiteBalanceMode> m_supportedWhiteBalance;
- QVariant m_manualWhiteBalance;
- QVariant m_contrast;
- QVariant m_sharpeningLevel;
- QVariant m_saturation;
- QVariant m_brightness;
- QVariant m_denoising;
- QVariant m_extendedParameter;
-};
-
-#endif // MOCKCAMERAIMAGEPROCESSINGCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockcameralockscontrol.h b/tests/auto/qmultimedia_common/mockcameralockscontrol.h
deleted file mode 100644
index 87c4094..0000000
--- a/tests/auto/qmultimedia_common/mockcameralockscontrol.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKCAMERALOCKCONTROL_H
-#define MOCKCAMERALOCKCONTROL_H
-
-#include <QTimer>
-#include "qcameralockscontrol.h"
-
-class MockCameraLocksControl : public QCameraLocksControl
-{
- Q_OBJECT
-public:
- MockCameraLocksControl(QObject *parent = 0):
- QCameraLocksControl(parent),
- m_focusLock(QCamera::Unlocked),
- m_exposureLock(QCamera::Unlocked)
- {
- }
-
- ~MockCameraLocksControl() {}
-
- QCamera::LockTypes supportedLocks() const
- {
- return QCamera::LockExposure | QCamera::LockFocus;
- }
-
- QCamera::LockStatus lockStatus(QCamera::LockType lock) const
- {
- switch (lock) {
- case QCamera::LockExposure:
- return m_exposureLock;
- case QCamera::LockFocus:
- return m_focusLock;
- default:
- return QCamera::Unlocked;
- }
- }
-
- void searchAndLock(QCamera::LockTypes locks)
- {
- if (locks & QCamera::LockExposure) {
- QCamera::LockStatus newStatus = locks & QCamera::LockFocus ? QCamera::Searching : QCamera::Locked;
-
- if (newStatus != m_exposureLock)
- emit lockStatusChanged(QCamera::LockExposure,
- m_exposureLock = newStatus,
- QCamera::UserRequest);
- }
-
- if (locks & QCamera::LockFocus) {
- emit lockStatusChanged(QCamera::LockFocus,
- m_focusLock = QCamera::Searching,
- QCamera::UserRequest);
-
- QTimer::singleShot(5, this, SLOT(focused()));
- }
- }
-
- void unlock(QCamera::LockTypes locks) {
- if (locks & QCamera::LockFocus && m_focusLock != QCamera::Unlocked) {
- emit lockStatusChanged(QCamera::LockFocus,
- m_focusLock = QCamera::Unlocked,
- QCamera::UserRequest);
- }
-
- if (locks & QCamera::LockExposure && m_exposureLock != QCamera::Unlocked) {
- emit lockStatusChanged(QCamera::LockExposure,
- m_exposureLock = QCamera::Unlocked,
- QCamera::UserRequest);
- }
- }
-
- /* helper method to emit the signal with LockChangeReason */
- void setLockChangeReason (QCamera::LockChangeReason lockChangeReason)
- {
- emit lockStatusChanged(QCamera::NoLock,
- QCamera::Unlocked,
- lockChangeReason);
-
- }
-
-private slots:
- void focused()
- {
- if (m_focusLock == QCamera::Searching) {
- emit lockStatusChanged(QCamera::LockFocus,
- m_focusLock = QCamera::Locked,
- QCamera::UserRequest);
- }
-
- if (m_exposureLock == QCamera::Searching) {
- emit lockStatusChanged(QCamera::LockExposure,
- m_exposureLock = QCamera::Locked,
- QCamera::UserRequest);
- }
- }
-
-
-private:
- QCamera::LockStatus m_focusLock;
- QCamera::LockStatus m_exposureLock;
-};
-
-
-#endif // MOCKCAMERALOCKCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockcameraservice.h b/tests/auto/qmultimedia_common/mockcameraservice.h
deleted file mode 100644
index ea0620a..0000000
--- a/tests/auto/qmultimedia_common/mockcameraservice.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKCAMERASERVICE_H
-#define MOCKCAMERASERVICE_H
-
-#include "qmediaservice.h"
-#include "../qmultimedia_common/mockcameraflashcontrol.h"
-#include "../qmultimedia_common/mockcameralockscontrol.h"
-#include "../qmultimedia_common/mockcamerafocuscontrol.h"
-#include "../qmultimedia_common/mockcameraimageprocessingcontrol.h"
-#include "../qmultimedia_common/mockcameraimagecapturecontrol.h"
-#include "../qmultimedia_common/mockcameraexposurecontrol.h"
-#include "../qmultimedia_common/mockcameracapturedestinationcontrol.h"
-#include "../qmultimedia_common/mockcameracapturebuffercontrol.h"
-#include "../qmultimedia_common/mockimageencodercontrol.h"
-#include "../qmultimedia_common/mockcameracontrol.h"
-#include "../qmultimedia_common/mockvideosurface.h"
-#include "../qmultimedia_common/mockvideorenderercontrol.h"
-
-#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
-#include "../qmultimedia_common/mockvideowindowcontrol.h"
-#endif
-
-class MockSimpleCameraService : public QMediaService
-{
- Q_OBJECT
-
-public:
- MockSimpleCameraService(): QMediaService(0)
- {
- mockControl = new MockCameraControl(this);
- }
-
- ~MockSimpleCameraService()
- {
- }
-
- QMediaControl* requestControl(const char *iid)
- {
- if (qstrcmp(iid, QCameraControl_iid) == 0)
- return mockControl;
- return 0;
- }
-
- void releaseControl(QMediaControl*) {}
-
- MockCameraControl *mockControl;
-};
-
-
-class MockCameraService : public QMediaService
-{
- Q_OBJECT
-
-public:
- MockCameraService(): QMediaService(0)
- {
- mockControl = new MockCameraControl(this);
- mockLocksControl = new MockCameraLocksControl(this);
- mockExposureControl = new MockCameraExposureControl(this);
- mockFlashControl = new MockCameraFlashControl(this);
- mockFocusControl = new MockCameraFocusControl(this);
- mockCaptureControl = new MockCaptureControl(mockControl, this);
- mockCaptureBufferControl = new MockCaptureBufferFormatControl(this);
- mockCaptureDestinationControl = new MockCaptureDestinationControl(this);
- mockImageProcessingControl = new MockImageProcessingControl(this);
- mockImageEncoderControl = new MockImageEncoderControl(this);
- rendererControl = new MockVideoRendererControl(this);
-#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
- windowControl = new MockVideoWindowControl(this);
-#endif
- rendererRef = 0;
- windowRef = 0;
- }
-
- ~MockCameraService()
- {
- }
-
- QMediaControl* requestControl(const char *iid)
- {
- if (qstrcmp(iid, QCameraControl_iid) == 0)
- return mockControl;
-
- if (qstrcmp(iid, QCameraLocksControl_iid) == 0)
- return mockLocksControl;
-
- if (qstrcmp(iid, QCameraExposureControl_iid) == 0)
- return mockExposureControl;
-
- if (qstrcmp(iid, QCameraFlashControl_iid) == 0)
- return mockFlashControl;
-
- if (qstrcmp(iid, QCameraFocusControl_iid) == 0)
- return mockFocusControl;
-
- if (qstrcmp(iid, QCameraImageCaptureControl_iid) == 0)
- return mockCaptureControl;
-
- if (qstrcmp(iid, QCameraCaptureBufferFormatControl_iid) == 0)
- return mockCaptureBufferControl;
-
- if (qstrcmp(iid, QCameraCaptureDestinationControl_iid) == 0)
- return mockCaptureDestinationControl;
-
- if (qstrcmp(iid, QCameraImageProcessingControl_iid) == 0)
- return mockImageProcessingControl;
-
- if (qstrcmp(iid, QImageEncoderControl_iid) == 0)
- return mockImageEncoderControl;
-
- if (qstrcmp(iid, QVideoRendererControl_iid) == 0) {
- if (rendererRef == 0) {
- rendererRef += 1;
- return rendererControl;
- }
- }
-#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
- if (qstrcmp(iid, QVideoWindowControl_iid) == 0) {
- if (windowRef == 0) {
- windowRef += 1;
- return windowControl;
- }
- }
-#endif
- return 0;
- }
-
- void releaseControl(QMediaControl *control)
- {
- if (control == rendererControl)
- rendererRef -= 1;
-#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
- if (control == windowControl)
- windowRef -= 1;
-#endif
- }
-
- MockCameraControl *mockControl;
- MockCameraLocksControl *mockLocksControl;
- MockCaptureControl *mockCaptureControl;
- MockCaptureBufferFormatControl *mockCaptureBufferControl;
- MockCaptureDestinationControl *mockCaptureDestinationControl;
- MockCameraExposureControl *mockExposureControl;
- MockCameraFlashControl *mockFlashControl;
- MockCameraFocusControl *mockFocusControl;
- MockImageProcessingControl *mockImageProcessingControl;
- MockImageEncoderControl *mockImageEncoderControl;
- MockVideoRendererControl *rendererControl;
-#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
- MockVideoWindowControl *windowControl;
-#endif
- int rendererRef;
- int windowRef;
-};
-
-#endif // MOCKCAMERASERVICE_H
diff --git a/tests/auto/qmultimedia_common/mockcontainer.pri b/tests/auto/qmultimedia_common/mockcontainer.pri
deleted file mode 100644
index e4a345a..0000000
--- a/tests/auto/qmultimedia_common/mockcontainer.pri
+++ /dev/null
@@ -1,7 +0,0 @@
-INCLUDEPATH *= $$PWD \
- ../../../src/multimedia \
-
-HEADERS *= \
- ../qmultimedia_common/mockmediacontainercontrol.h \
- ../qmultimedia_common/mockmetadatawritercontrol.h \
- ../qmultimedia_common/mockmetadatareadercontrol.h
diff --git a/tests/auto/qmultimedia_common/mockimageencodercontrol.h b/tests/auto/qmultimedia_common/mockimageencodercontrol.h
deleted file mode 100644
index c63ecd6..0000000
--- a/tests/auto/qmultimedia_common/mockimageencodercontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKIMAGEENCODERCONTROL_H
-#define MOCKIMAGEENCODERCONTROL_H
-
-#include "qimageencodercontrol.h"
-
-class MockImageEncoderControl : public QImageEncoderControl
-{
-public:
- MockImageEncoderControl(QObject *parent = 0)
- : QImageEncoderControl(parent)
- {
- m_settings = QImageEncoderSettings();
- }
-
- QList<QSize> supportedResolutions(const QImageEncoderSettings & settings = QImageEncoderSettings(),
- bool *continuous = 0) const
- {
- if (continuous)
- *continuous = true;
-
- QList<QSize> resolutions;
- if (settings.resolution().isValid()) {
- if (settings.resolution() == QSize(160,160) ||
- settings.resolution() == QSize(320,240))
- resolutions << settings.resolution();
-
- if (settings.quality() == QtMultimedia::HighQuality && settings.resolution() == QSize(640,480))
- resolutions << settings.resolution();
- } else {
- resolutions << QSize(160, 120);
- resolutions << QSize(320, 240);
- if (settings.quality() == QtMultimedia::HighQuality)
- resolutions << QSize(640, 480);
- }
-
- return resolutions;
- }
-
- QStringList supportedImageCodecs() const
- {
- QStringList codecs;
- codecs << "PNG" << "JPEG";
- return codecs;
- }
-
- QString imageCodecDescription(const QString &codecName) const {
- if (codecName == "PNG")
- return QString("Portable Network Graphic");
- if (codecName == "JPEG")
- return QString("Joint Photographic Expert Group");
- return QString();
- }
-
- QImageEncoderSettings imageSettings() const { return m_settings; }
- void setImageSettings(const QImageEncoderSettings &settings) { m_settings = settings; }
-
-private:
- QImageEncoderSettings m_settings;
-};
-
-
-#endif // MOCKIMAGEENCODERCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockmediacontainercontrol.h b/tests/auto/qmultimedia_common/mockmediacontainercontrol.h
deleted file mode 100644
index 2a8832d..0000000
--- a/tests/auto/qmultimedia_common/mockmediacontainercontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKMEDIACONTAINERCONTROL_H
-#define MOCKMEDIACONTAINERCONTROL_H
-
-#include <QObject>
-#include "qmediacontainercontrol.h"
-#include <QMap>
-#include <QString>
-#include <QStringList>
-
-QT_USE_NAMESPACE
-class MockMediaContainerControl : public QMediaContainerControl
-{
- Q_OBJECT
-public:
- MockMediaContainerControl(QObject *parent):
- QMediaContainerControl(parent)
- {
- m_supportedContainers.append("wav");
- m_supportedContainers.append("mp3");
- m_supportedContainers.append("mov");
-
- m_descriptions.insert("wav", "WAV format");
- m_descriptions.insert("mp3", "MP3 format");
- m_descriptions.insert("mov", "MOV format");
- }
-
- virtual ~MockMediaContainerControl() {};
-
- QStringList supportedContainers() const
- {
- return m_supportedContainers;
- }
-
- QString containerMimeType() const
- {
- return m_format;
- }
-
- void setContainerMimeType(const QString &formatMimeType)
- {
- if (m_supportedContainers.contains(formatMimeType))
- m_format = formatMimeType;
- }
-
- QString containerDescription(const QString &formatMimeType) const
- {
- return m_descriptions.value(formatMimeType);
- }
-
-private:
- QStringList m_supportedContainers;
- QMap<QString, QString> m_descriptions;
- QString m_format;
-};
-
-#endif // MOCKMEDIACONTAINERCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockmedianetworkaccesscontrol.h b/tests/auto/qmultimedia_common/mockmedianetworkaccesscontrol.h
deleted file mode 100644
index 472a30f..0000000
--- a/tests/auto/qmultimedia_common/mockmedianetworkaccesscontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKMEDIANETWORKACCESSCONTROL_H
-#define MOCKMEDIANETWORKACCESSCONTROL_H
-
-#include "qmedianetworkaccesscontrol.h"
-#include "qnetworkconfiguration.h"
-
-class MockNetworkAccessControl : public QMediaNetworkAccessControl
-{
- friend class MockMediaPlayerService;
-
-public:
- MockNetworkAccessControl() {}
- ~MockNetworkAccessControl() {}
-
- void setConfigurations(const QList<QNetworkConfiguration> &configurations)
- {
- _configurations = configurations;
- _current = QNetworkConfiguration();
- }
-
- QNetworkConfiguration currentConfiguration() const
- {
- return _current;
- }
-
-private:
- void setCurrentConfiguration(QNetworkConfiguration configuration)
- {
- if (_configurations.contains(configuration))
- emit configurationChanged(_current = configuration);
- else
- emit configurationChanged(_current = QNetworkConfiguration());
- }
-
- QList<QNetworkConfiguration> _configurations;
- QNetworkConfiguration _current;
-};
-
-Q_DECLARE_METATYPE(QNetworkConfiguration)
-
-
-#endif // MOCKMEDIANETWORKACCESSCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockmediaobject.h b/tests/auto/qmultimedia_common/mockmediaobject.h
deleted file mode 100644
index fcc5c37..0000000
--- a/tests/auto/qmultimedia_common/mockmediaobject.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKMEDIAOBJECT_H
-#define MOCKMEDIAOBJECT_H
-
-#include "qmediaobject.h"
-
-class MockMediaObject : public QMediaObject
-{
- Q_OBJECT
-public:
- MockMediaObject(QObject *parent, QMediaService *service):
- QMediaObject(parent, service)
- {
- }
-};
-
-#endif // MOCKMEDIAOBJECT_H
diff --git a/tests/auto/qmultimedia_common/mockmediaplayercontrol.h b/tests/auto/qmultimedia_common/mockmediaplayercontrol.h
deleted file mode 100644
index d88409c..0000000
--- a/tests/auto/qmultimedia_common/mockmediaplayercontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKMEDIAPLAYERCONTROL_H
-#define MOCKMEDIAPLAYERCONTROL_H
-
-#include "qmediaplayercontrol.h"
-
-class MockMediaPlayerControl : public QMediaPlayerControl
-{
- friend class MockMediaPlayerService;
-
-public:
- MockMediaPlayerControl():QMediaPlayerControl(0) {}
-
- QMediaPlayer::State state() const { return _state; }
- QMediaPlayer::MediaStatus mediaStatus() const { return _mediaStatus; }
-
- qint64 duration() const { return _duration; }
-
- qint64 position() const { return _position; }
-
- void setPosition(qint64 position) { if (position != _position) emit positionChanged(_position = position); }
-
- int volume() const { return _volume; }
- void setVolume(int volume) { emit volumeChanged(_volume = volume); }
-
- bool isMuted() const { return _muted; }
- void setMuted(bool muted) { if (muted != _muted) emit mutedChanged(_muted = muted); }
-
- int bufferStatus() const { return _bufferStatus; }
-
- bool isAudioAvailable() const { return _audioAvailable; }
- bool isVideoAvailable() const { return _videoAvailable; }
-
- bool isSeekable() const { return _isSeekable; }
- QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(_seekRange.first, _seekRange.second); }
- void setSeekRange(qint64 minimum, qint64 maximum) { _seekRange = qMakePair(minimum, maximum); }
-
- qreal playbackRate() const { return _playbackRate; }
- void setPlaybackRate(qreal rate) { if (rate != _playbackRate) emit playbackRateChanged(_playbackRate = rate); }
-
- QMediaContent media() const { return _media; }
- void setMedia(const QMediaContent &content, QIODevice *stream)
- {
- _stream = stream;
- _media = content;
- if (_state != QMediaPlayer::StoppedState) {
- _mediaStatus = _media.isNull() ? QMediaPlayer::NoMedia : QMediaPlayer::LoadingMedia;
- emit stateChanged(_state = QMediaPlayer::StoppedState);
- emit mediaStatusChanged(_mediaStatus);
- }
- emit mediaChanged(_media = content);
- }
- QIODevice *mediaStream() const { return _stream; }
-
- void play() { if (_isValid && !_media.isNull() && _state != QMediaPlayer::PlayingState) emit stateChanged(_state = QMediaPlayer::PlayingState); }
- void pause() { if (_isValid && !_media.isNull() && _state != QMediaPlayer::PausedState) emit stateChanged(_state = QMediaPlayer::PausedState); }
- void stop() { if (_state != QMediaPlayer::StoppedState) emit stateChanged(_state = QMediaPlayer::StoppedState); }
-
- QMediaPlayer::State _state;
- QMediaPlayer::MediaStatus _mediaStatus;
- QMediaPlayer::Error _error;
- qint64 _duration;
- qint64 _position;
- int _volume;
- bool _muted;
- int _bufferStatus;
- bool _audioAvailable;
- bool _videoAvailable;
- bool _isSeekable;
- QPair<qint64, qint64> _seekRange;
- qreal _playbackRate;
- QMediaContent _media;
- QIODevice *_stream;
- bool _isValid;
- QString _errorString;
-};
-
-#endif // MOCKMEDIAPLAYERCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockmediaplayerservice.h b/tests/auto/qmultimedia_common/mockmediaplayerservice.h
deleted file mode 100644
index fb0f1b2..0000000
--- a/tests/auto/qmultimedia_common/mockmediaplayerservice.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKPLAYERSERVICE_H
-#define MOCKPLAYERSERVICE_H
-
-#include "qmediaservice.h"
-
-#include "mockmediaplayercontrol.h"
-#include "mockmediastreamscontrol.h"
-#include "mockmedianetworkaccesscontrol.h"
-#include "mockvideorenderercontrol.h"
-#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
-#include "mockvideowindowcontrol.h"
-#endif
-
-class MockMediaPlayerService : public QMediaService
-{
- Q_OBJECT
-
-public:
- MockMediaPlayerService():QMediaService(0)
- {
- mockControl = new MockMediaPlayerControl;
- mockStreamsControl = new MockStreamsControl;
- mockNetworkControl = new MockNetworkAccessControl;
- rendererControl = new MockVideoRendererControl;
- rendererRef = 0;
-#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
- windowControl = new MockVideoWindowControl;
- windowRef = 0;
-#endif
- }
-
- ~MockMediaPlayerService()
- {
- delete mockControl;
- delete mockStreamsControl;
- delete mockNetworkControl;
- delete rendererControl;
-#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
- delete windowControl;
-#endif
- }
-
- QMediaControl* requestControl(const char *iid)
- {
- if (qstrcmp(iid, QMediaPlayerControl_iid) == 0) {
- return mockControl;
- } else if (qstrcmp(iid, QVideoRendererControl_iid) == 0) {
- if (rendererRef == 0) {
- rendererRef += 1;
- return rendererControl;
- }
- }
-#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
- if (qstrcmp(iid, QVideoWindowControl_iid) == 0) {
- if (windowRef == 0) {
- windowRef += 1;
- return windowControl;
- }
- }
-#endif
-
- if (qstrcmp(iid, QMediaNetworkAccessControl_iid) == 0)
- return mockNetworkControl;
- return 0;
- }
-
- void releaseControl(QMediaControl *control)
- {
- if (control == rendererControl)
- rendererRef -= 1;
-#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
- if (control == windowControl)
- windowRef -= 1;
-#endif
- }
-
- void setState(QMediaPlayer::State state) { emit mockControl->stateChanged(mockControl->_state = state); }
- void setState(QMediaPlayer::State state, QMediaPlayer::MediaStatus status) {
- mockControl->_state = state;
- mockControl->_mediaStatus = status;
- emit mockControl->mediaStatusChanged(status);
- emit mockControl->stateChanged(state);
- }
- void setMediaStatus(QMediaPlayer::MediaStatus status) { emit mockControl->mediaStatusChanged(mockControl->_mediaStatus = status); }
- void setIsValid(bool isValid) { mockControl->_isValid = isValid; }
- void setMedia(QMediaContent media) { mockControl->_media = media; }
- void setDuration(qint64 duration) { mockControl->_duration = duration; }
- void setPosition(qint64 position) { mockControl->_position = position; }
- void setSeekable(bool seekable) { mockControl->_isSeekable = seekable; }
- void setVolume(int volume) { mockControl->_volume = volume; }
- void setMuted(bool muted) { mockControl->_muted = muted; }
- void setVideoAvailable(bool videoAvailable) { mockControl->_videoAvailable = videoAvailable; }
- void setBufferStatus(int bufferStatus) { mockControl->_bufferStatus = bufferStatus; }
- void setPlaybackRate(qreal playbackRate) { mockControl->_playbackRate = playbackRate; }
- void setError(QMediaPlayer::Error error) { mockControl->_error = error; emit mockControl->error(mockControl->_error, mockControl->_errorString); }
- void setErrorString(QString errorString) { mockControl->_errorString = errorString; emit mockControl->error(mockControl->_error, mockControl->_errorString); }
-
- void selectCurrentConfiguration(QNetworkConfiguration config) { mockNetworkControl->setCurrentConfiguration(config); }
-
- void reset()
- {
- mockControl->_state = QMediaPlayer::StoppedState;
- mockControl->_mediaStatus = QMediaPlayer::UnknownMediaStatus;
- mockControl->_error = QMediaPlayer::NoError;
- mockControl->_duration = 0;
- mockControl->_position = 0;
- mockControl->_volume = 0;
- mockControl->_muted = false;
- mockControl->_bufferStatus = 0;
- mockControl->_videoAvailable = false;
- mockControl->_isSeekable = false;
- mockControl->_playbackRate = 0.0;
- mockControl->_media = QMediaContent();
- mockControl->_stream = 0;
- mockControl->_isValid = false;
- mockControl->_errorString = QString();
-
- mockNetworkControl->_current = QNetworkConfiguration();
- mockNetworkControl->_configurations = QList<QNetworkConfiguration>();
- }
-
- MockMediaPlayerControl *mockControl;
- MockStreamsControl *mockStreamsControl;
- MockNetworkAccessControl *mockNetworkControl;
- MockVideoRendererControl *rendererControl;
-#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
- MockVideoWindowControl *windowControl;
- int windowRef;
-#endif
- int rendererRef;
-};
-
-
-
-#endif // MOCKPLAYERSERVICE_H
diff --git a/tests/auto/qmultimedia_common/mockmediaplaylistcontrol.h b/tests/auto/qmultimedia_common/mockmediaplaylistcontrol.h
deleted file mode 100644
index 186db69..0000000
--- a/tests/auto/qmultimedia_common/mockmediaplaylistcontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKMEDIAPLAYLISTCONTROL_H
-#define MOCKMEDIAPLAYLISTCONTROL_H
-
-#include "qmediaplaylistcontrol.h"
-#include "qmediaplaylistnavigator.h"
-
-#include "mockreadonlyplaylistprovider.h"
-
-// Hmm, read only.
-class MockMediaPlaylistControl : public QMediaPlaylistControl
-{
- Q_OBJECT
-public:
- MockMediaPlaylistControl(QObject *parent) : QMediaPlaylistControl(parent)
- {
- m_navigator = new QMediaPlaylistNavigator(new MockReadOnlyPlaylistProvider(this), this);
- }
-
- ~MockMediaPlaylistControl()
- {
- }
-
- QMediaPlaylistProvider* playlistProvider() const { return m_navigator->playlist(); }
- bool setPlaylistProvider(QMediaPlaylistProvider *newProvider)
- {
- bool bMediaContentChanged = false;
- int i = 0;
- for (; i < playlistProvider()->mediaCount(); i++) {
- if (playlistProvider()->media(i).canonicalUrl().toString() != newProvider->media(i).canonicalUrl().toString()) {
- bMediaContentChanged = true;
- break;
- }
- }
-
- if (playlistProvider()->mediaCount() != newProvider->mediaCount() || bMediaContentChanged ) {
- emit playlistProviderChanged();
- emit currentMediaChanged(newProvider->media(i));
- }
-
- m_navigator->setPlaylist(newProvider);
- return true;
- }
-
- int currentIndex() const { return m_navigator->currentIndex(); }
- void setCurrentIndex(int position)
- {
- if (position != currentIndex())
- emit currentIndexChanged(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)
- {
- if (playbackMode() != mode)
- emit playbackModeChanged(mode);
-
- m_navigator->setPlaybackMode(mode);
- }
-
-private:
- QMediaPlaylistNavigator *m_navigator;
-};
-
-#endif // MOCKMEDIAPLAYLISTCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockmediaplaylistsourcecontrol.h b/tests/auto/qmultimedia_common/mockmediaplaylistsourcecontrol.h
deleted file mode 100644
index c43ef9b..0000000
--- a/tests/auto/qmultimedia_common/mockmediaplaylistsourcecontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKMEDIAPLAYLISTSOURCECONTROL_H
-#define MOCKMEDIAPLAYLISTSOURCECONTROL_H
-
-#include "qmediaplaylistsourcecontrol.h"
-
-class MockPlaylistSourceControl : public QMediaPlaylistSourceControl
-{
- Q_OBJECT
-public:
- MockPlaylistSourceControl(QObject *parent)
- : QMediaPlaylistSourceControl(parent),
- m_playlist(0)
- {
- }
-
- ~MockPlaylistSourceControl()
- {
- }
-
- void setPlaylist(QMediaPlaylist *playlist)
- {
- m_playlist = playlist;
- }
-
- QMediaPlaylist *playlist() const
- {
- return m_playlist;
- }
-private:
- QMediaPlaylist *m_playlist;
-};
-
-#endif // MOCKMEDIAPLAYLISTSOURCECONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockmediarecordercontrol.h b/tests/auto/qmultimedia_common/mockmediarecordercontrol.h
deleted file mode 100644
index 77c1378..0000000
--- a/tests/auto/qmultimedia_common/mockmediarecordercontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKRECORDERCONTROL_H
-#define MOCKRECORDERCONTROL_H
-
-#include <QUrl>
-
-#include "qmediarecordercontrol.h"
-
-class MockMediaRecorderControl : public QMediaRecorderControl
-{
- Q_OBJECT
-
-public:
- MockMediaRecorderControl(QObject *parent = 0):
- QMediaRecorderControl(parent),
- m_state(QMediaRecorder::StoppedState),
- m_position(0),
- m_muted(false) {}
-
- QUrl outputLocation() const
- {
- return m_sink;
- }
-
- bool setOutputLocation(const QUrl &sink)
- {
- m_sink = sink;
- return true;
- }
-
- QMediaRecorder::State state() const
- {
- return m_state;
- }
-
- qint64 duration() const
- {
- return m_position;
- }
-
- bool isMuted() const
- {
- return m_muted;
- }
-
- void applySettings() {}
-
- using QMediaRecorderControl::error;
-
-public slots:
- void record()
- {
- m_state = QMediaRecorder::RecordingState;
- m_position=1;
- emit stateChanged(m_state);
- emit durationChanged(m_position);
- }
-
- void pause()
- {
- m_state = QMediaRecorder::PausedState;
- emit stateChanged(m_state);
- }
-
- void stop()
- {
- m_position=0;
- m_state = QMediaRecorder::StoppedState;
- emit stateChanged(m_state);
- }
-
- void setMuted(bool muted)
- {
- if (m_muted != muted)
- emit mutedChanged(m_muted = muted);
- }
-
-public:
- QUrl m_sink;
- QMediaRecorder::State m_state;
- qint64 m_position;
- bool m_muted;
-};
-
-#endif // MOCKRECORDERCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockmediarecorderservice.h b/tests/auto/qmultimedia_common/mockmediarecorderservice.h
deleted file mode 100644
index fa8c29a..0000000
--- a/tests/auto/qmultimedia_common/mockmediarecorderservice.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKSERVICE_H
-#define MOCKSERVICE_H
-
-#include "qmediaservice.h"
-
-#include "mockaudioencodercontrol.h"
-#include "mockmediarecordercontrol.h"
-#include "mockvideoencodercontrol.h"
-#include "mockaudioendpointselector.h"
-#include "mockmediacontainercontrol.h"
-#include "mockmetadatawritercontrol.h"
-
-class MockMediaRecorderService : public QMediaService
-{
- Q_OBJECT
-public:
- MockMediaRecorderService(QObject *parent = 0, QMediaControl *control = 0):
- QMediaService(parent),
- mockControl(control),
- hasControls(true)
- {
- mockAudioEndpointSelector = new MockAudioEndpointSelector(parent);
- mockAudioEncoderControl = new MockAudioEncoderControl(parent);
- mockFormatControl = new MockMediaContainerControl(parent);
- mockVideoEncoderControl = new MockVideoEncoderControl(parent);
- mockMetaDataControl = new MockMetaDataWriterControl(parent);
- }
-
- QMediaControl* requestControl(const char *name)
- {
- if (hasControls && qstrcmp(name,QAudioEncoderControl_iid) == 0)
- return mockAudioEncoderControl;
- if (hasControls && qstrcmp(name,QAudioEndpointSelector_iid) == 0)
- return mockAudioEndpointSelector;
- if (hasControls && qstrcmp(name,QMediaRecorderControl_iid) == 0)
- return mockControl;
- if (hasControls && qstrcmp(name,QMediaContainerControl_iid) == 0)
- return mockFormatControl;
- if (hasControls && qstrcmp(name,QVideoEncoderControl_iid) == 0)
- return mockVideoEncoderControl;
- if (hasControls && qstrcmp(name, QMetaDataWriterControl_iid) == 0)
- return mockMetaDataControl;
-
- return 0;
- }
-
- void releaseControl(QMediaControl*)
- {
- }
-
- QMediaControl *mockControl;
- QAudioEndpointSelector *mockAudioEndpointSelector;
- QAudioEncoderControl *mockAudioEncoderControl;
- QMediaContainerControl *mockFormatControl;
- QVideoEncoderControl *mockVideoEncoderControl;
- MockMetaDataWriterControl *mockMetaDataControl;
- bool hasControls;
-};
-
-#endif // MOCKSERVICE_H
diff --git a/tests/auto/qmultimedia_common/mockmediaservice.h b/tests/auto/qmultimedia_common/mockmediaservice.h
deleted file mode 100644
index 3ceb1ad..0000000
--- a/tests/auto/qmultimedia_common/mockmediaservice.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKMEDIASERVICE_H
-#define MOCKMEDIASERVICE_H
-
-#include "qmediaservice.h"
-
-class MockMediaService : public QMediaService
-{
- Q_OBJECT
-public:
- MockMediaService(QObject *parent, QMediaControl *control):
- QMediaService(parent),
- mockControl(control) {}
-
- QMediaControl* requestControl(const char *)
- {
- return mockControl;
- }
-
- void releaseControl(QMediaControl*) {}
-
- QMediaControl *mockControl;
-};
-
-
-#endif // MOCKMEDIASERVICE_H
diff --git a/tests/auto/qmultimedia_common/mockmediaserviceprovider.h b/tests/auto/qmultimedia_common/mockmediaserviceprovider.h
deleted file mode 100644
index 4573d7f..0000000
--- a/tests/auto/qmultimedia_common/mockmediaserviceprovider.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKMEDIASERVICEPROVIDER_H
-#define MOCKMEDIASERVICEPROVIDER_H
-
-#include "qmediaserviceprovider.h"
-#include "qmediaservice.h"
-
-// Simple provider that lets you set the service
-class MockMediaServiceProvider : public QMediaServiceProvider
-{
-public:
- MockMediaServiceProvider(QMediaService* s = 0, bool del=false)
- : service(s), deleteServiceOnRelease(del)
- {
- }
-
- QMediaService *requestService(const QByteArray &, const QMediaServiceProviderHint &)
- {
- return service;
- }
-
- void releaseService(QMediaService *service)
- {
- if (deleteServiceOnRelease) {
- delete service;
- service = 0;
- }
- }
-
- QMediaService *service;
- bool deleteServiceOnRelease;
-};
-
-#endif // MOCKMEDIASERVICEPROVIDER_H
diff --git a/tests/auto/qmultimedia_common/mockmediastreamscontrol.h b/tests/auto/qmultimedia_common/mockmediastreamscontrol.h
deleted file mode 100644
index d1d967d..0000000
--- a/tests/auto/qmultimedia_common/mockmediastreamscontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKMEDIASTREAMSCONTROL_H
-#define MOCKMEDIASTREAMSCONTROL_H
-
-#include "qmediastreamscontrol.h"
-
-class MockStreamsControl : public QMediaStreamsControl
-{
-public:
- MockStreamsControl(QObject *parent = 0) : QMediaStreamsControl(parent) {}
-
- int streamCount() { return _streams.count(); }
- void setStreamCount(int count) { _streams.resize(count); }
-
- StreamType streamType(int index) { return _streams.at(index).type; }
- void setStreamType(int index, StreamType type) { _streams[index].type = type; }
-
- QVariant metaData(int index, QtMultimedia::MetaData key) {
- return _streams.at(index).metaData.value(key); }
- void setMetaData(int index, QtMultimedia::MetaData key, const QVariant &value) {
- _streams[index].metaData.insert(key, value); }
-
- bool isActive(int index) { return _streams.at(index).active; }
- void setActive(int index, bool state) { _streams[index].active = state; }
-
-private:
- struct Stream
- {
- Stream() : type(UnknownStream), active(false) {}
- StreamType type;
- QMap<QtMultimedia::MetaData, QVariant> metaData;
- bool active;
- };
-
- QVector<Stream> _streams;
-};
-
-#endif // MOCKMEDIASTREAMSCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockmetadatareadercontrol.h b/tests/auto/qmultimedia_common/mockmetadatareadercontrol.h
deleted file mode 100644
index f084762..0000000
--- a/tests/auto/qmultimedia_common/mockmetadatareadercontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKMETADATAREADERCONTROL_H
-#define MOCKMETADATAREADERCONTROL_H
-
-#include "qmetadatareadercontrol.h"
-
-class MockMetaDataReaderControl : public QMetaDataReaderControl
-{
- Q_OBJECT
-public:
- MockMetaDataReaderControl(QObject *parent = 0)
- : QMetaDataReaderControl(parent)
- , m_available(false)
- {
- }
-
- bool isMetaDataAvailable() const
- {
- return m_available;
- }
- void setMetaDataAvailable(bool available)
- {
- if (m_available != available)
- emit metaDataAvailableChanged(m_available = available);
- }
- QList<QtMultimedia::MetaData> availableMetaData() const
- {
- return m_data.keys();
- }
-
- QVariant metaData(QtMultimedia::MetaData key) const
- {
- return m_data.value(key);
- }
-
- QVariant extendedMetaData(const QString &key) const
- {
- return m_extendedData.value(key);
- }
-
- QStringList availableExtendedMetaData() const
- {
- return m_extendedData.keys();
- }
-
- using QMetaDataReaderControl::metaDataChanged;
-
- void populateMetaData()
- {
- m_available = true;
- }
-
- bool m_available;
- QMap<QtMultimedia::MetaData, QVariant> m_data;
- QMap<QString, QVariant> m_extendedData;
-};
-
-#endif // MOCKMETADATAREADERCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockmetadatawritercontrol.h b/tests/auto/qmultimedia_common/mockmetadatawritercontrol.h
deleted file mode 100644
index e9f7c75..0000000
--- a/tests/auto/qmultimedia_common/mockmetadatawritercontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKMETADATAWRITERCONTROL_H
-#define MOCKMETADATAWRITERCONTROL_H
-
-#include <QObject>
-#include <QMap>
-
-#include "qmetadatawritercontrol.h"
-
-class MockMetaDataWriterControl : public QMetaDataWriterControl
-{
- Q_OBJECT
-public:
- MockMetaDataWriterControl(QObject *parent = 0)
- : QMetaDataWriterControl(parent)
- , m_available(false)
- , m_writable(false)
- {
- }
-
- bool isMetaDataAvailable() const { return m_available; }
- void setMetaDataAvailable(bool available)
- {
- if (m_available != available)
- emit metaDataAvailableChanged(m_available = available);
- }
- QList<QtMultimedia::MetaData> availableMetaData() const { return m_data.keys(); }
-
- bool isWritable() const { return m_writable; }
- void setWritable(bool writable) { emit writableChanged(m_writable = writable); }
-
- QVariant metaData(QtMultimedia::MetaData key) const { return m_data.value(key); }//Getting the metadata from Multimediakit
- void setMetaData(QtMultimedia::MetaData key, const QVariant &value)
- {
- m_data.insert(key, value);
- }
-
- QVariant extendedMetaData(const QString &key) const { return m_extendedData.value(key); }
- void setExtendedMetaData(const QString &key, const QVariant &value)
- {
- m_extendedData.insert(key, value);
- }
-
- QStringList availableExtendedMetaData() const { return m_extendedData.keys(); }
-
- using QMetaDataWriterControl::metaDataChanged;
-
- void populateMetaData()
- {
- m_available = true;
- }
- void setWritable()
- {
- emit writableChanged(true);
- }
- void setMetaDataAvailable()
- {
- emit metaDataAvailableChanged(true);
- }
-
- bool m_available;
- bool m_writable;
- QMap<QtMultimedia::MetaData, QVariant> m_data;
- QMap<QString, QVariant> m_extendedData;
-};
-
-#endif // MOCKMETADATAWRITERCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockplayer.pri b/tests/auto/qmultimedia_common/mockplayer.pri
deleted file mode 100644
index a5040ac..0000000
--- a/tests/auto/qmultimedia_common/mockplayer.pri
+++ /dev/null
@@ -1,12 +0,0 @@
-INCLUDEPATH *= $$PWD \
- ../../../src/multimedia \
- ../../../src/multimedia/audio \
- ../../../src/multimedia/video \
-
-HEADERS *= \
- ../qmultimedia_common/mockmediaplayerservice.h \
- ../qmultimedia_common/mockmediaplayercontrol.h \
- ../qmultimedia_common/mockmediastreamscontrol.h \
- ../qmultimedia_common/mockmedianetworkaccesscontrol.h
-
-include(mockvideo.pri)
diff --git a/tests/auto/qmultimedia_common/mockplaylist.pri b/tests/auto/qmultimedia_common/mockplaylist.pri
deleted file mode 100644
index c27c839..0000000
--- a/tests/auto/qmultimedia_common/mockplaylist.pri
+++ /dev/null
@@ -1,8 +0,0 @@
-INCLUDEPATH *= $$PWD \
- ../../../src/multimedia \
-
-HEADERS *= \
- ../qmultimedia_common/mockmediaplaylistsourcecontrol.h \
- ../qmultimedia_common/mockmediaplaylistcontrol.h \
- ../qmultimedia_common/mockreadonlyplaylistprovider.h \
- ../qmultimedia_common/mockplaylistservice.h
diff --git a/tests/auto/qmultimedia_common/mockplaylistservice.h b/tests/auto/qmultimedia_common/mockplaylistservice.h
deleted file mode 100644
index 3e1210c..0000000
--- a/tests/auto/qmultimedia_common/mockplaylistservice.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKPLAYLISTSERVICE_H
-#define MOCKPLAYLISTSERVICE_H
-
-#include "qmediaservice.h"
-#include "mockmediaplaylistcontrol.h"
-
-class MockPlaylistService : public QMediaService
-{
- Q_OBJECT
-
-public:
- MockPlaylistService():QMediaService(0)
- {
- mockControl = new MockMediaPlaylistControl(this);
- }
-
- ~MockPlaylistService()
- {
- }
-
- QMediaControl* requestControl(const char *iid)
- {
- if (qstrcmp(iid, QMediaPlaylistControl_iid) == 0)
- return mockControl;
- return 0;
- }
-
- void releaseControl(QMediaControl *)
- {
- }
-
- MockMediaPlaylistControl *mockControl;
-};
-
-
-#endif // MOCKPLAYLISTSERVICE_H
diff --git a/tests/auto/qmultimedia_common/mockradio.pri b/tests/auto/qmultimedia_common/mockradio.pri
deleted file mode 100644
index 0f7f84a..0000000
--- a/tests/auto/qmultimedia_common/mockradio.pri
+++ /dev/null
@@ -1,8 +0,0 @@
-
-# Radio related mock backend files
-
-INCLUDEPATH += .
-
-HEADERS += \
- ../qmultimedia_common/mockradiotunercontrol.h \
- ../qmultimedia_common/mockradiodatacontrol.h
diff --git a/tests/auto/qmultimedia_common/mockradiodatacontrol.h b/tests/auto/qmultimedia_common/mockradiodatacontrol.h
deleted file mode 100644
index ca6eb40..0000000
--- a/tests/auto/qmultimedia_common/mockradiodatacontrol.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKRADIODATACONTROL_H
-#define MOCKRADIODATACONTROL_H
-
-#include "qradiodatacontrol.h"
-
-class MockRadioDataControl : public QRadioDataControl
-{
- Q_OBJECT
-
-public:
- MockRadioDataControl(QObject *parent):
- QRadioDataControl(parent), m_err(QRadioData::NoError),
- m_errstr("")
- {
- }
-
- using QRadioDataControl::error;
-
- bool isAvailable() const
- {
- return true;
- }
- QtMultimedia::AvailabilityError availabilityError() const
- {
- return QtMultimedia::NoError;
- }
-
- QRadioData::Error error() const
- {
- return m_err;
- }
-
- QString errorString() const
- {
- return m_errstr;
- }
-
- QString stationId() const
- {
- return m_stationId;
- }
-
- QRadioData::ProgramType programType() const
- {
- return m_programType;
- }
-
- QString programTypeName() const
- {
- return m_programTypeName;
- }
-
- QString stationName() const
- {
- return m_stationName;
- }
-
- QString radioText() const
- {
- return m_radioText;
- }
-
- void setAlternativeFrequenciesEnabled(bool enabled)
- {
- m_alternativeFrequenciesEnabled = enabled;
- emit alternativeFrequenciesEnabledChanged(m_alternativeFrequenciesEnabled);
- }
-
- bool isAlternativeFrequenciesEnabled() const
- {
- return m_alternativeFrequenciesEnabled;
- }
-
- void forceRT( QString text )
- {
- m_radioText = text;
- emit radioTextChanged(m_radioText);
- }
-
- void forceProgramType( int pty )
- {
- m_programType = static_cast<QRadioData::ProgramType>(pty);
- emit programTypeChanged(m_programType);
- }
-
- void forcePTYN( QString ptyn )
- {
- m_programTypeName = ptyn;
- emit programTypeNameChanged(m_programTypeName);
- }
-
- void forcePI( QString pi )
- {
- m_stationId = pi;
- emit stationIdChanged(m_stationId);
- }
-
- void forcePS( QString ps )
- {
- m_stationName = ps;
- emit stationNameChanged(m_stationName);
- }
-
-public:
- QString m_radioText;
- QRadioData::ProgramType m_programType;
- QString m_programTypeName;
- QString m_stationId;
- QString m_stationName;
- bool m_alternativeFrequenciesEnabled;
-
- QRadioData::Error m_err;
- QString m_errstr;
-};
-
-#endif // MOCKRADIODATACONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockradiotunercontrol.h b/tests/auto/qmultimedia_common/mockradiotunercontrol.h
deleted file mode 100644
index 6648253..0000000
--- a/tests/auto/qmultimedia_common/mockradiotunercontrol.h
+++ /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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKRADIOTUNERCONTROL_H
-#define MOCKRADIOTUNERCONTROL_H
-
-#include "qradiotunercontrol.h"
-
-class MockRadioTunerControl : public QRadioTunerControl
-{
- Q_OBJECT
-
-public:
- MockRadioTunerControl(QObject *parent):
- QRadioTunerControl(parent),
- m_active(false),
- m_searching(false),m_muted(false),m_stereo(true),
- m_volume(100),m_signal(0),m_frequency(0),
- m_band(QRadioTuner::FM),m_err(QRadioTuner::NoError),
- m_errstr("")
- {
- }
-
- using QRadioTunerControl::error;
-
- QRadioTuner::State state() const
- {
- return m_active ? QRadioTuner::ActiveState : QRadioTuner::StoppedState;
- }
-
- bool isAvailable() const
- {
- return true;
- }
- QtMultimedia::AvailabilityError availabilityError() const
- {
- return QtMultimedia::NoError;
- }
-
- QRadioTuner::Band band() const
- {
- return m_band;
- }
-
- void setBand(QRadioTuner::Band b)
- {
- if (b == QRadioTuner::FM2 || b == QRadioTuner::LW) {
- m_err = QRadioTuner::OutOfRangeError;
- m_errstr.clear();
- m_errstr = QString("band and range not supported");
- } else {
- m_err = QRadioTuner::NoError;
- m_errstr.clear();
- m_band = b;
- emit bandChanged(m_band);
- }
- emit error(m_err);
-
- }
-
- bool isBandSupported(QRadioTuner::Band b) const
- {
- if (b == QRadioTuner::FM || b == QRadioTuner::AM)
- return true;
-
- return false;
- }
-
- int frequency() const
- {
- return m_frequency;
- }
-
- QPair<int,int> frequencyRange(QRadioTuner::Band) const
- {
- return qMakePair<int,int>(1,2);
- }
-
- int frequencyStep(QRadioTuner::Band) const
- {
- return 1;
- }
-
- void setFrequency(int frequency)
- {
- if (frequency >= 148500000) {
- m_err = QRadioTuner::OutOfRangeError;
- m_errstr.clear();
- m_errstr = QString("band and range not supported");
- } else {
- m_err = QRadioTuner::NoError;
- m_errstr.clear();
- m_frequency = frequency;
- emit frequencyChanged(m_frequency);
- }
-
- emit error(m_err);
- }
-
- bool isStereo() const
- {
- return m_stereo;
- }
-
- void setStereo(bool stereo)
- {
- emit stereoStatusChanged(m_stereo = stereo);
- }
-
-
- QRadioTuner::StereoMode stereoMode() const
- {
- return m_stereoMode;
- }
-
- void setStereoMode(QRadioTuner::StereoMode mode)
- {
- m_stereoMode = mode;
- }
-
- QRadioTuner::Error error() const
- {
- return m_err;
- }
-
- QString errorString() const
- {
- return m_errstr;
- }
-
- int signalStrength() const
- {
- return m_signal;
- }
-
- int volume() const
- {
- return m_volume;
- }
-
- void setVolume(int volume)
- {
- m_volume = volume;
- emit volumeChanged(m_volume);
- }
-
- bool isMuted() const
- {
- return m_muted;
- }
-
- void setMuted(bool muted)
- {
- m_muted = muted;
- emit mutedChanged(m_muted);
- }
-
- bool isSearching() const
- {
- return m_searching;
- }
-
- void searchForward()
- {
- m_searching = true;
- emit searchingChanged(m_searching);
- }
-
- void searchBackward()
- {
- m_searching = true;
- emit searchingChanged(m_searching);
- }
-
- void cancelSearch()
- {
- m_searching = false;
- emit searchingChanged(m_searching);
- }
-
- void findNewStation( int frequency, QString stationId )
- {
- setFrequency(frequency);
- emit stationFound( frequency, stationId );
- }
-
- void searchAllStations(QRadioTuner::SearchMode searchMode = QRadioTuner::SearchFast)
- {
- QString programmeIdentifiers[3] = { "", "", "" };
-
- if ( searchMode == QRadioTuner::SearchGetStationId ) {
- programmeIdentifiers[0] = QString("MockProgramPI1");
- programmeIdentifiers[1] = QString("MockProgramPI2");
- programmeIdentifiers[2] = QString("MockProgramPI3");
- }
- m_searching = true;
- emit searchingChanged(m_searching);
-
- findNewStation(88300000, programmeIdentifiers[0]);
- findNewStation(95100000, programmeIdentifiers[1]);
- findNewStation(103100000, programmeIdentifiers[2]);
-
- m_searching = false;
- emit searchingChanged(m_searching);
- }
-
- void start()
- {
- if (!m_active) {
- m_active = true;
- emit stateChanged(state());
- }
- }
-
- void stop()
- {
- if (m_active) {
- m_active = false;
- emit stateChanged(state());
- }
- }
-
-public:
- bool m_active;
- bool m_searching;
- bool m_muted;
- bool m_stereo;
- int m_volume;
- int m_signal;
- int m_frequency;
- QRadioTuner::StereoMode m_stereoMode;
- QRadioTuner::Band m_band;
- QRadioTuner::Error m_err;
- QString m_errstr;
-};
-
-#endif // MOCKRADIOTUNERCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockreadonlyplaylistprovider.h b/tests/auto/qmultimedia_common/mockreadonlyplaylistprovider.h
deleted file mode 100644
index 12e48e0..0000000
--- a/tests/auto/qmultimedia_common/mockreadonlyplaylistprovider.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKREADONLYPLAYLISTPROVIDER_H
-#define MOCKREADONLYPLAYLISTPROVIDER_H
-
-#include "qmediaplaylistprovider.h"
-
-class MockReadOnlyPlaylistProvider : public QMediaPlaylistProvider
-{
- Q_OBJECT
-public:
- MockReadOnlyPlaylistProvider(QObject *parent)
- :QMediaPlaylistProvider(parent)
- {
- m_items.append(QMediaContent(QUrl(QLatin1String("file:///1"))));
- m_items.append(QMediaContent(QUrl(QLatin1String("file:///2"))));
- m_items.append(QMediaContent(QUrl(QLatin1String("file:///3"))));
- }
-
- int mediaCount() const { return m_items.size(); }
- QMediaContent media(int index) const
- {
- return index >=0 && index < mediaCount() ? m_items.at(index) : QMediaContent();
- }
-
-private:
- QList<QMediaContent> m_items;
-};
-
-#endif // MOCKREADONLYPLAYLISTPROVIDER_H
diff --git a/tests/auto/qmultimedia_common/mockrecorder.pri b/tests/auto/qmultimedia_common/mockrecorder.pri
deleted file mode 100644
index 6f8438d..0000000
--- a/tests/auto/qmultimedia_common/mockrecorder.pri
+++ /dev/null
@@ -1,14 +0,0 @@
-INCLUDEPATH *= $$PWD \
- ../../../src/multimedia \
- ../../../src/multimedia/audio \
- ../../../src/multimedia/video \
-
-HEADERS *= \
- ../qmultimedia_common/mockmediarecorderservice.h \
- ../qmultimedia_common/mockmediarecordercontrol.h \
- ../qmultimedia_common/mockvideoencodercontrol.h \
- ../qmultimedia_common/mockaudioencodercontrol.h \
- ../qmultimedia_common/mockaudioendpointselector.h \
-
-# We also need all the container/metadata bits
-include(mockcontainer.pri)
diff --git a/tests/auto/qmultimedia_common/mockvideo.pri b/tests/auto/qmultimedia_common/mockvideo.pri
deleted file mode 100644
index ea99166..0000000
--- a/tests/auto/qmultimedia_common/mockvideo.pri
+++ /dev/null
@@ -1,14 +0,0 @@
-# video related mock backend files
-INCLUDEPATH += $$PWD \
- ../../../src/multimedia \
- ../../../src/multimedia/video
-
-contains(QT,multimediawidgets)|contains(QT,multimediawidgets-private) {
- HEADERS *= ../qmultimedia_common/mockvideowindowcontrol.h
- DEFINES *= QT_MULTIMEDIA_MOCK_WIDGETS
-}
-
-HEADERS *= \
- ../qmultimedia_common/mockvideosurface.h \
- ../qmultimedia_common/mockvideorenderercontrol.h
-
diff --git a/tests/auto/qmultimedia_common/mockvideoencodercontrol.h b/tests/auto/qmultimedia_common/mockvideoencodercontrol.h
deleted file mode 100644
index f628c67..0000000
--- a/tests/auto/qmultimedia_common/mockvideoencodercontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKVIDEOENCODERCONTROL_H
-#define MOCKVIDEOENCODERCONTROL_H
-
-#include "qvideoencodercontrol.h"
-
-class MockVideoEncoderControl : public QVideoEncoderControl
-{
- Q_OBJECT
-public:
- MockVideoEncoderControl(QObject *parent):
- QVideoEncoderControl(parent)
- {
- m_supportedEncodeOptions.insert("video/3gpp", QStringList() << "quantizer" << "me");
- m_supportedEncodeOptions.insert("video/H264", QStringList() << "quantizer" << "me" << "bframes");
- m_videoCodecs << "video/3gpp" << "video/H264";
- m_sizes << QSize(320,240) << QSize(640,480);
- m_framerates << 30 << 15 << 1;
- }
- ~MockVideoEncoderControl() {}
-
- QVideoEncoderSettings videoSettings() const { return m_videoSettings; }
- void setVideoSettings(const QVideoEncoderSettings &settings) { m_videoSettings = settings; };
-
- QList<QSize> supportedResolutions(const QVideoEncoderSettings & = QVideoEncoderSettings(),
- bool *continuous = 0) const
- {
- if (continuous)
- *continuous = true;
-
- return m_sizes;
- }
-
- QList<qreal> supportedFrameRates(const QVideoEncoderSettings & = QVideoEncoderSettings(),
- bool *continuous = 0) const
- {
- if (continuous)
- *continuous = false;
-
- return m_framerates;
- }
-
- QStringList supportedVideoCodecs() const { return m_videoCodecs; }
- QString videoCodecDescription(const QString &codecName) const { return codecName; }
-
- QStringList supportedEncodingOptions(const QString &codec) const
- {
- return m_supportedEncodeOptions.value(codec);
- }
-
- QVariant encodingOption(const QString &codec, const QString &name) const
- {
- return m_encodeOptions[codec].value(name);
- }
-
- void setEncodingOption(const QString &codec, const QString &name, const QVariant &value)
- {
- m_encodeOptions[codec][name] = value;
- }
-
-private:
- QVideoEncoderSettings m_videoSettings;
-
- QMap<QString, QStringList> m_supportedEncodeOptions;
- QMap< QString, QMap<QString, QVariant> > m_encodeOptions;
-
- QStringList m_videoCodecs;
- QList<QSize> m_sizes;
- QList<qreal> m_framerates;
-};
-
-#endif // MOCKVIDEOENCODERCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockvideorenderercontrol.h b/tests/auto/qmultimedia_common/mockvideorenderercontrol.h
deleted file mode 100644
index c98dd76..0000000
--- a/tests/auto/qmultimedia_common/mockvideorenderercontrol.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKVIDEORENDERERCONTROL_H
-#define MOCKVIDEORENDERERCONTROL_H
-
-#include "qvideorenderercontrol.h"
-
-class MockVideoRendererControl : public QVideoRendererControl
-{
-public:
- MockVideoRendererControl(QObject *parent = 0) : QVideoRendererControl(parent), m_surface(0) {}
-
- QAbstractVideoSurface *surface() const { return m_surface; }
- void setSurface(QAbstractVideoSurface *surface) { m_surface = surface; }
-
- QAbstractVideoSurface *m_surface;
-};
-
-#endif // MOCKVIDEORENDERERCONTROL_H
diff --git a/tests/auto/qmultimedia_common/mockvideosurface.h b/tests/auto/qmultimedia_common/mockvideosurface.h
deleted file mode 100644
index bbfe354..0000000
--- a/tests/auto/qmultimedia_common/mockvideosurface.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKVIDEOSURFACE_H
-#define MOCKVIDEOSURFACE_H
-
-#include "qabstractvideosurface.h"
-
-class MockVideoSurface : public QAbstractVideoSurface
-{
-public:
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- const QAbstractVideoBuffer::HandleType) const
- {
- return QList<QVideoFrame::PixelFormat>();
- }
-
- bool present(const QVideoFrame &) { return false; }
-};
-
-#endif // MOCKVIDEOSURFACE_H
diff --git a/tests/auto/qmultimedia_common/mockvideowindowcontrol.h b/tests/auto/qmultimedia_common/mockvideowindowcontrol.h
deleted file mode 100644
index 83255e2..0000000
--- a/tests/auto/qmultimedia_common/mockvideowindowcontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKVIDEOWINDOWCONTROL_H
-#define MOCKVIDEOWINDOWCONTROL_H
-
-#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
-
-#include "qvideowindowcontrol.h"
-
-class MockVideoWindowControl : public QVideoWindowControl
-{
-public:
- MockVideoWindowControl(QObject *parent = 0) : QVideoWindowControl(parent) {}
- WId winId() const { return 0; }
- void setWinId(WId) {}
- QRect displayRect() const { return QRect(); }
- void setDisplayRect(const QRect &) {}
- bool isFullScreen() const { return false; }
- void setFullScreen(bool) {}
- void repaint() {}
- QSize nativeSize() const { return QSize(); }
- Qt::AspectRatioMode aspectRatioMode() const { return Qt::KeepAspectRatio; }
- void setAspectRatioMode(Qt::AspectRatioMode) {}
- int brightness() const { return 0; }
- void setBrightness(int) {}
- int contrast() const { return 0; }
- void setContrast(int) {}
- int hue() const { return 0; }
- void setHue(int) {}
- int saturation() const { return 0; }
- void setSaturation(int) {}
-};
-
-#endif // QT_MULTIMEDIA_MOCK_WIDGETS
-#endif // MOCKVIDEOWINDOWCONTROL_H
diff --git a/tests/auto/qpaintervideosurface/qpaintervideosurface.pro b/tests/auto/qpaintervideosurface/qpaintervideosurface.pro
deleted file mode 100644
index d56a384..0000000
--- a/tests/auto/qpaintervideosurface/qpaintervideosurface.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qpaintervideosurface
-
-QT += multimedia-private multimediawidgets-private testlib
-CONFIG += no_private_qt_headers_warning
-contains(QT_CONFIG, opengl) | contains(QT_CONFIG, opengles2) {
- QT += opengl
-} else {
- DEFINES += QT_NO_OPENGL
-}
-
-contains(QT_CONFIG, opengl): QT += opengl
-
-SOURCES += tst_qpaintervideosurface.cpp
-
-# QPA-minimal and OpenGL don't get along
-qpa:CONFIG += insignificant_test
-QT+=widgets
diff --git a/tests/auto/qpaintervideosurface/tst_qpaintervideosurface.cpp b/tests/auto/qpaintervideosurface/tst_qpaintervideosurface.cpp
deleted file mode 100644
index 53ed906..0000000
--- a/tests/auto/qpaintervideosurface/tst_qpaintervideosurface.cpp
+++ /dev/null
@@ -1,1249 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <private/qpaintervideosurface_p.h>
-#include <QtTest/QtTest>
-
-#include <QtWidgets/qapplication.h>
-#include <qvideosurfaceformat.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
-#include <QtOpenGL/qgl.h>
-#include <QtOpenGL/qglframebufferobject.h>
-#endif
-
-QT_USE_NAMESPACE
-class tst_QPainterVideoSurface : public QObject
-{
- Q_OBJECT
-private slots:
- void cleanup() {}
- void cleanupTestCase() {}
-
- void colors();
-
- void supportedFormat_data();
- void supportedFormat();
-
- void present_data();
- void present();
- void presentOpaqueFrame();
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
-
- void shaderType();
-
- void shaderTypeStarted_data();
- void shaderTypeStarted();
-
- void shaderSupportedFormat_data();
- void shaderSupportedFormat();
-
- void shaderPresent_data();
- void shaderPresent();
- void shaderPresentOpaqueFrame_data();
- void shaderPresentOpaqueFrame();
- void shaderPresentGLFrame_data();
- void shaderPresentGLFrame();
-#endif
-};
-
-Q_DECLARE_METATYPE(const uchar *)
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
-Q_DECLARE_METATYPE(QPainterVideoSurface::ShaderType);
-
-class QtTestGLVideoBuffer : public QAbstractVideoBuffer
-{
-public:
- QtTestGLVideoBuffer()
- : QAbstractVideoBuffer(GLTextureHandle)
- , m_textureId(0)
- {
- glGenTextures(1, &m_textureId);
- }
-
- ~QtTestGLVideoBuffer()
- {
- glDeleteTextures(1, &m_textureId);
- }
-
- GLuint textureId() const { return m_textureId; }
-
- QVariant handle() const { return m_textureId; }
-
- uchar *map(MapMode, int *, int *) { return 0; }
- void unmap() {}
- MapMode mapMode() const { return NotMapped; }
-
-private:
- GLuint m_textureId;
-};
-
-#endif
-
-class QtTestOpaqueVideoBuffer : public QAbstractVideoBuffer
-{
-public:
- QtTestOpaqueVideoBuffer()
- : QAbstractVideoBuffer(UserHandle)
- {}
-
- uchar *map(MapMode, int *, int *) { return 0; }
- void unmap() {}
- MapMode mapMode() const { return NotMapped; }
-};
-
-void tst_QPainterVideoSurface::colors()
-{
- QPainterVideoSurface surface;
-
- QCOMPARE(surface.brightness(), 0);
- QCOMPARE(surface.contrast(), 0);
- QCOMPARE(surface.hue(), 0);
- QCOMPARE(surface.saturation(), 0);
-
- surface.setBrightness(56);
- QCOMPARE(surface.brightness(), 56);
-
- surface.setContrast(43);
- QCOMPARE(surface.contrast(), 43);
-
- surface.setHue(-84);
- QCOMPARE(surface.hue(), -84);
-
- surface.setSaturation(100);
- QCOMPARE(surface.saturation(), 100);
-}
-
-static const uchar rgb32ImageData[] =
-{
- 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00,
- 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00
-};
-
-static const uchar argb32ImageData[] =
-{
- 0x00, 0xff, 0x00, 0x00, 0xcc, 0x00, 0xff, 0xcc,
- 0x77, 0x00, 0x00, 0x77, 0x00, 0xff, 0xff, 0x00
-};
-
-static const uchar rgb24ImageData[] =
-{
- 0x00, 0xff, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00,
- 0xcc, 0x00, 0xcc, 0x77, 0xff, 0x77, 0x00, 0x00
-};
-
-static const uchar rgb565ImageData[] =
-{
- 0xff, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x00
-};
-
-static const uchar yuvPlanarImageData[] =
-{
- 0x00, 0x00, 0x0f, 0xff, 0xff, 0x0f, 0x00, 0x00,
- 0x00, 0x0f, 0xff, 0x0f, 0x0f, 0xff, 0x0f, 0x00,
- 0x00, 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0x00,
- 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff,
- 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff,
- 0x0f, 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0x0f,
- 0x00, 0x0f, 0xff, 0x0f, 0x0f, 0xff, 0x0f, 0x00,
- 0x00, 0x00, 0x0f, 0xff, 0xff, 0x0f, 0x00, 0x00,
- 0x00, 0x0f, 0x0f, 0x00,
- 0x0f, 0x00, 0x00, 0x0f,
- 0x0f, 0x00, 0x00, 0x0f,
- 0x00, 0x0f, 0x0f, 0x00,
- 0x00, 0x0f, 0x0f, 0x00,
- 0x0f, 0x00, 0x00, 0x0f,
- 0x0f, 0x00, 0x00, 0x0f,
- 0x00, 0x0f, 0x0f, 0x00,
-};
-
-void tst_QPainterVideoSurface::supportedFormat_data()
-{
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
- QTest::addColumn<QSize>("frameSize");
- QTest::addColumn<bool>("supportedPixelFormat");
- QTest::addColumn<bool>("supportedFormat");
-
- QTest::newRow("rgb32 640x480")
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB32
- << QSize(640, 480)
- << true
- << true;
- QTest::newRow("rgb32 -640x480")
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB32
- << QSize(-640, 480)
- << true
- << false;
- QTest::newRow("rgb24 1024x768")
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB24
- << QSize(1024, 768)
-#ifndef QT_OPENGL_ES
- << true
- << true;
-#else
- << false
- << false;
-#endif
- QTest::newRow("rgb24 -1024x-768")
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB24
- << QSize(-1024, -768)
-#ifndef QT_OPENGL_ES
- << true
-#else
- << false
-#endif
- << false;
- QTest::newRow("rgb565 0x0")
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB565
- << QSize(0, 0)
- << true
- << false;
- QTest::newRow("YUV420P 640x480")
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_YUV420P
- << QSize(640, 480)
- << false
- << false;
- QTest::newRow("YUV420P 640x-480")
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_YUV420P
- << QSize(640, -480)
- << false
- << false;
- QTest::newRow("Y8 640x480")
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_Y8
- << QSize(640, 480)
- << false
- << false;
- QTest::newRow("Texture: rgb32 640x480")
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_RGB32
- << QSize(640, 480)
- << false
- << false;
- QTest::newRow("Texture: rgb32 -640x480")
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_RGB32
- << QSize(-640, 480)
- << false
- << false;
- QTest::newRow("rgb565 32x32")
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB565
- << QSize(32, 32)
- << true
- << true;
- QTest::newRow("rgb565 0x0")
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB565
- << QSize(0, 0)
- << true
- << false;
- QTest::newRow("argb32 256x256")
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_ARGB32
- << QSize(256, 256)
- << true
- << true;
- QTest::newRow("Texture: rgb24 1024x768")
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_RGB24
- << QSize(1024, 768)
- << false
- << false;
- QTest::newRow("Texture: rgb24 -1024x-768")
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_RGB24
- << QSize(-1024, -768)
- << false
- << false;
- QTest::newRow("Texture: YUV420P 640x480")
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_YUV420P
- << QSize(640, 480)
- << false
- << false;
- QTest::newRow("Texture: YUV420P 640x-480")
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_YUV420P
- << QSize(640, -480)
- << false
- << false;
- QTest::newRow("User Buffer: rgb32 256x256")
- << QAbstractVideoBuffer::UserHandle
- << QVideoFrame::Format_RGB32
- << QSize(256, 256)
- << false
- << false;
-#if !defined(Q_OS_MAC)
- QTest::newRow("Pixmap: rgb32 640x480")
- << QAbstractVideoBuffer::QPixmapHandle
- << QVideoFrame::Format_RGB32
- << QSize(640, 480)
- << true
- << true;
- QTest::newRow("Pixmap: YUV420P 640x480")
- << QAbstractVideoBuffer::QPixmapHandle
- << QVideoFrame::Format_YUV420P
- << QSize(640, 480)
- << false
- << true;
-#endif
-}
-
-void tst_QPainterVideoSurface::supportedFormat()
-{
- QFETCH(QAbstractVideoBuffer::HandleType, handleType);
- QFETCH(QVideoFrame::PixelFormat, pixelFormat);
- QFETCH(QSize, frameSize);
- QFETCH(bool, supportedPixelFormat);
- QFETCH(bool, supportedFormat);
-
- QPainterVideoSurface surface;
-
- const QList<QVideoFrame::PixelFormat> pixelFormats = surface.supportedPixelFormats(handleType);
-
- QCOMPARE(pixelFormats.contains(pixelFormat), QBool(supportedPixelFormat));
-
- QVideoSurfaceFormat format(frameSize, pixelFormat, handleType);
-
- QCOMPARE(surface.isFormatSupported(format), supportedFormat);
- QCOMPARE(surface.start(format), supportedFormat);
-}
-
-void tst_QPainterVideoSurface::present_data()
-{
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormatA");
- QTest::addColumn<QSize>("frameSizeA");
- QTest::addColumn<const uchar *>("frameDataA");
- QTest::addColumn<int>("bytesA");
- QTest::addColumn<int>("bytesPerLineA");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormatB");
- QTest::addColumn<QSize>("frameSizeB");
- QTest::addColumn<const uchar *>("frameDataB");
- QTest::addColumn<int>("bytesB");
- QTest::addColumn<int>("bytesPerLineB");
-
- QTest::newRow("rgb32 -> argb32")
- << QVideoFrame::Format_RGB32
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb32ImageData)
- << int(sizeof(rgb32ImageData))
- << 8
- << QVideoFrame::Format_ARGB32
- << QSize(2, 2)
- << static_cast<const uchar *>(argb32ImageData)
- << int(sizeof(argb32ImageData))
- << 8;
-
-#ifndef QT_OPENGL_ES
- QTest::newRow("rgb32 -> rgb24")
- << QVideoFrame::Format_RGB32
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb32ImageData)
- << int(sizeof(rgb32ImageData))
- << 8
- << QVideoFrame::Format_RGB24
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb24ImageData)
- << int(sizeof(rgb24ImageData))
- << 8;
-#endif
-
- QTest::newRow("rgb32 -> rgb565")
- << QVideoFrame::Format_RGB32
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb32ImageData)
- << int(sizeof(rgb32ImageData))
- << 8
- << QVideoFrame::Format_RGB565
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb565ImageData)
- << int(sizeof(rgb565ImageData))
- << 4;
-
-#ifndef QT_OPENGL_ES
- QTest::newRow("rgb24 -> rgb565")
- << QVideoFrame::Format_RGB24
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb24ImageData)
- << int(sizeof(rgb24ImageData))
- << 8
- << QVideoFrame::Format_RGB565
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb565ImageData)
- << int(sizeof(rgb565ImageData))
- << 4;
-#endif
-}
-
-void tst_QPainterVideoSurface::present()
-{
- QFETCH(QVideoFrame::PixelFormat, pixelFormatA);
- QFETCH(QSize, frameSizeA);
- QFETCH(const uchar *, frameDataA);
- QFETCH(int, bytesA);
- QFETCH(int, bytesPerLineA);
- QFETCH(QVideoFrame::PixelFormat, pixelFormatB);
- QFETCH(QSize, frameSizeB);
- QFETCH(const uchar *, frameDataB);
- QFETCH(int, bytesB);
- QFETCH(int, bytesPerLineB);
-
- QPainterVideoSurface surface;
-
- QImage image(320, 240, QImage::Format_RGB32);
-
- QSignalSpy frameSpy(&surface, SIGNAL(frameChanged()));
-
- const QList<QVideoFrame::PixelFormat> pixelFormats = surface.supportedPixelFormats();
-
- { // Test painting before started.
- QPainter painter(&image);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
-
- QVideoSurfaceFormat formatA(frameSizeA, pixelFormatA);
-
- QVERIFY(surface.start(formatA));
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), true);
-
- { // Test painting before receiving a frame.
- QPainter painter(&image);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
- QCOMPARE(surface.error(), QAbstractVideoSurface::NoError);
-
- QVideoFrame frameA(bytesA, frameSizeA, bytesPerLineA, pixelFormatA);
-
- frameA.map(QAbstractVideoBuffer::WriteOnly);
- memcpy(frameA.bits(), frameDataA, frameA.mappedBytes());
- frameA.unmap();
-
- QVERIFY(surface.present(frameA));
- QCOMPARE(surface.isReady(), false);
- QCOMPARE(frameSpy.count(), 1);
-
- {
- QPainter painter(&image);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), false);
-
- { // Test repainting before receiving another frame.
- QPainter painter(&image);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), false);
-
- // Not ready.
- QVERIFY(!surface.present(frameA));
- QCOMPARE(frameSpy.count(), 1);
-
- surface.setReady(true);
- QCOMPARE(surface.isReady(), true);
- QVERIFY(surface.present(frameA));
- QCOMPARE(frameSpy.count(), 2);
-
- // Try switching to a different format after starting.
- QVideoSurfaceFormat formatB(frameSizeB, pixelFormatB);
-
- QVERIFY(surface.start(formatB));
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), true);
-
- QVideoFrame frameB(bytesB, frameSizeB, bytesPerLineB, pixelFormatB);
-
- frameB.map(QAbstractVideoBuffer::WriteOnly);
- memcpy(frameB.bits(), frameDataB, frameB.mappedBytes());
- frameB.unmap();
-
- QVERIFY(surface.present(frameB));
- QCOMPARE(surface.isReady(), false);
- QCOMPARE(frameSpy.count(), 3);
-
- {
- QPainter painter(&image);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
- QVERIFY(surface.isActive());
-
- surface.stop();
-
- QCOMPARE(surface.isActive(), false);
- QCOMPARE(surface.isReady(), false);
-
- // Try presenting a frame while stopped.
- QVERIFY(!surface.present(frameB));
- QCOMPARE(surface.isReady(), false);
- QCOMPARE(surface.error(), QAbstractVideoSurface::StoppedError);
-
- // Try presenting a frame with a different format.
- QVERIFY(surface.start(formatB));
- QVERIFY(!surface.present(frameA));
- QCOMPARE(surface.isActive(), false);
- QCOMPARE(surface.isReady(), false);
- QCOMPARE(surface.error(), QAbstractVideoSurface::IncorrectFormatError);
-}
-
-void tst_QPainterVideoSurface::presentOpaqueFrame()
-{
- QPainterVideoSurface surface;
-
- QImage image(320, 240, QImage::Format_RGB32);
-
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
-
- QVERIFY(surface.start(format));
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), true);
-
- QVideoFrame frame(new QtTestOpaqueVideoBuffer, QSize(64, 64), QVideoFrame::Format_RGB32);
-
- if (surface.present(frame)) {
- QPainter painter(&image);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
-
- QCOMPARE(surface.isActive(), false);
- QCOMPARE(surface.isReady(), false);
- QCOMPARE(surface.error(), QAbstractVideoSurface::IncorrectFormatError);
-}
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
-
-void tst_QPainterVideoSurface::shaderType()
-{
- QPainterVideoSurface surface;
- QGLWidget widget;
- widget.makeCurrent();
-
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
- QCOMPARE(surface.supportedShaderTypes(), QPainterVideoSurface::NoShaders);
-
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
- QCOMPARE(surface.glContext(), widget.context());
-
- {
- QSignalSpy spy(&surface, SIGNAL(supportedFormatsChanged()));
-
- surface.setShaderType(QPainterVideoSurface::NoShaders);
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
- QCOMPARE(spy.count(), 0);
- }
-
-#ifndef QT_OPENGL_ES
- if (surface.supportedShaderTypes() & QPainterVideoSurface::FragmentProgramShader) {
- QSignalSpy spy(&surface, SIGNAL(supportedFormatsChanged()));
-
- surface.setShaderType(QPainterVideoSurface::FragmentProgramShader);
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::FragmentProgramShader);
- QCOMPARE(spy.count(), 1);
-
- surface.setShaderType(QPainterVideoSurface::FragmentProgramShader);
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::FragmentProgramShader);
- QCOMPARE(spy.count(), 1);
- }
-#endif
-
- if (surface.supportedShaderTypes() & QPainterVideoSurface::GlslShader) {
- QSignalSpy spy(&surface, SIGNAL(supportedFormatsChanged()));
-
- surface.setShaderType(QPainterVideoSurface::GlslShader);
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::GlslShader);
- QCOMPARE(spy.count(), 1);
-
- surface.setShaderType(QPainterVideoSurface::GlslShader);
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::GlslShader);
- QCOMPARE(spy.count(), 1);
- }
-
- {
- QSignalSpy spy(&surface, SIGNAL(supportedFormatsChanged()));
-
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
- QCOMPARE(surface.glContext(), widget.context());
- QCOMPARE(spy.count(), 0);
- }
-
- surface.setGLContext(0);
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
- QCOMPARE(surface.supportedShaderTypes(), QPainterVideoSurface::NoShaders);
-
- {
- QSignalSpy spy(&surface, SIGNAL(supportedFormatsChanged()));
-
- surface.setShaderType(QPainterVideoSurface::NoShaders);
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
- QCOMPARE(spy.count(), 0);
-
-#ifndef QT_OPENGL_ES
- surface.setShaderType(QPainterVideoSurface::FragmentProgramShader);
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
- QCOMPARE(spy.count(), 0);
-#endif
-
- surface.setShaderType(QPainterVideoSurface::GlslShader);
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
- QCOMPARE(spy.count(), 0);
- }
-}
-
-void tst_QPainterVideoSurface::shaderTypeStarted_data()
-{
- QTest::addColumn<QPainterVideoSurface::ShaderType>("shaderType");
-
-#ifndef QT_OPENGL_ES
- QTest::newRow("ARBfp")
- << QPainterVideoSurface::FragmentProgramShader;
-#endif
- QTest::newRow("GLSL")
- << QPainterVideoSurface::GlslShader;
-}
-
-void tst_QPainterVideoSurface::shaderTypeStarted()
-{
- QFETCH(QPainterVideoSurface::ShaderType, shaderType);
-
- QGLWidget widget;
- widget.makeCurrent();
-
- QPainterVideoSurface surface;
-
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
-
- if (!(surface.supportedShaderTypes() & shaderType))
- QSKIP("Shader type unsupported on this platform", SkipSingle);
-
- surface.setShaderType(shaderType);
- QCOMPARE(surface.shaderType(), shaderType);
-
- QVERIFY(surface.start(QVideoSurfaceFormat(QSize(640, 480), QVideoFrame::Format_RGB32)));
- {
- QSignalSpy spy(&surface, SIGNAL(activeChanged(bool)));
-
- surface.setShaderType(QPainterVideoSurface::NoShaders);
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
- QCOMPARE(surface.isActive(), false);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.last().value(0).toBool(), false);
- }
-
- QVERIFY(surface.start(QVideoSurfaceFormat(QSize(640, 480), QVideoFrame::Format_RGB32)));
- {
- QSignalSpy spy(&surface, SIGNAL(activeChanged(bool)));
-
- surface.setShaderType(QPainterVideoSurface::NoShaders);
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(spy.count(), 0);
-
- surface.setShaderType(shaderType);
- QCOMPARE(surface.shaderType(), shaderType);
- QCOMPARE(surface.isActive(), false);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.last().value(0).toBool(), false);
- }
-
- QVERIFY(surface.start(QVideoSurfaceFormat(QSize(640, 480), QVideoFrame::Format_RGB32)));
- {
- QSignalSpy spy(&surface, SIGNAL(activeChanged(bool)));
-
- surface.setShaderType(shaderType);
- QCOMPARE(surface.shaderType(), shaderType);
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(spy.count(), 0);
-
- surface.setGLContext(0);
- QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
- QCOMPARE(surface.isActive(), false);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.last().value(0).toBool(), false);
- }
-}
-
-void tst_QPainterVideoSurface::shaderSupportedFormat_data()
-{
- QTest::addColumn<QPainterVideoSurface::ShaderType>("shaderType");
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
- QTest::addColumn<QSize>("frameSize");
- QTest::addColumn<bool>("supportedPixelFormat");
- QTest::addColumn<bool>("supportedFormat");
-
- QList<QPair<QPainterVideoSurface::ShaderType, QByteArray> > types;
-
-
-#ifndef QT_OPENGL_ES
- types << qMakePair(QPainterVideoSurface::FragmentProgramShader, QByteArray("ARBfp: "));
-#endif
- types << qMakePair(QPainterVideoSurface::GlslShader, QByteArray("GLSL: "));
-
- QPair<QPainterVideoSurface::ShaderType, QByteArray> type;
- foreach (type, types) {
- QTest::newRow((type.second + "rgb32 640x480").constData())
- << type.first
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB32
- << QSize(640, 480)
- << true
- << true;
- QTest::newRow((type.second + "rgb32 -640x480").constData())
- << type.first
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB32
- << QSize(-640, 480)
- << true
- << false;
- QTest::newRow((type.second + "rgb565 32x32").constData())
- << type.first
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB565
- << QSize(32, 32)
- << true
- << true;
- QTest::newRow((type.second + "rgb565 0x0").constData())
- << type.first
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB565
- << QSize(0, 0)
- << true
- << false;
- QTest::newRow((type.second + "argb32 256x256").constData())
- << type.first
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_ARGB32
- << QSize(256, 256)
- << true
- << true;
- QTest::newRow((type.second + "rgb24 1024x768").constData())
- << type.first
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB24
- << QSize(1024, 768)
-#ifndef QT_OPENGL_ES
- << true
- << true;
-#else
- << false
- << false;
-#endif
- QTest::newRow((type.second + "rgb24 -1024x-768").constData())
- << type.first
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_RGB24
- << QSize(-1024, -768)
-#ifndef QT_OPENGL_ES
- << true
-#else
- << false
-#endif
- << false;
-#ifndef Q_WS_MAC
- QTest::newRow((type.second + "YUV420P 640x480").constData())
- << type.first
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_YUV420P
- << QSize(640, 480)
- << true
- << true;
- QTest::newRow((type.second + "YUV420P 640x-480").constData())
- << type.first
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_YUV420P
- << QSize(640, -480)
- << true
- << false;
-#endif
- QTest::newRow((type.second + "Y8 640x480").constData())
- << type.first
- << QAbstractVideoBuffer::NoHandle
- << QVideoFrame::Format_Y8
- << QSize(640, 480)
- << false
- << false;
- QTest::newRow((type.second + "Texture: rgb32 640x480").constData())
- << type.first
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_RGB32
- << QSize(640, 480)
- << true
- << true;
- QTest::newRow((type.second + "Texture: rgb32 -640x480").constData())
- << type.first
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_RGB32
- << QSize(-640, 480)
- << true
- << false;
-#ifndef Q_WS_MAC
- QTest::newRow((type.second + "Texture: rgb565 32x32").constData())
- << type.first
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_RGB565
- << QSize(32, 32)
- << false
- << false;
- QTest::newRow((type.second + "Texture: rgb565 0x0").constData())
- << type.first
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_RGB565
- << QSize(0, 0)
- << false
- << false;
-#endif
- QTest::newRow((type.second + "Texture argb32 256x256").constData())
- << type.first
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_ARGB32
- << QSize(256, 256)
- << true
- << true;
-#ifndef Q_WS_MAC
- QTest::newRow((type.second + "Texture: rgb24 1024x768").constData())
- << type.first
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_RGB24
- << QSize(1024, 768)
- << false
- << false;
- QTest::newRow((type.second + "Texture: rgb24 -1024x-768").constData())
- << type.first
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_RGB24
- << QSize(-1024, -768)
- << false
- << false;
- QTest::newRow((type.second + "Texture: YUV420P 640x480").constData())
- << type.first
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_YUV420P
- << QSize(640, 480)
- << false
- << false;
- QTest::newRow((type.second + "Texture: YUV420P 640x-480").constData())
- << type.first
- << QAbstractVideoBuffer::GLTextureHandle
- << QVideoFrame::Format_YUV420P
- << QSize(640, -480)
- << false
- << false;
-#endif
- QTest::newRow(type.second + "User Buffer: rgb32 256x256")
- << type.first
- << QAbstractVideoBuffer::UserHandle
- << QVideoFrame::Format_RGB32
- << QSize(256, 256)
- << false
- << false;
- }
-}
-
-void tst_QPainterVideoSurface::shaderSupportedFormat()
-{
- QFETCH(QPainterVideoSurface::ShaderType, shaderType);
- QFETCH(QAbstractVideoBuffer::HandleType, handleType);
- QFETCH(QVideoFrame::PixelFormat, pixelFormat);
- QFETCH(QSize, frameSize);
- QFETCH(bool, supportedPixelFormat);
- QFETCH(bool, supportedFormat);
-
- QGLWidget widget;
- widget.makeCurrent();
-
- QPainterVideoSurface surface;
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
-
-
- if (!(surface.supportedShaderTypes() & shaderType))
- QSKIP("Shader type not supported on this platform", SkipSingle);
-
- surface.setShaderType(shaderType);
- if (surface.shaderType() != shaderType)
- QSKIP("Shader type couldn't be set", SkipSingle);
-
- const QList<QVideoFrame::PixelFormat> pixelFormats = surface.supportedPixelFormats(handleType);
-
- QCOMPARE(pixelFormats.contains(pixelFormat), QBool(supportedPixelFormat));
-
- QVideoSurfaceFormat format(frameSize, pixelFormat, handleType);
-
- QCOMPARE(surface.isFormatSupported(format), supportedFormat);
- QCOMPARE(surface.start(format), supportedFormat);
-}
-
-void tst_QPainterVideoSurface::shaderPresent_data()
-{
- QTest::addColumn<QPainterVideoSurface::ShaderType>("shaderType");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormatA");
- QTest::addColumn<QSize>("frameSizeA");
- QTest::addColumn<const uchar *>("frameDataA");
- QTest::addColumn<int>("bytesA");
- QTest::addColumn<int>("bytesPerLineA");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormatB");
- QTest::addColumn<QSize>("frameSizeB");
- QTest::addColumn<const uchar *>("frameDataB");
- QTest::addColumn<int>("bytesB");
- QTest::addColumn<int>("bytesPerLineB");
-
- QList<QPair<QPainterVideoSurface::ShaderType, QByteArray> > types;
-#ifndef QT_OPENGL_ES
- types << qMakePair(QPainterVideoSurface::FragmentProgramShader, QByteArray("ARBfp: "));
-#endif
- types << qMakePair(QPainterVideoSurface::GlslShader, QByteArray("GLSL: "));
-
- QPair<QPainterVideoSurface::ShaderType, QByteArray> type;
- foreach (type, types) {
- QTest::newRow((type.second + "rgb32 -> argb32").constData())
- << type.first
- << QVideoFrame::Format_RGB32
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb32ImageData)
- << int(sizeof(rgb32ImageData))
- << 8
- << QVideoFrame::Format_ARGB32
- << QSize(2, 2)
- << static_cast<const uchar *>(argb32ImageData)
- << int(sizeof(argb32ImageData))
- << 8;
-
- QTest::newRow((type.second + "rgb32 -> rgb565").constData())
- << type.first
- << QVideoFrame::Format_RGB32
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb32ImageData)
- << int(sizeof(rgb32ImageData))
- << 8
- << QVideoFrame::Format_RGB565
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb565ImageData)
- << int(sizeof(rgb565ImageData))
- << 4;
-#ifndef Q_WS_MAC
- QTest::newRow((type.second + "rgb32 -> yuv420p").constData())
- << type.first
- << QVideoFrame::Format_RGB32
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb32ImageData)
- << int(sizeof(rgb32ImageData))
- << 8
- << QVideoFrame::Format_YUV420P
- << QSize(8, 8)
- << static_cast<const uchar *>(yuvPlanarImageData)
- << int(sizeof(yuvPlanarImageData))
- << 8;
-
- QTest::newRow((type.second + "yv12 -> rgb32").constData())
- << type.first
- << QVideoFrame::Format_YV12
- << QSize(8, 8)
- << static_cast<const uchar *>(yuvPlanarImageData)
- << int(sizeof(yuvPlanarImageData))
- << 8
- << QVideoFrame::Format_RGB32
- << QSize(2, 2)
- << static_cast<const uchar *>(rgb32ImageData)
- << int(sizeof(rgb32ImageData))
- << 8;
-#endif
- }
-}
-
-void tst_QPainterVideoSurface::shaderPresent()
-{
- QFETCH(QPainterVideoSurface::ShaderType, shaderType);
- QFETCH(QVideoFrame::PixelFormat, pixelFormatA);
- QFETCH(QSize, frameSizeA);
- QFETCH(const uchar *, frameDataA);
- QFETCH(int, bytesA);
- QFETCH(int, bytesPerLineA);
- QFETCH(QVideoFrame::PixelFormat, pixelFormatB);
- QFETCH(QSize, frameSizeB);
- QFETCH(const uchar *, frameDataB);
- QFETCH(int, bytesB);
- QFETCH(int, bytesPerLineB);
-
- QGLWidget widget;
- widget.makeCurrent();
-
- QPainterVideoSurface surface;
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
-
- if (!(surface.supportedShaderTypes() & shaderType))
- QSKIP("Shader type unsupported on this platform", SkipSingle);
-
- surface.setShaderType(shaderType);
- if (surface.shaderType() != shaderType)
- QSKIP("Shader type couldn't be set", SkipSingle);
-
- QSignalSpy frameSpy(&surface, SIGNAL(frameChanged()));
-
- { // Test painting before starting the surface.
- QPainter painter(&widget);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
- QCOMPARE(surface.error(), QAbstractVideoSurface::NoError);
-
- QVideoSurfaceFormat formatA(frameSizeA, pixelFormatA);
-
- QVERIFY(surface.start(formatA));
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), true);
-
- // Test painting before receiving a frame.
- {
- QPainter painter(&widget);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), true);
-
- QVideoFrame frameA(bytesA, frameSizeA, bytesPerLineA, pixelFormatA);
-
- frameA.map(QAbstractVideoBuffer::WriteOnly);
- memcpy(frameA.bits(), frameDataA, frameA.mappedBytes());
- frameA.unmap();
-
- QVERIFY(surface.present(frameA));
- QCOMPARE(surface.isReady(), false);
- QCOMPARE(frameSpy.count(), 1);
-
- {
- QPainter painter(&widget);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), false);
-
- { // Test repainting before receiving another frame.
- QPainter painter(&widget);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), false);
-
- // Not ready.
- QVERIFY(!surface.present(frameA));
- QCOMPARE(frameSpy.count(), 1);
-
- surface.setReady(true);
- QCOMPARE(surface.isReady(), true);
- QVERIFY(surface.present(frameA));
- QCOMPARE(frameSpy.count(), 2);
-
- // Try switching to a different format after starting.
- QVideoSurfaceFormat formatB(frameSizeB, pixelFormatB);
-
- QVERIFY(surface.start(formatB));
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), true);
-
- QVideoFrame frameB(bytesB, frameSizeB, bytesPerLineB, pixelFormatB);
-
- frameB.map(QAbstractVideoBuffer::WriteOnly);
- memcpy(frameB.bits(), frameDataB, frameB.mappedBytes());
- frameB.unmap();
-
- QVERIFY(surface.present(frameB));
- QCOMPARE(surface.isReady(), false);
- QCOMPARE(frameSpy.count(), 3);
-
- {
- QPainter painter(&widget);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
- QCOMPARE(surface.isActive(), true);
-
- surface.stop();
- QCOMPARE(surface.isActive(), false);
- QCOMPARE(surface.isReady(), false);
-
- // Try presenting a frame while stopped.
- QVERIFY(!surface.present(frameB));
- QCOMPARE(surface.isReady(), false);
- QCOMPARE(surface.error(), QAbstractVideoSurface::StoppedError);
-
- // Try stopping while already stopped.
- surface.stop();
- QCOMPARE(surface.isActive(), false);
- QCOMPARE(surface.isReady(), false);
-
- // Try presenting a frame with a different format.
- QVERIFY(surface.start(formatB));
- QVERIFY(!surface.present(frameA));
- QCOMPARE(surface.isActive(), false);
- QCOMPARE(surface.isReady(), false);
- QCOMPARE(surface.error(), QAbstractVideoSurface::IncorrectFormatError);
-}
-
-void tst_QPainterVideoSurface::shaderPresentOpaqueFrame_data()
-{
- QTest::addColumn<QPainterVideoSurface::ShaderType>("shaderType");
-
-#ifndef QT_OPENGL_ES
- QTest::newRow("ARBfp")
- << QPainterVideoSurface::FragmentProgramShader;
-#endif
- QTest::newRow("GLSL")
- << QPainterVideoSurface::GlslShader;
-}
-
-void tst_QPainterVideoSurface::shaderPresentOpaqueFrame()
-{
- QFETCH(QPainterVideoSurface::ShaderType, shaderType);
-
- QGLWidget widget;
- widget.makeCurrent();
-
- QPainterVideoSurface surface;
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
-
- if (!(surface.supportedShaderTypes() & shaderType))
- QSKIP("Shader type unsupported on this platform", SkipSingle);
-
- surface.setShaderType(shaderType);
- if (surface.shaderType() != shaderType)
- QSKIP("Shader type couldn't be set", SkipSingle);
-
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
-
- QVERIFY(surface.start(format));
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), true);
-
- QVideoFrame frame(new QtTestOpaqueVideoBuffer, QSize(64, 64), QVideoFrame::Format_RGB32);
-
- if (surface.present(frame)) {
- QPainter painter(&widget);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
-
- QCOMPARE(surface.isActive(), false);
- QCOMPARE(surface.isReady(), false);
- QCOMPARE(surface.error(), QAbstractVideoSurface::IncorrectFormatError);
-}
-
-void tst_QPainterVideoSurface::shaderPresentGLFrame_data()
-{
- QTest::addColumn<QPainterVideoSurface::ShaderType>("shaderType");
-
-#ifndef QT_OPENGL_ES
- QTest::newRow("ARBfp")
- << QPainterVideoSurface::FragmentProgramShader;
-#endif
- QTest::newRow("GLSL")
- << QPainterVideoSurface::GlslShader;
-}
-
-void tst_QPainterVideoSurface::shaderPresentGLFrame()
-{
- QFETCH(QPainterVideoSurface::ShaderType, shaderType);
-
- QGLWidget widget;
- widget.makeCurrent();
-
- QPainterVideoSurface surface;
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
-
- if (!(surface.supportedShaderTypes() & shaderType))
- QSKIP("Shader type unsupported on this platform", SkipSingle);
-
- surface.setShaderType(shaderType);
- if (surface.shaderType() != shaderType)
- QSKIP("Shader type couldn't be set", SkipSingle);
-
- QVideoSurfaceFormat format(
- QSize(2, 2), QVideoFrame::Format_RGB32, QAbstractVideoBuffer::GLTextureHandle);
-
- QVERIFY(surface.start(format));
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), true);
-
- QtTestGLVideoBuffer *buffer = new QtTestGLVideoBuffer;
-
- glBindTexture(GL_TEXTURE_2D, buffer->textureId());
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, rgb32ImageData);
- 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_REPEAT);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-
- QVideoFrame frame(buffer, QSize(2, 2), QVideoFrame::Format_RGB32);
-
- QVERIFY(surface.present(frame));
-
- {
- QPainter painter(&widget);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
-
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), false);
-
- {
- QPainter painter(&widget);
- surface.paint(&painter, QRect(0, 0, 320, 240));
- }
-
- QCOMPARE(surface.isActive(), true);
- QCOMPARE(surface.isReady(), false);
-}
-
-#endif
-
-QTEST_MAIN(tst_QPainterVideoSurface)
-
-#include "tst_qpaintervideosurface.moc"
diff --git a/tests/auto/qradiodata/main.cpp b/tests/auto/qradiodata/main.cpp
deleted file mode 100755
index 1bd2e27..0000000
--- a/tests/auto/qradiodata/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-
-#include "tst_qradiodata.h"
-
-int main(int argc, char**argv)
-{
- QCoreApplication app(argc,argv);
- int ret;
- tst_QRadioData test_api;
- ret = QTest::qExec(&test_api, argc, argv);
- return ret;
-}
diff --git a/tests/auto/qradiodata/qradiodata.pro b/tests/auto/qradiodata/qradiodata.pro
deleted file mode 100644
index 0e3c4ed..0000000
--- a/tests/auto/qradiodata/qradiodata.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qradiodata
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-HEADERS += tst_qradiodata.h
-SOURCES += main.cpp tst_qradiodata.cpp
-
-include (../qmultimedia_common/mock.pri)
-include (../qmultimedia_common/mockradio.pri)
diff --git a/tests/auto/qradiodata/tst_qradiodata.cpp b/tests/auto/qradiodata/tst_qradiodata.cpp
deleted file mode 100644
index 157f63d..0000000
--- a/tests/auto/qradiodata/tst_qradiodata.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 "tst_qradiodata.h"
-
-QT_USE_NAMESPACE
-
-void tst_QRadioData::initTestCase()
-{
- qRegisterMetaType<QRadioData::ProgramType>("QRadioData::ProgramType");
-
- mock = new MockRadioDataControl(this);
- service = new MockMediaService(this, mock);
- provider = new MockMediaServiceProvider(service);
- radio = new QRadioData(0,provider);
- QVERIFY(radio->service() != 0);
- QVERIFY(radio->isAvailable());
- QVERIFY(radio->availabilityError() == QtMultimedia::NoError);
-}
-
-void tst_QRadioData::cleanupTestCase()
-{
- QVERIFY(radio->error() == QRadioData::NoError);
- QVERIFY(radio->errorString().isEmpty());
-
- delete radio;
- delete service;
- delete provider;
-}
-
-void tst_QRadioData::testNullService()
-{
- const QPair<int, int> nullRange(0, 0);
-
- MockMediaServiceProvider provider(0);
- QRadioData radio(0, &provider);
- QVERIFY(!radio.isAvailable());
- QCOMPARE(radio.error(), QRadioData::ResourceError);
- QCOMPARE(radio.errorString(), QString());
- QCOMPARE(radio.stationId(), QString());
- QCOMPARE(radio.programType(), QRadioData::Undefined);
- QCOMPARE(radio.programTypeName(), QString());
- QCOMPARE(radio.stationName(), QString());
- QCOMPARE(radio.radioText(), QString());
- QCOMPARE(radio.isAlternativeFrequenciesEnabled(), false);
-
-}
-
-void tst_QRadioData::testNullControl()
-{
- const QPair<int, int> nullRange(0, 0);
-
- MockMediaService service(0, 0);
- MockMediaServiceProvider provider(&service);
- QRadioData radio(0, &provider);
- QVERIFY(!radio.isAvailable());
- QCOMPARE(radio.error(), QRadioData::ResourceError);
- QCOMPARE(radio.errorString(), QString());
-
- QCOMPARE(radio.stationId(), QString());
- QCOMPARE(radio.programType(), QRadioData::Undefined);
- QCOMPARE(radio.programTypeName(), QString());
- QCOMPARE(radio.stationName(), QString());
- QCOMPARE(radio.radioText(), QString());
- QCOMPARE(radio.isAlternativeFrequenciesEnabled(), false);
- {
- QSignalSpy spy(&radio, SIGNAL(alternativeFrequenciesEnabledChanged(bool)));
-
- radio.setAlternativeFrequenciesEnabled(true);
- QCOMPARE(radio.isAlternativeFrequenciesEnabled(), false);
- QCOMPARE(spy.count(), 0);
- }
-}
-
-void tst_QRadioData::testAlternativeFrequencies()
-{
- QSignalSpy readSignal(radio, SIGNAL(alternativeFrequenciesEnabledChanged(bool)));
- radio->setAlternativeFrequenciesEnabled(true);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(radio->isAlternativeFrequenciesEnabled() == true);
- QVERIFY(readSignal.count() == 1);
-}
-
-void tst_QRadioData::testRadioDataUpdates()
-{
- QSignalSpy rtSpy(radio, SIGNAL(radioTextChanged(QString)));
- QSignalSpy ptyPTYSpy(radio, SIGNAL(programTypeChanged(QRadioData::ProgramType)));
- QSignalSpy ptynSpy(radio, SIGNAL(programTypeNameChanged(QString)));
- QSignalSpy piSpy(radio, SIGNAL(stationIdChanged(QString)));
- QSignalSpy psSpy(radio, SIGNAL(stationNameChanged(QString)));
- mock->forceRT("Mock Radio Text");
- mock->forceProgramType(static_cast<int>(QRadioData::Sport));
- mock->forcePTYN("Mock Programme Type Name");
- mock->forcePI("Mock Programme Identification");
- mock->forcePS("Mock Programme Service");
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(rtSpy.count() == 1);
- QVERIFY(ptyPTYSpy.count() == 1);
- QVERIFY(ptynSpy.count() == 1);
- QVERIFY(piSpy.count() == 1);
- QVERIFY(psSpy.count() == 1);
- qDebug()<<radio->radioText();
- QCOMPARE(radio->radioText(), QString("Mock Radio Text"));
- QCOMPARE(radio->programType(), QRadioData::Sport);
- QCOMPARE(radio->programTypeName(), QString("Mock Programme Type Name"));
- QCOMPARE(radio->stationId(), QString("Mock Programme Identification"));
- QCOMPARE(radio->stationName(), QString("Mock Programme Service"));
-}
diff --git a/tests/auto/qradiodata/tst_qradiodata.h b/tests/auto/qradiodata/tst_qradiodata.h
deleted file mode 100644
index 9851975..0000000
--- a/tests/auto/qradiodata/tst_qradiodata.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 TST_QRADIODATA_H
-#define TST_QRADIODATA_H
-
-#include <QtTest/QtTest>
-#include <QDebug>
-#include <QTimer>
-
-#include <qmediaobject.h>
-#include <qmediacontrol.h>
-#include <qmediaservice.h>
-#include <qradiodatacontrol.h>
-#include <qradiodata.h>
-
-#include "mockmediaserviceprovider.h"
-#include "mockmediaservice.h"
-#include "mockradiodatacontrol.h"
-
-QT_USE_NAMESPACE
-
-class tst_QRadioData: public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- void testNullService();
- void testNullControl();
- void testAlternativeFrequencies();
- void testRadioDataUpdates();
-
-private:
- MockRadioDataControl *mock;
- MockMediaService *service;
- MockMediaServiceProvider *provider;
- QRadioData *radio;
-};
-#endif
diff --git a/tests/auto/qradiotuner/main.cpp b/tests/auto/qradiotuner/main.cpp
deleted file mode 100755
index b2d6fd2..0000000
--- a/tests/auto/qradiotuner/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-
-#include "tst_qradiotuner.h"
-
-int main(int argc, char**argv)
-{
- QCoreApplication app(argc,argv);
- int ret;
- tst_QRadioTuner test_api;
- ret = QTest::qExec(&test_api, argc, argv);
- return ret;
-}
diff --git a/tests/auto/qradiotuner/qradiotuner.pro b/tests/auto/qradiotuner/qradiotuner.pro
deleted file mode 100644
index 3d3a21f..0000000
--- a/tests/auto/qradiotuner/qradiotuner.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qradiotuner
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-HEADERS += tst_qradiotuner.h
-SOURCES += main.cpp tst_qradiotuner.cpp
-
-include (../qmultimedia_common/mock.pri)
-include (../qmultimedia_common/mockradio.pri)
diff --git a/tests/auto/qradiotuner/tst_qradiotuner.cpp b/tests/auto/qradiotuner/tst_qradiotuner.cpp
deleted file mode 100644
index c426422..0000000
--- a/tests/auto/qradiotuner/tst_qradiotuner.cpp
+++ /dev/null
@@ -1,336 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 "tst_qradiotuner.h"
-
-QT_USE_NAMESPACE
-
-void tst_QRadioTuner::initTestCase()
-{
- qRegisterMetaType<QRadioTuner::State>("QRadioTuner::State");
- qRegisterMetaType<QRadioTuner::Band>("QRadioTuner::Band");
-
- mock = new MockRadioTunerControl(this);
- service = new MockMediaService(this, mock);
- provider = new MockMediaServiceProvider(service);
- radio = new QRadioTuner(0,provider);
- QVERIFY(radio->service() != 0);
- QVERIFY(radio->isAvailable());
- QVERIFY(radio->availabilityError() == QtMultimedia::NoError);
-
- QSignalSpy stateSpy(radio, SIGNAL(stateChanged(QRadioTuner::State)));
-
- QCOMPARE(radio->state(), QRadioTuner::StoppedState);
- radio->start();
- QVERIFY(radio->availabilityError() == QtMultimedia::NoError);
- QCOMPARE(radio->state(), QRadioTuner::ActiveState);
-
- QCOMPARE(stateSpy.count(), 1);
- QCOMPARE(stateSpy.first()[0].value<QRadioTuner::State>(), QRadioTuner::ActiveState);
-}
-
-void tst_QRadioTuner::cleanupTestCase()
-{
- QVERIFY(radio->error() == QRadioTuner::NoError);
- QVERIFY(radio->errorString().isEmpty());
-
- QSignalSpy stateSpy(radio, SIGNAL(stateChanged(QRadioTuner::State)));
-
- radio->stop();
- QVERIFY(radio->availabilityError() == QtMultimedia::NoError);
- QCOMPARE(radio->state(), QRadioTuner::StoppedState);
- QCOMPARE(stateSpy.count(), 1);
-
- QCOMPARE(stateSpy.first()[0].value<QRadioTuner::State>(), QRadioTuner::StoppedState);
-
- delete radio;
- delete service;
- delete provider;
-}
-
-void tst_QRadioTuner::testNullService()
-{
- const QPair<int, int> nullRange(0, 0);
-
- MockMediaServiceProvider provider(0);
- QRadioTuner radio(0, &provider);
- QVERIFY(!radio.isAvailable());
- radio.start();
- QCOMPARE(radio.error(), QRadioTuner::ResourceError);
- QCOMPARE(radio.errorString(), QString());
- QCOMPARE(radio.band(), QRadioTuner::FM);
- QCOMPARE(radio.isBandSupported(QRadioTuner::AM), false);
- QCOMPARE(radio.isBandSupported(QRadioTuner::FM), false);
- QCOMPARE(radio.frequency(), 0);
- QCOMPARE(radio.frequencyStep(QRadioTuner::AM), 0);
- QCOMPARE(radio.frequencyStep(QRadioTuner::FM), 0);
- QCOMPARE(radio.frequencyRange(QRadioTuner::AM), nullRange);
- QCOMPARE(radio.frequencyRange(QRadioTuner::FM), nullRange);
- QCOMPARE(radio.isStereo(), false);
- QCOMPARE(radio.stereoMode(), QRadioTuner::Auto);
- QCOMPARE(radio.signalStrength(), 0);
- QCOMPARE(radio.volume(), 0);
- QCOMPARE(radio.isMuted(), false);
- QCOMPARE(radio.isSearching(), false);
- radio.stop();
-}
-
-void tst_QRadioTuner::testNullControl()
-{
- const QPair<int, int> nullRange(0, 0);
-
- MockMediaService service(0, 0);
- MockMediaServiceProvider provider(&service);
- QRadioTuner radio(0, &provider);
- QVERIFY(!radio.isAvailable());
- radio.start();
-
- QCOMPARE(radio.error(), QRadioTuner::ResourceError);
- QCOMPARE(radio.errorString(), QString());
-
- QCOMPARE(radio.band(), QRadioTuner::FM);
- QCOMPARE(radio.isBandSupported(QRadioTuner::AM), false);
- QCOMPARE(radio.isBandSupported(QRadioTuner::FM), false);
- QCOMPARE(radio.frequency(), 0);
- QCOMPARE(radio.frequencyStep(QRadioTuner::AM), 0);
- QCOMPARE(radio.frequencyStep(QRadioTuner::FM), 0);
- QCOMPARE(radio.frequencyRange(QRadioTuner::AM), nullRange);
- QCOMPARE(radio.frequencyRange(QRadioTuner::FM), nullRange);
- {
- QSignalSpy bandSpy(&radio, SIGNAL(bandChanged(QRadioTuner::Band)));
- QSignalSpy frequencySpy(&radio, SIGNAL(frequencyChanged(int)));
-
- radio.setFrequency(107500);
- QCOMPARE(radio.band(), QRadioTuner::FM);
- QCOMPARE(radio.frequency(), 0);
- QCOMPARE(bandSpy.count(), 0);
- QCOMPARE(frequencySpy.count(), 0);
-
- radio.setBand(QRadioTuner::AM);
- QCOMPARE(radio.band(), QRadioTuner::FM);
- QCOMPARE(radio.frequency(), 0);
- QCOMPARE(bandSpy.count(), 0);
- QCOMPARE(frequencySpy.count(), 0);
- }
- QCOMPARE(radio.isStereo(), false);
- QCOMPARE(radio.stereoMode(), QRadioTuner::Auto);
-
- radio.setStereoMode(QRadioTuner::ForceStereo);
- QCOMPARE(radio.stereoMode(), QRadioTuner::Auto);
-
- QCOMPARE(radio.signalStrength(), 0);
-
- QCOMPARE(radio.volume(), 0);
- QCOMPARE(radio.isMuted(), false);
- {
- QSignalSpy volumeSpy(&radio, SIGNAL(volumeChanged(int)));
- QSignalSpy muteSpy(&radio, SIGNAL(mutedChanged(bool)));
-
- radio.setVolume(76);
- QCOMPARE(radio.volume(), 0);
- QCOMPARE(volumeSpy.count(), 0);
-
- radio.setMuted(true);
- QCOMPARE(radio.isMuted(), false);
- QCOMPARE(muteSpy.count(), 0);
- }
- QCOMPARE(radio.isSearching(), false);
- {
- QSignalSpy spy(&radio, SIGNAL(searchingChanged(bool)));
-
- radio.searchBackward();
- QCOMPARE(radio.isSearching(), false);
- QCOMPARE(spy.count(), 0);
-
- radio.searchForward();
- QCOMPARE(radio.isSearching(), false);
- QCOMPARE(spy.count(), 0);
-
- radio.searchAllStations();
- QCOMPARE(radio.isSearching(), false);
- QCOMPARE(spy.count(), 0);
-
- radio.cancelSearch();
- QCOMPARE(radio.isSearching(), false);
- QCOMPARE(spy.count(), 0);
- }
-
- radio.stop();
-}
-
-void tst_QRadioTuner::testBand()
-{
- QVERIFY(radio->isBandSupported(QRadioTuner::FM));
- QVERIFY(!radio->isBandSupported(QRadioTuner::SW));
-
- if(radio->isBandSupported(QRadioTuner::AM)) {
- QSignalSpy readSignal(radio, SIGNAL(bandChanged(QRadioTuner::Band)));
- radio->setBand(QRadioTuner::AM);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(radio->band() == QRadioTuner::AM);
- QVERIFY(readSignal.count() == 1);
- }
-}
-
-void tst_QRadioTuner::testFrequency()
-{
- QSignalSpy readSignal(radio, SIGNAL(frequencyChanged(int)));
- radio->setFrequency(104500000);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(radio->frequency() == 104500000);
- QVERIFY(readSignal.count() == 1);
-
- QVERIFY(radio->frequencyStep(QRadioTuner::FM) == 1);
- QPair<int,int> test = radio->frequencyRange(QRadioTuner::FM);
- QVERIFY(test.first == 1);
- QVERIFY(test.second == 2);
-}
-
-void tst_QRadioTuner::testMute()
-{
- QSignalSpy readSignal(radio, SIGNAL(mutedChanged(bool)));
- radio->setMuted(true);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(radio->isMuted());
- QVERIFY(readSignal.count() == 1);
-}
-
-void tst_QRadioTuner::testSearch()
-{
- QSignalSpy readSignal(radio, SIGNAL(searchingChanged(bool)));
- QVERIFY(!radio->isSearching());
-
- radio->searchForward();
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(radio->isSearching());
- QVERIFY(readSignal.count() == 1);
-
- radio->cancelSearch();
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(!radio->isSearching());
- QVERIFY(readSignal.count() == 2);
-
- radio->searchBackward();
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(radio->isSearching());
- QVERIFY(readSignal.count() == 3);
-
- radio->cancelSearch();
- QVERIFY(!radio->isSearching());
-}
-
-void tst_QRadioTuner::testVolume()
-{
- QVERIFY(radio->volume() == 100);
- QSignalSpy readSignal(radio, SIGNAL(volumeChanged(int)));
- radio->setVolume(50);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(radio->volume() == 50);
- QVERIFY(readSignal.count() == 1);
-}
-
-void tst_QRadioTuner::testSignal()
-{
- QVERIFY(radio->signalStrength() == 0);
- // There is no set of this only a get, do nothing else.
-}
-
-void tst_QRadioTuner::testStereo()
-{
- /* no set function to toggle stereo status;
- cannot emit stereoStatusChanged() signal */
-
- QVERIFY(radio->isStereo());
- radio->setStereoMode(QRadioTuner::ForceMono);
- QVERIFY(radio->stereoMode() == QRadioTuner::ForceMono);
-}
-
-void tst_QRadioTuner::testSearchAllStations()
-{
- QSignalSpy foundSpy(radio, SIGNAL(stationFound(int,QString)));
- QSignalSpy completeSpy(radio, SIGNAL(searchingChanged(bool)));
- radio->searchAllStations(QRadioTuner::SearchGetStationId);
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(radio->frequency(), 103100000 );
- QCOMPARE(foundSpy.count(), 3);
- QVERIFY(qvariant_cast<int>(foundSpy.at(2).at(0)) == 103100000 );
- QVERIFY(qvariant_cast<QString>(foundSpy.at(2).at(1)) == QString("MockProgramPI3") );
- QCOMPARE(completeSpy.count(), 2);
-}
-
-// QRadioTuner's errorsignal
-void tst_QRadioTuner::errorSignal()
-{
- qRegisterMetaType<QRadioTuner::Error>("QRadioTuner::Error");
- QObject obj;
- MockRadioTunerControl dctrl(&obj);
- MockMediaService service(&obj, &dctrl);
- MockMediaServiceProvider provider(&service);
- QRadioTuner radio(0,&provider);
- QSignalSpy spy(&radio, SIGNAL(error(QRadioTuner::Error)));
- QVERIFY(radio.service() != 0);
- QVERIFY(radio.isAvailable());
- radio.start();
- radio.setBand(QRadioTuner::FM);
- QVERIFY(spy.count() == 1);
- QVERIFY(qvariant_cast<QRadioTuner::Error>(spy.at(0).at(0)) == QRadioTuner::NoError);
- QVERIFY(radio.error() == QRadioTuner::NoError);
- QVERIFY(radio.error() != QRadioTuner::OpenError);
- QVERIFY(radio.errorString().isEmpty());
- spy.clear();
-
- /* emits QRadioTuner::OutOfRangeError if band is set to FM2 or LW
- and frequency set to >= 148500000 */
-
- radio.setBand(QRadioTuner::LW);
- radio.setBand(QRadioTuner::FM2);
- radio.setFrequency(148500000);
- QVERIFY(spy.count() == 3);
- QVERIFY(qvariant_cast<QRadioTuner::Error>(spy.at(0).at(0)) == QRadioTuner::OutOfRangeError);
- QVERIFY(qvariant_cast<QRadioTuner::Error>(spy.at(1).at(0)) == QRadioTuner::OutOfRangeError);
- QVERIFY(qvariant_cast<QRadioTuner::Error>(spy.at(2).at(0)) == QRadioTuner::OutOfRangeError);
- QVERIFY(radio.error() == QRadioTuner::OutOfRangeError);
- QVERIFY2(!radio.errorString().isEmpty(), "band and range not supported");
- spy.clear();
- radio.stop();
-}
diff --git a/tests/auto/qradiotuner/tst_qradiotuner.h b/tests/auto/qradiotuner/tst_qradiotuner.h
deleted file mode 100644
index 364f5e2..0000000
--- a/tests/auto/qradiotuner/tst_qradiotuner.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 TST_QRADIOTUNER_H
-#define TST_QRADIOTUNER_H
-
-#include <QtTest/QtTest>
-#include <QDebug>
-#include <QTimer>
-
-#include <qmediaobject.h>
-#include <qmediacontrol.h>
-#include <qmediaservice.h>
-#include <qradiotunercontrol.h>
-#include <qradiotuner.h>
-
-#include "mockmediaserviceprovider.h"
-#include "mockmediaservice.h"
-#include "mockradiotunercontrol.h"
-
-QT_USE_NAMESPACE
-
-class tst_QRadioTuner: public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- void testNullService();
- void testNullControl();
- void testBand();
- void testFrequency();
- void testMute();
- void testSearch();
- void testVolume();
- void testSignal();
- void testStereo();
- void testSearchAllStations();
- void errorSignal();
-
-private:
- MockRadioTunerControl *mock;
- MockMediaService *service;
- MockMediaServiceProvider *provider;
- QRadioTuner *radio;
-};
-#endif
diff --git a/tests/auto/qsoundeffect/qsoundeffect.pro b/tests/auto/qsoundeffect/qsoundeffect.pro
deleted file mode 100644
index 4d7f083..0000000
--- a/tests/auto/qsoundeffect/qsoundeffect.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TARGET = tst_qsoundeffect
-
-QT += core declarative multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-# This is more of a system test
-# CONFIG += testcase
-
-SOURCES += tst_qsoundeffect.cpp
-
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
-
-unix:!mac {
- !contains(QT_CONFIG, pulseaudio) {
- DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER
- }
-}
diff --git a/tests/auto/qsoundeffect/test.wav b/tests/auto/qsoundeffect/test.wav
deleted file mode 100644
index e4088a9..0000000
--- a/tests/auto/qsoundeffect/test.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qsoundeffect/tst_qsoundeffect.cpp b/tests/auto/qsoundeffect/tst_qsoundeffect.cpp
deleted file mode 100644
index b379762..0000000
--- a/tests/auto/qsoundeffect/tst_qsoundeffect.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include <QtCore/qlocale.h>
-#include <qaudiooutput.h>
-#include <qaudiodeviceinfo.h>
-#include <qaudio.h>
-#include "qsoundeffect.h"
-
-
-class tst_QSoundEffect : public QObject
-{
- Q_OBJECT
-public:
- tst_QSoundEffect(QObject* parent=0) : QObject(parent) {}
-
-private slots:
- void initTestCase();
- void testSource();
- void testLooping();
- void testVolume();
- void testMuting();
-
- void testPlaying();
- void testStatus();
-
-private:
- QSoundEffect* sound;
- QUrl url;
-};
-
-void tst_QSoundEffect::initTestCase()
-{
-#ifdef QT_QSOUNDEFFECT_USEAPPLICATIONPATH
- url = QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + QString("/test.wav"));
-#else
- url = QUrl::fromLocalFile(QString(SRCDIR "test.wav"));
-#endif
-
- sound = new QSoundEffect(this);
-
- QVERIFY(sound->source().isEmpty());
- QVERIFY(sound->loopCount() == 1);
- QVERIFY(sound->volume() == 1);
- QVERIFY(sound->isMuted() == false);
-}
-
-void tst_QSoundEffect::testSource()
-{
- QSignalSpy readSignal(sound, SIGNAL(sourceChanged()));
-
- sound->setSource(url);
-
- QCOMPARE(sound->source(),url);
- QCOMPARE(readSignal.count(),1);
-
- QTestEventLoop::instance().enterLoop(1);
- sound->play();
-
- QTest::qWait(3000);
-}
-
-void tst_QSoundEffect::testLooping()
-{
- QSignalSpy readSignal(sound, SIGNAL(loopCountChanged()));
-
- sound->setLoopCount(5);
- QCOMPARE(sound->loopCount(),5);
-
- sound->play();
-
- // test.wav is about 200ms, wait until it has finished playing 5 times
- QTest::qWait(3000);
-
-}
-
-void tst_QSoundEffect::testVolume()
-{
- QSignalSpy readSignal(sound, SIGNAL(volumeChanged()));
-
- sound->setVolume(0.5);
- QCOMPARE(sound->volume(),0.5);
-
- QTest::qWait(20);
- QCOMPARE(readSignal.count(),1);
-}
-
-void tst_QSoundEffect::testMuting()
-{
- QSignalSpy readSignal(sound, SIGNAL(mutedChanged()));
-
- sound->setMuted(true);
- QCOMPARE(sound->isMuted(),true);
-
- QTest::qWait(20);
- QCOMPARE(readSignal.count(),1);
-}
-
-void tst_QSoundEffect::testPlaying()
-{
- sound->setLoopCount(QSoundEffect::Infinite);
- //valid source
- sound->setSource(url);
- QTestEventLoop::instance().enterLoop(1);
- sound->play();
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(sound->isPlaying(), true);
- sound->stop();
-
- //empty source
- sound->setSource(QUrl());
- QTestEventLoop::instance().enterLoop(1);
- sound->play();
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(sound->isPlaying(), false);
-
- //invalid source
- sound->setSource(QUrl((QLatin1String("invalid source"))));
- QTestEventLoop::instance().enterLoop(1);
- sound->play();
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(sound->isPlaying(), false);
-
- sound->setLoopCount(1);
-}
-
-void tst_QSoundEffect::testStatus()
-{
- sound->setSource(QUrl());
- QCOMPARE(sound->status(), QSoundEffect::Null);
-
- //valid source
- sound->setSource(url);
-
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(sound->status(), QSoundEffect::Ready);
-
- //empty source
- sound->setSource(QUrl());
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(sound->status(), QSoundEffect::Null);
-
- //invalid source
- sound->setLoopCount(QSoundEffect::Infinite);
-
- sound->setSource(QUrl(QLatin1String("invalid source")));
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(sound->status(), QSoundEffect::Error);
-}
-
-
-QTEST_MAIN(tst_QSoundEffect)
-
-#include "tst_qsoundeffect.moc"
diff --git a/tests/auto/qvideodevicecontrol/qvideodevicecontrol.pro b/tests/auto/qvideodevicecontrol/qvideodevicecontrol.pro
deleted file mode 100644
index 29bd81f..0000000
--- a/tests/auto/qvideodevicecontrol/qvideodevicecontrol.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qvideodevicecontrol
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qvideodevicecontrol.cpp
diff --git a/tests/auto/qvideodevicecontrol/tst_qvideodevicecontrol.cpp b/tests/auto/qvideodevicecontrol/tst_qvideodevicecontrol.cpp
deleted file mode 100644
index 59d2546..0000000
--- a/tests/auto/qvideodevicecontrol/tst_qvideodevicecontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include "qvideodevicecontrol.h"
-class TestClass: public QVideoDeviceControl
-{
- Q_OBJECT
-
-public:
- TestClass(QObject *parent = 0 ):QVideoDeviceControl(parent)
- {
-
- }
-
- ~TestClass(){}
-
- virtual int deviceCount() const { return 0; }
-
- QString deviceName(int index) const
- {
- QString str;
- return str;
- }
-
- QString deviceDescription(int index) const
- {
- QString str;
- return str;
- }
-
- QIcon deviceIcon(int index) const
- {
- QIcon icon;
- return icon;
- }
-
- int defaultDevice() const { return 0; }
- int selectedDevice() const { return 0; }
-
- public Q_SLOTS:
- void setSelectedDevice(int index)
- {
- emit devicesChanged();
- emit selectedDeviceChanged(index);
- emit selectedDeviceChanged("abc");
- }
-};
-
-
-class tst_QVideoDeviceControl : public QObject
-{
- Q_OBJECT
-public:
- tst_QVideoDeviceControl(){}
- ~tst_QVideoDeviceControl(){}
-
-private slots:
- void testQVideoDeviceControl();
-};
-
-//MaemoAPI-1859:QVideoDeviceControl constructor
-void tst_QVideoDeviceControl::testQVideoDeviceControl()
-{
- TestClass *testClass = new TestClass(this);
- QVERIFY(testClass != NULL);
-}
-
-QTEST_MAIN(tst_QVideoDeviceControl)
-#include "tst_qvideodevicecontrol.moc"
diff --git a/tests/auto/qvideoencodercontrol/qvideoencodercontrol.pro b/tests/auto/qvideoencodercontrol/qvideoencodercontrol.pro
deleted file mode 100644
index ad14a25..0000000
--- a/tests/auto/qvideoencodercontrol/qvideoencodercontrol.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qvideoencodercontrol
-
-QT += multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += \
- tst_qvideoencodercontrol.cpp
-
diff --git a/tests/auto/qvideoencodercontrol/tst_qvideoencodercontrol.cpp b/tests/auto/qvideoencodercontrol/tst_qvideoencodercontrol.cpp
deleted file mode 100644
index 4f1b99d..0000000
--- a/tests/auto/qvideoencodercontrol/tst_qvideoencodercontrol.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-#include "qvideoencodercontrol.h"
-class MyVideEncoderControl: public QVideoEncoderControl
-{
- Q_OBJECT
-
-public:
- MyVideEncoderControl(QObject *parent = 0 ):QVideoEncoderControl(parent)
- {
-
- }
-
- ~MyVideEncoderControl()
- {
-
- }
-
- QList<QSize> supportedResolutions(const QVideoEncoderSettings &settings,bool *continuous = 0) const
- {
- Q_UNUSED(settings);
- Q_UNUSED(continuous);
-
- return (QList<QSize>());
- }
-
- QList<qreal> supportedFrameRates(const QVideoEncoderSettings &settings, bool *continuous = 0) const
- {
- Q_UNUSED(settings);
- Q_UNUSED(continuous);
-
- return (QList<qreal>());
-
- }
-
- QStringList supportedVideoCodecs() const
- {
- return QStringList();
-
- }
-
- QString videoCodecDescription(const QString &codecName) const
- {
- Q_UNUSED(codecName)
- return QString();
-
- }
-
- QVideoEncoderSettings videoSettings() const
- {
- return QVideoEncoderSettings();
- }
-
- void setVideoSettings(const QVideoEncoderSettings &settings)
- {
- Q_UNUSED(settings);
- }
-
- QStringList supportedEncodingOptions(const QString &codec) const
- {
- Q_UNUSED(codec);
- return QStringList();
- }
-
- QVariant encodingOption(const QString &codec, const QString &name) const
- {
- Q_UNUSED(codec);
- Q_UNUSED(name);
- return QVariant();
- }
-
- void setEncodingOption(const QString &codec, const QString &name, const QVariant &value)
- {
- Q_UNUSED(codec);
- Q_UNUSED(name);
- Q_UNUSED(value);
- }
-
-};
-
-class tst_QVideoEncoderControl: public QObject
-{
- Q_OBJECT
-private slots:
- void constructor();
-};
-
-void tst_QVideoEncoderControl::constructor()
-{
- QObject parent;
- MyVideEncoderControl control(&parent);
-}
-
-QTEST_MAIN(tst_QVideoEncoderControl)
-#include "tst_qvideoencodercontrol.moc"
-
-
diff --git a/tests/auto/qvideoframe/qvideoframe.pro b/tests/auto/qvideoframe/qvideoframe.pro
deleted file mode 100644
index cfd84a2..0000000
--- a/tests/auto/qvideoframe/qvideoframe.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qvideoframe
-
-QT += core multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qvideoframe.cpp
-
diff --git a/tests/auto/qvideoframe/tst_qvideoframe.cpp b/tests/auto/qvideoframe/tst_qvideoframe.cpp
deleted file mode 100644
index 52d5771..0000000
--- a/tests/auto/qvideoframe/tst_qvideoframe.cpp
+++ /dev/null
@@ -1,969 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-
-#include <qvideoframe.h>
-#include <QtGui/QImage>
-#include <QtCore/QPointer>
-
-class tst_QVideoFrame : public QObject
-{
- Q_OBJECT
-public:
- tst_QVideoFrame();
- ~tst_QVideoFrame();
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
-private slots:
- void create_data();
- void create();
- void createInvalid_data();
- void createInvalid();
- void createFromBuffer_data();
- void createFromBuffer();
- void createFromImage_data();
- void createFromImage();
- void createFromIncompatibleImage();
- void createNull();
- void destructor();
- void copy_data();
- void copy();
- void assign_data();
- void assign();
- void map_data();
- void map();
- void mapImage_data();
- void mapImage();
- void imageDetach();
- void formatConversion_data();
- void formatConversion();
-
- void isMapped();
- void isReadable();
- void isWritable();
-};
-
-Q_DECLARE_METATYPE(QImage::Format)
-Q_DECLARE_METATYPE(QVideoFrame)
-
-class QtTestVideoBuffer : public QObject, public QAbstractVideoBuffer
-{
- Q_OBJECT
-public:
- QtTestVideoBuffer()
- : QAbstractVideoBuffer(NoHandle) {}
- explicit QtTestVideoBuffer(QAbstractVideoBuffer::HandleType type)
- : QAbstractVideoBuffer(type) {}
-
- MapMode mapMode() const { return NotMapped; }
-
- uchar *map(MapMode, int *, int *) { return 0; }
- void unmap() {}
-};
-
-tst_QVideoFrame::tst_QVideoFrame()
-{
-}
-
-tst_QVideoFrame::~tst_QVideoFrame()
-{
-}
-
-void tst_QVideoFrame::initTestCase()
-{
-}
-
-void tst_QVideoFrame::cleanupTestCase()
-{
-}
-
-void tst_QVideoFrame::init()
-{
-}
-
-void tst_QVideoFrame::cleanup()
-{
-}
-
-void tst_QVideoFrame::create_data()
-{
- QTest::addColumn<QSize>("size");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
- QTest::addColumn<int>("bytes");
- QTest::addColumn<int>("bytesPerLine");
-
- QTest::newRow("64x64 ARGB32")
- << QSize(64, 64)
- << QVideoFrame::Format_ARGB32
- << 16384
- << 256;
- QTest::newRow("32x256 YUV420P")
- << QSize(32, 256)
- << QVideoFrame::Format_YUV420P
- << 13288
- << 32;
-}
-
-void tst_QVideoFrame::create()
-{
- QFETCH(QSize, size);
- QFETCH(QVideoFrame::PixelFormat, pixelFormat);
- QFETCH(int, bytes);
- QFETCH(int, bytesPerLine);
-
- QVideoFrame frame(bytes, size, bytesPerLine, pixelFormat);
-
- QVERIFY(frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(frame.handle(), QVariant());
- QCOMPARE(frame.pixelFormat(), pixelFormat);
- QCOMPARE(frame.size(), size);
- QCOMPARE(frame.width(), size.width());
- QCOMPARE(frame.height(), size.height());
- QCOMPARE(frame.fieldType(), QVideoFrame::ProgressiveFrame);
- QCOMPARE(frame.startTime(), qint64(-1));
- QCOMPARE(frame.endTime(), qint64(-1));
-}
-
-void tst_QVideoFrame::createInvalid_data()
-{
- QTest::addColumn<QSize>("size");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
- QTest::addColumn<int>("bytes");
- QTest::addColumn<int>("bytesPerLine");
-
- QTest::newRow("64x64 ARGB32 0 size")
- << QSize(64, 64)
- << QVideoFrame::Format_ARGB32
- << 0
- << 45;
- QTest::newRow("32x256 YUV420P negative size")
- << QSize(32, 256)
- << QVideoFrame::Format_YUV420P
- << -13288
- << 32;
-}
-
-void tst_QVideoFrame::createInvalid()
-{
- QFETCH(QSize, size);
- QFETCH(QVideoFrame::PixelFormat, pixelFormat);
- QFETCH(int, bytes);
- QFETCH(int, bytesPerLine);
-
- QVideoFrame frame(bytes, size, bytesPerLine, pixelFormat);
-
- QVERIFY(!frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(frame.handle(), QVariant());
- QCOMPARE(frame.pixelFormat(), pixelFormat);
- QCOMPARE(frame.size(), size);
- QCOMPARE(frame.width(), size.width());
- QCOMPARE(frame.height(), size.height());
- QCOMPARE(frame.fieldType(), QVideoFrame::ProgressiveFrame);
- QCOMPARE(frame.startTime(), qint64(-1));
- QCOMPARE(frame.endTime(), qint64(-1));
-}
-
-void tst_QVideoFrame::createFromBuffer_data()
-{
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
- QTest::addColumn<QSize>("size");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
-
- QTest::newRow("64x64 ARGB32 no handle")
- << QAbstractVideoBuffer::NoHandle
- << QSize(64, 64)
- << QVideoFrame::Format_ARGB32;
- QTest::newRow("64x64 ARGB32 gl handle")
- << QAbstractVideoBuffer::GLTextureHandle
- << QSize(64, 64)
- << QVideoFrame::Format_ARGB32;
- QTest::newRow("64x64 ARGB32 user handle")
- << QAbstractVideoBuffer::UserHandle
- << QSize(64, 64)
- << QVideoFrame::Format_ARGB32;
-}
-
-void tst_QVideoFrame::createFromBuffer()
-{
- QFETCH(QAbstractVideoBuffer::HandleType, handleType);
- QFETCH(QSize, size);
- QFETCH(QVideoFrame::PixelFormat, pixelFormat);
-
- QVideoFrame frame(new QtTestVideoBuffer(handleType), size, pixelFormat);
-
- QVERIFY(frame.isValid());
- QCOMPARE(frame.handleType(), handleType);
- QCOMPARE(frame.pixelFormat(), pixelFormat);
- QCOMPARE(frame.size(), size);
- QCOMPARE(frame.width(), size.width());
- QCOMPARE(frame.height(), size.height());
- QCOMPARE(frame.fieldType(), QVideoFrame::ProgressiveFrame);
- QCOMPARE(frame.startTime(), qint64(-1));
- QCOMPARE(frame.endTime(), qint64(-1));
-}
-
-void tst_QVideoFrame::createFromImage_data()
-{
- QTest::addColumn<QSize>("size");
- QTest::addColumn<QImage::Format>("imageFormat");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
-
- QTest::newRow("64x64 RGB32")
- << QSize(64, 64)
- << QImage::Format_RGB32
- << QVideoFrame::Format_RGB32;
- QTest::newRow("12x45 RGB16")
- << QSize(12, 45)
- << QImage::Format_RGB16
- << QVideoFrame::Format_RGB565;
- QTest::newRow("19x46 ARGB32_Premultiplied")
- << QSize(19, 46)
- << QImage::Format_ARGB32_Premultiplied
- << QVideoFrame::Format_ARGB32_Premultiplied;
-}
-
-void tst_QVideoFrame::createFromImage()
-{
- QFETCH(QSize, size);
- QFETCH(QImage::Format, imageFormat);
- QFETCH(QVideoFrame::PixelFormat, pixelFormat);
-
- const QImage image(size.width(), size.height(), imageFormat);
-
- QVideoFrame frame(image);
-
- QVERIFY(frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(frame.pixelFormat(), pixelFormat);
- QCOMPARE(frame.size(), size);
- QCOMPARE(frame.width(), size.width());
- QCOMPARE(frame.height(), size.height());
- QCOMPARE(frame.fieldType(), QVideoFrame::ProgressiveFrame);
- QCOMPARE(frame.startTime(), qint64(-1));
- QCOMPARE(frame.endTime(), qint64(-1));
-}
-
-void tst_QVideoFrame::createFromIncompatibleImage()
-{
- const QImage image(64, 64, QImage::Format_Mono);
-
- QVideoFrame frame(image);
-
- QVERIFY(!frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_Invalid);
- QCOMPARE(frame.size(), QSize(64, 64));
- QCOMPARE(frame.width(), 64);
- QCOMPARE(frame.height(), 64);
- QCOMPARE(frame.fieldType(), QVideoFrame::ProgressiveFrame);
- QCOMPARE(frame.startTime(), qint64(-1));
- QCOMPARE(frame.endTime(), qint64(-1));
-}
-
-void tst_QVideoFrame::createNull()
-{
- // Default ctor
- {
- QVideoFrame frame;
-
- QVERIFY(!frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_Invalid);
- QCOMPARE(frame.size(), QSize());
- QCOMPARE(frame.width(), -1);
- QCOMPARE(frame.height(), -1);
- QCOMPARE(frame.fieldType(), QVideoFrame::ProgressiveFrame);
- QCOMPARE(frame.startTime(), qint64(-1));
- QCOMPARE(frame.endTime(), qint64(-1));
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
- QVERIFY(!frame.map(QAbstractVideoBuffer::ReadOnly));
- QVERIFY(!frame.map(QAbstractVideoBuffer::ReadWrite));
- QVERIFY(!frame.map(QAbstractVideoBuffer::WriteOnly));
- QCOMPARE(frame.isMapped(), false);
- frame.unmap(); // Shouldn't crash
- QCOMPARE(frame.isReadable(), false);
- QCOMPARE(frame.isWritable(), false);
- }
-
- // Null buffer (shouldn't crash)
- {
- QVideoFrame frame(0, QSize(1024,768), QVideoFrame::Format_ARGB32);
- QVERIFY(!frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_ARGB32);
- QCOMPARE(frame.size(), QSize(1024, 768));
- QCOMPARE(frame.width(), 1024);
- QCOMPARE(frame.height(), 768);
- QCOMPARE(frame.fieldType(), QVideoFrame::ProgressiveFrame);
- QCOMPARE(frame.startTime(), qint64(-1));
- QCOMPARE(frame.endTime(), qint64(-1));
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
- QVERIFY(!frame.map(QAbstractVideoBuffer::ReadOnly));
- QVERIFY(!frame.map(QAbstractVideoBuffer::ReadWrite));
- QVERIFY(!frame.map(QAbstractVideoBuffer::WriteOnly));
- QCOMPARE(frame.isMapped(), false);
- frame.unmap(); // Shouldn't crash
- QCOMPARE(frame.isReadable(), false);
- QCOMPARE(frame.isWritable(), false);
- }
-}
-
-void tst_QVideoFrame::destructor()
-{
- QPointer<QtTestVideoBuffer> buffer = new QtTestVideoBuffer;
-
- {
- QVideoFrame frame(buffer, QSize(4, 1), QVideoFrame::Format_ARGB32);
- }
-
- QVERIFY(buffer.isNull());
-}
-
-void tst_QVideoFrame::copy_data()
-{
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
- QTest::addColumn<QSize>("size");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
- QTest::addColumn<QVideoFrame::FieldType>("fieldType");
- QTest::addColumn<qint64>("startTime");
- QTest::addColumn<qint64>("endTime");
-
- QTest::newRow("64x64 ARGB32")
- << QAbstractVideoBuffer::GLTextureHandle
- << QSize(64, 64)
- << QVideoFrame::Format_ARGB32
- << QVideoFrame::TopField
- << qint64(63641740)
- << qint64(63641954);
- QTest::newRow("64x64 ARGB32")
- << QAbstractVideoBuffer::GLTextureHandle
- << QSize(64, 64)
- << QVideoFrame::Format_ARGB32
- << QVideoFrame::BottomField
- << qint64(63641740)
- << qint64(63641954);
- QTest::newRow("32x256 YUV420P")
- << QAbstractVideoBuffer::UserHandle
- << QSize(32, 256)
- << QVideoFrame::Format_YUV420P
- << QVideoFrame::InterlacedFrame
- << qint64(12345)
- << qint64(12389);
- QTest::newRow("1052x756 ARGB32")
- << QAbstractVideoBuffer::NoHandle
- << QSize(1052, 756)
- << QVideoFrame::Format_ARGB32
- << QVideoFrame::ProgressiveFrame
- << qint64(12345)
- << qint64(12389);
- QTest::newRow("32x256 YUV420P")
- << QAbstractVideoBuffer::UserHandle
- << QSize(32, 256)
- << QVideoFrame::Format_YUV420P
- << QVideoFrame::InterlacedFrame
- << qint64(12345)
- << qint64(12389);
-}
-
-void tst_QVideoFrame::copy()
-{
- QFETCH(QAbstractVideoBuffer::HandleType, handleType);
- QFETCH(QSize, size);
- QFETCH(QVideoFrame::PixelFormat, pixelFormat);
- QFETCH(QVideoFrame::FieldType, fieldType);
- QFETCH(qint64, startTime);
- QFETCH(qint64, endTime);
-
- QPointer<QtTestVideoBuffer> buffer = new QtTestVideoBuffer(handleType);
-
- {
- QVideoFrame frame(buffer, size, pixelFormat);
- frame.setFieldType(QVideoFrame::FieldType(fieldType));
- frame.setStartTime(startTime);
- frame.setEndTime(endTime);
-
- QVERIFY(frame.isValid());
- QCOMPARE(frame.handleType(), handleType);
- QCOMPARE(frame.pixelFormat(), pixelFormat);
- QCOMPARE(frame.size(), size);
- QCOMPARE(frame.width(), size.width());
- QCOMPARE(frame.height(), size.height());
- QCOMPARE(frame.fieldType(), fieldType);
- QCOMPARE(frame.startTime(), startTime);
- QCOMPARE(frame.endTime(), endTime);
-
- {
- QVideoFrame otherFrame(frame);
-
- QVERIFY(!buffer.isNull());
-
- QVERIFY(otherFrame.isValid());
- QCOMPARE(otherFrame.handleType(), handleType);
- QCOMPARE(otherFrame.pixelFormat(), pixelFormat);
- QCOMPARE(otherFrame.size(), size);
- QCOMPARE(otherFrame.width(), size.width());
- QCOMPARE(otherFrame.height(), size.height());
- QCOMPARE(otherFrame.fieldType(), fieldType);
- QCOMPARE(otherFrame.startTime(), startTime);
- QCOMPARE(otherFrame.endTime(), endTime);
-
- otherFrame.setEndTime(-1);
-
- QVERIFY(!buffer.isNull());
-
- QVERIFY(otherFrame.isValid());
- QCOMPARE(otherFrame.handleType(), handleType);
- QCOMPARE(otherFrame.pixelFormat(), pixelFormat);
- QCOMPARE(otherFrame.size(), size);
- QCOMPARE(otherFrame.width(), size.width());
- QCOMPARE(otherFrame.height(), size.height());
- QCOMPARE(otherFrame.fieldType(), fieldType);
- QCOMPARE(otherFrame.startTime(), startTime);
- QCOMPARE(otherFrame.endTime(), qint64(-1));
- }
-
- QVERIFY(!buffer.isNull());
-
- QVERIFY(frame.isValid());
- QCOMPARE(frame.handleType(), handleType);
- QCOMPARE(frame.pixelFormat(), pixelFormat);
- QCOMPARE(frame.size(), size);
- QCOMPARE(frame.width(), size.width());
- QCOMPARE(frame.height(), size.height());
- QCOMPARE(frame.fieldType(), fieldType);
- QCOMPARE(frame.startTime(), startTime);
- QCOMPARE(frame.endTime(), qint64(-1)); // Explicitly shared.
- }
-
- QVERIFY(buffer.isNull());
-}
-
-void tst_QVideoFrame::assign_data()
-{
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
- QTest::addColumn<QSize>("size");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
- QTest::addColumn<QVideoFrame::FieldType>("fieldType");
- QTest::addColumn<qint64>("startTime");
- QTest::addColumn<qint64>("endTime");
-
- QTest::newRow("64x64 ARGB32")
- << QAbstractVideoBuffer::GLTextureHandle
- << QSize(64, 64)
- << QVideoFrame::Format_ARGB32
- << QVideoFrame::TopField
- << qint64(63641740)
- << qint64(63641954);
- QTest::newRow("32x256 YUV420P")
- << QAbstractVideoBuffer::UserHandle
- << QSize(32, 256)
- << QVideoFrame::Format_YUV420P
- << QVideoFrame::InterlacedFrame
- << qint64(12345)
- << qint64(12389);
-}
-
-void tst_QVideoFrame::assign()
-{
- QFETCH(QAbstractVideoBuffer::HandleType, handleType);
- QFETCH(QSize, size);
- QFETCH(QVideoFrame::PixelFormat, pixelFormat);
- QFETCH(QVideoFrame::FieldType, fieldType);
- QFETCH(qint64, startTime);
- QFETCH(qint64, endTime);
-
- QPointer<QtTestVideoBuffer> buffer = new QtTestVideoBuffer(handleType);
-
- QVideoFrame frame;
- {
- QVideoFrame otherFrame(buffer, size, pixelFormat);
- otherFrame.setFieldType(fieldType);
- otherFrame.setStartTime(startTime);
- otherFrame.setEndTime(endTime);
-
- frame = otherFrame;
-
- QVERIFY(!buffer.isNull());
-
- QVERIFY(otherFrame.isValid());
- QCOMPARE(otherFrame.handleType(), handleType);
- QCOMPARE(otherFrame.pixelFormat(), pixelFormat);
- QCOMPARE(otherFrame.size(), size);
- QCOMPARE(otherFrame.width(), size.width());
- QCOMPARE(otherFrame.height(), size.height());
- QCOMPARE(otherFrame.fieldType(), fieldType);
- QCOMPARE(otherFrame.startTime(), startTime);
- QCOMPARE(otherFrame.endTime(), endTime);
-
- otherFrame.setStartTime(-1);
-
- QVERIFY(!buffer.isNull());
-
- QVERIFY(otherFrame.isValid());
- QCOMPARE(otherFrame.handleType(), handleType);
- QCOMPARE(otherFrame.pixelFormat(), pixelFormat);
- QCOMPARE(otherFrame.size(), size);
- QCOMPARE(otherFrame.width(), size.width());
- QCOMPARE(otherFrame.height(), size.height());
- QCOMPARE(otherFrame.fieldType(), fieldType);
- QCOMPARE(otherFrame.startTime(), qint64(-1));
- QCOMPARE(otherFrame.endTime(), endTime);
- }
-
- QVERIFY(!buffer.isNull());
-
- QVERIFY(frame.isValid());
- QCOMPARE(frame.handleType(), handleType);
- QCOMPARE(frame.pixelFormat(), pixelFormat);
- QCOMPARE(frame.size(), size);
- QCOMPARE(frame.width(), size.width());
- QCOMPARE(frame.height(), size.height());
- QCOMPARE(frame.fieldType(), fieldType);
- QCOMPARE(frame.startTime(), qint64(-1));
- QCOMPARE(frame.endTime(), endTime);
-
- frame = QVideoFrame();
-
- QVERIFY(buffer.isNull());
-
- QVERIFY(!frame.isValid());
- QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_Invalid);
- QCOMPARE(frame.size(), QSize());
- QCOMPARE(frame.width(), -1);
- QCOMPARE(frame.height(), -1);
- QCOMPARE(frame.fieldType(), QVideoFrame::ProgressiveFrame);
- QCOMPARE(frame.startTime(), qint64(-1));
- QCOMPARE(frame.endTime(), qint64(-1));
-}
-
-void tst_QVideoFrame::map_data()
-{
- QTest::addColumn<QSize>("size");
- QTest::addColumn<int>("mappedBytes");
- QTest::addColumn<int>("bytesPerLine");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
- QTest::addColumn<QAbstractVideoBuffer::MapMode>("mode");
-
- QTest::newRow("read-only")
- << QSize(64, 64)
- << 16384
- << 256
- << QVideoFrame::Format_ARGB32
- << QAbstractVideoBuffer::ReadOnly;
-
- QTest::newRow("write-only")
- << QSize(64, 64)
- << 16384
- << 256
- << QVideoFrame::Format_ARGB32
- << QAbstractVideoBuffer::WriteOnly;
-
- QTest::newRow("read-write")
- << QSize(64, 64)
- << 16384
- << 256
- << QVideoFrame::Format_ARGB32
- << QAbstractVideoBuffer::ReadWrite;
-}
-
-void tst_QVideoFrame::map()
-{
- QFETCH(QSize, size);
- QFETCH(int, mappedBytes);
- QFETCH(int, bytesPerLine);
- QFETCH(QVideoFrame::PixelFormat, pixelFormat);
- QFETCH(QAbstractVideoBuffer::MapMode, mode);
-
- QVideoFrame frame(mappedBytes, size, bytesPerLine, pixelFormat);
-
- QVERIFY(!frame.bits());
- QCOMPARE(frame.mappedBytes(), 0);
- QCOMPARE(frame.bytesPerLine(), 0);
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
-
- QVERIFY(frame.map(mode));
-
- // Mapping twice should fail, but leave it mapped (and the mode is ignored)
- QVERIFY(!frame.map(mode));
-
- QVERIFY(frame.bits());
- QCOMPARE(frame.mappedBytes(), mappedBytes);
- QCOMPARE(frame.bytesPerLine(), bytesPerLine);
- QCOMPARE(frame.mapMode(), mode);
-
- frame.unmap();
-
- QVERIFY(!frame.bits());
- QCOMPARE(frame.mappedBytes(), 0);
- QCOMPARE(frame.bytesPerLine(), 0);
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
-}
-
-void tst_QVideoFrame::mapImage_data()
-{
- QTest::addColumn<QSize>("size");
- QTest::addColumn<QImage::Format>("format");
- QTest::addColumn<QAbstractVideoBuffer::MapMode>("mode");
-
- QTest::newRow("read-only")
- << QSize(64, 64)
- << QImage::Format_ARGB32
- << QAbstractVideoBuffer::ReadOnly;
-
- QTest::newRow("write-only")
- << QSize(15, 106)
- << QImage::Format_RGB32
- << QAbstractVideoBuffer::WriteOnly;
-
- QTest::newRow("read-write")
- << QSize(23, 111)
- << QImage::Format_RGB16
- << QAbstractVideoBuffer::ReadWrite;
-}
-
-void tst_QVideoFrame::mapImage()
-{
- QFETCH(QSize, size);
- QFETCH(QImage::Format, format);
- QFETCH(QAbstractVideoBuffer::MapMode, mode);
-
- QImage image(size.width(), size.height(), format);
-
- QVideoFrame frame(image);
-
- QVERIFY(!frame.bits());
- QCOMPARE(frame.mappedBytes(), 0);
- QCOMPARE(frame.bytesPerLine(), 0);
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
-
- QVERIFY(frame.map(mode));
-
- QVERIFY(frame.bits());
- QCOMPARE(frame.mappedBytes(), image.byteCount());
- QCOMPARE(frame.bytesPerLine(), image.bytesPerLine());
- QCOMPARE(frame.mapMode(), mode);
-
- frame.unmap();
-
- QVERIFY(!frame.bits());
- QCOMPARE(frame.mappedBytes(), 0);
- QCOMPARE(frame.bytesPerLine(), 0);
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
-}
-
-void tst_QVideoFrame::imageDetach()
-{
- const uint red = qRgb(255, 0, 0);
- const uint blue = qRgb(0, 0, 255);
-
- QImage image(8, 8, QImage::Format_RGB32);
-
- image.fill(red);
- QCOMPARE(image.pixel(4, 4), red);
-
- QVideoFrame frame(image);
-
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadWrite));
-
- QImage frameImage(frame.bits(), 8, 8, frame.bytesPerLine(), QImage::Format_RGB32);
-
- QCOMPARE(frameImage.pixel(4, 4), red);
-
- frameImage.fill(blue);
- QCOMPARE(frameImage.pixel(4, 4), blue);
-
- // Original image has detached and is therefore unchanged.
- QCOMPARE(image.pixel(4, 4), red);
-}
-
-void tst_QVideoFrame::formatConversion_data()
-{
- QTest::addColumn<QImage::Format>("imageFormat");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
-
- QTest::newRow("QImage::Format_RGB32 | QVideoFrame::Format_RGB32")
- << QImage::Format_RGB32
- << QVideoFrame::Format_RGB32;
- QTest::newRow("QImage::Format_ARGB32 | QVideoFrame::Format_ARGB32")
- << QImage::Format_ARGB32
- << QVideoFrame::Format_ARGB32;
- QTest::newRow("QImage::Format_ARGB32_Premultiplied | QVideoFrame::Format_ARGB32_Premultiplied")
- << QImage::Format_ARGB32_Premultiplied
- << QVideoFrame::Format_ARGB32_Premultiplied;
- QTest::newRow("QImage::Format_RGB16 | QVideoFrame::Format_RGB565")
- << QImage::Format_RGB16
- << QVideoFrame::Format_RGB565;
- QTest::newRow("QImage::Format_ARGB8565_Premultiplied | QVideoFrame::Format_ARGB8565_Premultiplied")
- << QImage::Format_ARGB8565_Premultiplied
- << QVideoFrame::Format_ARGB8565_Premultiplied;
- QTest::newRow("QImage::Format_RGB555 | QVideoFrame::Format_RGB555")
- << QImage::Format_RGB555
- << QVideoFrame::Format_RGB555;
- QTest::newRow("QImage::Format_RGB888 | QVideoFrame::Format_RGB24")
- << QImage::Format_RGB888
- << QVideoFrame::Format_RGB24;
-
- QTest::newRow("QImage::Format_MonoLSB")
- << QImage::Format_MonoLSB
- << QVideoFrame::Format_Invalid;
- QTest::newRow("QImage::Format_Indexed8")
- << QImage::Format_Indexed8
- << QVideoFrame::Format_Invalid;
- QTest::newRow("QImage::Format_ARGB6666_Premultiplied")
- << QImage::Format_ARGB6666_Premultiplied
- << QVideoFrame::Format_Invalid;
- QTest::newRow("QImage::Format_ARGB8555_Premultiplied")
- << QImage::Format_ARGB8555_Premultiplied
- << QVideoFrame::Format_Invalid;
- QTest::newRow("QImage::Format_RGB666")
- << QImage::Format_RGB666
- << QVideoFrame::Format_Invalid;
- QTest::newRow("QImage::Format_RGB444")
- << QImage::Format_RGB444
- << QVideoFrame::Format_Invalid;
- QTest::newRow("QImage::Format_ARGB4444_Premultiplied")
- << QImage::Format_ARGB4444_Premultiplied
- << QVideoFrame::Format_Invalid;
-
- QTest::newRow("QVideoFrame::Format_BGRA32")
- << QImage::Format_Invalid
- << QVideoFrame::Format_BGRA32;
- QTest::newRow("QVideoFrame::Format_BGRA32_Premultiplied")
- << QImage::Format_Invalid
- << QVideoFrame::Format_BGRA32_Premultiplied;
- QTest::newRow("QVideoFrame::Format_BGR32")
- << QImage::Format_Invalid
- << QVideoFrame::Format_BGR32;
- QTest::newRow("QVideoFrame::Format_BGR24")
- << QImage::Format_Invalid
- << QVideoFrame::Format_BGR24;
- QTest::newRow("QVideoFrame::Format_BGR565")
- << QImage::Format_Invalid
- << QVideoFrame::Format_BGR565;
- QTest::newRow("QVideoFrame::Format_BGR555")
- << QImage::Format_Invalid
- << QVideoFrame::Format_BGR555;
- QTest::newRow("QVideoFrame::Format_BGRA5658_Premultiplied")
- << QImage::Format_Invalid
- << QVideoFrame::Format_BGRA5658_Premultiplied;
- QTest::newRow("QVideoFrame::Format_AYUV444")
- << QImage::Format_Invalid
- << QVideoFrame::Format_AYUV444;
- QTest::newRow("QVideoFrame::Format_AYUV444_Premultiplied")
- << QImage::Format_Invalid
- << QVideoFrame::Format_AYUV444_Premultiplied;
- QTest::newRow("QVideoFrame::Format_YUV444")
- << QImage::Format_Invalid
- << QVideoFrame::Format_YUV444;
- QTest::newRow("QVideoFrame::Format_YUV420P")
- << QImage::Format_Invalid
- << QVideoFrame::Format_YUV420P;
- QTest::newRow("QVideoFrame::Format_YV12")
- << QImage::Format_Invalid
- << QVideoFrame::Format_YV12;
- QTest::newRow("QVideoFrame::Format_UYVY")
- << QImage::Format_Invalid
- << QVideoFrame::Format_UYVY;
- QTest::newRow("QVideoFrame::Format_YUYV")
- << QImage::Format_Invalid
- << QVideoFrame::Format_YUYV;
- QTest::newRow("QVideoFrame::Format_NV12")
- << QImage::Format_Invalid
- << QVideoFrame::Format_NV12;
- QTest::newRow("QVideoFrame::Format_NV21")
- << QImage::Format_Invalid
- << QVideoFrame::Format_NV21;
- QTest::newRow("QVideoFrame::Format_IMC1")
- << QImage::Format_Invalid
- << QVideoFrame::Format_IMC1;
- QTest::newRow("QVideoFrame::Format_IMC2")
- << QImage::Format_Invalid
- << QVideoFrame::Format_IMC2;
- QTest::newRow("QVideoFrame::Format_IMC3")
- << QImage::Format_Invalid
- << QVideoFrame::Format_IMC3;
- QTest::newRow("QVideoFrame::Format_IMC4")
- << QImage::Format_Invalid
- << QVideoFrame::Format_IMC4;
- QTest::newRow("QVideoFrame::Format_Y8")
- << QImage::Format_Invalid
- << QVideoFrame::Format_Y8;
- QTest::newRow("QVideoFrame::Format_Y16")
- << QImage::Format_Invalid
- << QVideoFrame::Format_Y16;
- QTest::newRow("QVideoFrame::Format_Jpeg")
- << QImage::Format_Invalid
- << QVideoFrame::Format_Jpeg;
- QTest::newRow("QVideoFrame::Format_CameraRaw")
- << QImage::Format_Invalid
- << QVideoFrame::Format_CameraRaw;
- QTest::newRow("QVideoFrame::Format_AdobeDng")
- << QImage::Format_Invalid
- << QVideoFrame::Format_AdobeDng;
- QTest::newRow("QVideoFrame::Format_User")
- << QImage::Format_Invalid
- << QVideoFrame::Format_User;
- QTest::newRow("QVideoFrame::Format_User + 1")
- << QImage::Format_Invalid
- << QVideoFrame::PixelFormat(QVideoFrame::Format_User + 1);
-}
-
-void tst_QVideoFrame::formatConversion()
-{
- QFETCH(QImage::Format, imageFormat);
- QFETCH(QVideoFrame::PixelFormat, pixelFormat);
-
- QCOMPARE(QVideoFrame::pixelFormatFromImageFormat(imageFormat) == pixelFormat,
- imageFormat != QImage::Format_Invalid);
-
- QCOMPARE(QVideoFrame::imageFormatFromPixelFormat(pixelFormat) == imageFormat,
- pixelFormat != QVideoFrame::Format_Invalid);
-}
-
-#define TEST_MAPPED(frame, mode) \
-do { \
- QVERIFY(frame.bits()); \
- QVERIFY(frame.isMapped()); \
- QCOMPARE(frame.mappedBytes(), 16384); \
- QCOMPARE(frame.bytesPerLine(), 256); \
- QCOMPARE(frame.mapMode(), mode); \
-} while (0)
-
-#define TEST_UNMAPPED(frame) \
-do { \
- QVERIFY(!frame.bits()); \
- QVERIFY(!frame.isMapped()); \
- QCOMPARE(frame.mappedBytes(), 0); \
- QCOMPARE(frame.bytesPerLine(), 0); \
- QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); \
-} while (0)
-
-void tst_QVideoFrame::isMapped()
-{
- QVideoFrame frame(16384, QSize(64, 64), 256, QVideoFrame::Format_ARGB32);
- const QVideoFrame& constFrame(frame);
-
- TEST_UNMAPPED(frame);
- TEST_UNMAPPED(constFrame);
-
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadOnly));
- TEST_MAPPED(frame, QAbstractVideoBuffer::ReadOnly);
- TEST_MAPPED(constFrame, QAbstractVideoBuffer::ReadOnly);
- frame.unmap();
- TEST_UNMAPPED(frame);
- TEST_UNMAPPED(constFrame);
-
- QVERIFY(frame.map(QAbstractVideoBuffer::WriteOnly));
- TEST_MAPPED(frame, QAbstractVideoBuffer::WriteOnly);
- TEST_MAPPED(constFrame, QAbstractVideoBuffer::WriteOnly);
- frame.unmap();
- TEST_UNMAPPED(frame);
- TEST_UNMAPPED(constFrame);
-
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadWrite));
- TEST_MAPPED(frame, QAbstractVideoBuffer::ReadWrite);
- TEST_MAPPED(constFrame, QAbstractVideoBuffer::ReadWrite);
- frame.unmap();
- TEST_UNMAPPED(frame);
- TEST_UNMAPPED(constFrame);
-}
-
-void tst_QVideoFrame::isReadable()
-{
- QVideoFrame frame(16384, QSize(64, 64), 256, QVideoFrame::Format_ARGB32);
-
- QVERIFY(!frame.isMapped());
- QVERIFY(!frame.isReadable());
-
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadOnly));
- QVERIFY(frame.isMapped());
- QVERIFY(frame.isReadable());
- frame.unmap();
-
- QVERIFY(frame.map(QAbstractVideoBuffer::WriteOnly));
- QVERIFY(frame.isMapped());
- QVERIFY(!frame.isReadable());
- frame.unmap();
-
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadWrite));
- QVERIFY(frame.isMapped());
- QVERIFY(frame.isReadable());
- frame.unmap();
-}
-
-void tst_QVideoFrame::isWritable()
-{
- QVideoFrame frame(16384, QSize(64, 64), 256, QVideoFrame::Format_ARGB32);
-
- QVERIFY(!frame.isMapped());
- QVERIFY(!frame.isWritable());
-
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadOnly));
- QVERIFY(frame.isMapped());
- QVERIFY(!frame.isWritable());
- frame.unmap();
-
- QVERIFY(frame.map(QAbstractVideoBuffer::WriteOnly));
- QVERIFY(frame.isMapped());
- QVERIFY(frame.isWritable());
- frame.unmap();
-
- QVERIFY(frame.map(QAbstractVideoBuffer::ReadWrite));
- QVERIFY(frame.isMapped());
- QVERIFY(frame.isWritable());
- frame.unmap();
-}
-
-
-QTEST_MAIN(tst_QVideoFrame)
-
-#include "tst_qvideoframe.moc"
diff --git a/tests/auto/qvideosurfaceformat/qvideosurfaceformat.pro b/tests/auto/qvideosurfaceformat/qvideosurfaceformat.pro
deleted file mode 100644
index a0e6266..0000000
--- a/tests/auto/qvideosurfaceformat/qvideosurfaceformat.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qvideosurfaceformat
-
-QT += core multimedia-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qvideosurfaceformat.cpp
-
diff --git a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp
deleted file mode 100644
index 4fdf984..0000000
--- a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp
+++ /dev/null
@@ -1,1067 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <QtTest/QtTest>
-
-#include <qvideosurfaceformat.h>
-
-class tst_QVideoSurfaceFormat : public QObject
-{
- Q_OBJECT
-public:
- tst_QVideoSurfaceFormat();
- ~tst_QVideoSurfaceFormat();
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
-private slots:
- void constructNull();
- void construct_data();
- void construct();
- void frameSize_data();
- void frameSize();
- void viewport_data();
- void viewport();
- void scanLineDirection_data();
- void scanLineDirection();
- void frameRate_data();
- void frameRate();
- void yCbCrColorSpace_data();
- void yCbCrColorSpace();
- void pixelAspectRatio_data();
- void pixelAspectRatio();
- void sizeHint_data();
- void sizeHint();
- void staticPropertyNames();
- void dynamicProperty();
- void compare();
- void copy();
- void assign();
-
- void isValid();
- void yCbCrColorSpaceEnum_data();
- void yCbCrColorSpaceEnum ();
- void copyAllParameters ();
- void assignAllParameters ();
-
- void propertyEdgeCases();
- void debugOperator();
- void debugOperator_data();
-};
-
-tst_QVideoSurfaceFormat::tst_QVideoSurfaceFormat()
-{
-}
-
-tst_QVideoSurfaceFormat::~tst_QVideoSurfaceFormat()
-{
-}
-
-void tst_QVideoSurfaceFormat::initTestCase()
-{
-}
-
-void tst_QVideoSurfaceFormat::cleanupTestCase()
-{
-}
-
-void tst_QVideoSurfaceFormat::init()
-{
-}
-
-void tst_QVideoSurfaceFormat::cleanup()
-{
-}
-
-void tst_QVideoSurfaceFormat::constructNull()
-{
- QVideoSurfaceFormat format;
-
- QVERIFY(!format.isValid());
- QCOMPARE(format.handleType(), QAbstractVideoBuffer::NoHandle);
- QCOMPARE(format.pixelFormat(), QVideoFrame::Format_Invalid);
- QCOMPARE(format.frameSize(), QSize());
- QCOMPARE(format.frameWidth(), -1);
- QCOMPARE(format.frameHeight(), -1);
- QCOMPARE(format.viewport(), QRect());
- QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom);
- QCOMPARE(format.frameRate(), 0.0);
- QCOMPARE(format.pixelAspectRatio(), QSize(1, 1));
- QCOMPARE(format.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined);
-}
-
-void tst_QVideoSurfaceFormat::construct_data()
-{
- QTest::addColumn<QSize>("frameSize");
- QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
- QTest::addColumn<QAbstractVideoBuffer::HandleType>("handleType");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("32x32 rgb32 no handle")
- << QSize(32, 32)
- << QVideoFrame::Format_RGB32
- << QAbstractVideoBuffer::NoHandle
- << true;
-
- QTest::newRow("1024x768 YUV444 GL texture")
- << QSize(32, 32)
- << QVideoFrame::Format_YUV444
- << QAbstractVideoBuffer::GLTextureHandle
- << true;
-
- QTest::newRow("32x32 invalid no handle")
- << QSize(32, 32)
- << QVideoFrame::Format_Invalid
- << QAbstractVideoBuffer::NoHandle
- << false;
-
- QTest::newRow("invalid size, rgb32 no handle")
- << QSize()
- << QVideoFrame::Format_RGB32
- << QAbstractVideoBuffer::NoHandle
- << false;
-
- QTest::newRow("0x0 rgb32 no handle")
- << QSize(0,0)
- << QVideoFrame::Format_RGB32
- << QAbstractVideoBuffer::NoHandle
- << true;
-}
-
-void tst_QVideoSurfaceFormat::construct()
-{
- QFETCH(QSize, frameSize);
- QFETCH(QVideoFrame::PixelFormat, pixelFormat);
- QFETCH(QAbstractVideoBuffer::HandleType, handleType);
- QFETCH(bool, valid);
-
- QRect viewport(QPoint(0, 0), frameSize);
-
- QVideoSurfaceFormat format(frameSize, pixelFormat, handleType);
-
- QCOMPARE(format.handleType(), handleType);
- QCOMPARE(format.property("handleType").value<QAbstractVideoBuffer::HandleType>(), handleType);
- QCOMPARE(format.pixelFormat(), pixelFormat);
- QCOMPARE(format.property("pixelFormat").value<QVideoFrame::PixelFormat>(), pixelFormat);
- QCOMPARE(format.frameSize(), frameSize);
- QCOMPARE(format.frameWidth(), frameSize.width());
- QCOMPARE(format.property("frameWidth").toInt(), frameSize.width());
- QCOMPARE(format.frameHeight(), frameSize.height());
- QCOMPARE(format.property("frameHeight").toInt(), frameSize.height());
- QCOMPARE(format.isValid(), valid);
- QCOMPARE(format.viewport(), viewport);
- QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom);
- QCOMPARE(format.frameRate(), 0.0);
- QCOMPARE(format.pixelAspectRatio(), QSize(1, 1));
- QCOMPARE(format.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined);
-}
-
-void tst_QVideoSurfaceFormat::frameSize_data()
-{
- QTest::addColumn<QSize>("initialSize");
- QTest::addColumn<QSize>("newSize");
-
- QTest::newRow("grow")
- << QSize(64, 64)
- << QSize(1024, 1024);
- QTest::newRow("shrink")
- << QSize(1024, 1024)
- << QSize(64, 64);
- QTest::newRow("unchanged")
- << QSize(512, 512)
- << QSize(512, 512);
-}
-
-void tst_QVideoSurfaceFormat::frameSize()
-{
- QFETCH(QSize, initialSize);
- QFETCH(QSize, newSize);
-
- {
- QVideoSurfaceFormat format(initialSize, QVideoFrame::Format_RGB32);
-
- format.setFrameSize(newSize);
-
- QCOMPARE(format.frameSize(), newSize);
- QCOMPARE(format.property("frameSize").toSize(), newSize);
- QCOMPARE(format.frameWidth(), newSize.width());
- QCOMPARE(format.property("frameWidth").toInt(), newSize.width());
- QCOMPARE(format.frameHeight(), newSize.height());
- QCOMPARE(format.property("frameHeight").toInt(), newSize.height());
- }
-
- {
- QVideoSurfaceFormat format(initialSize, QVideoFrame::Format_RGB32);
-
- format.setProperty("frameSize", newSize);
-
- QCOMPARE(format.frameSize(), newSize);
- QCOMPARE(format.property("frameSize").toSize(), newSize);
- QCOMPARE(format.frameWidth(), newSize.width());
- QCOMPARE(format.property("frameWidth").toInt(), newSize.width());
- QCOMPARE(format.frameHeight(), newSize.height());
- QCOMPARE(format.property("frameHeight").toInt(), newSize.height());
- }
-
-}
-
-void tst_QVideoSurfaceFormat::viewport_data()
-{
- QTest::addColumn<QSize>("initialSize");
- QTest::addColumn<QRect>("viewport");
- QTest::addColumn<QSize>("newSize");
- QTest::addColumn<QRect>("expectedViewport");
-
- QTest::newRow("grow reset")
- << QSize(64, 64)
- << QRect(8, 8, 48, 48)
- << QSize(1024, 1024)
- << QRect(0, 0, 1024, 1024);
- QTest::newRow("shrink reset")
- << QSize(1024, 1024)
- << QRect(8, 8, 1008, 1008)
- << QSize(64, 64)
- << QRect(0, 0, 64, 64);
- QTest::newRow("unchanged reset")
- << QSize(512, 512)
- << QRect(8, 8, 496, 496)
- << QSize(512, 512)
- << QRect(0, 0, 512, 512);
-}
-
-void tst_QVideoSurfaceFormat::viewport()
-{
- QFETCH(QSize, initialSize);
- QFETCH(QRect, viewport);
- QFETCH(QSize, newSize);
- QFETCH(QRect, expectedViewport);
-
- {
- QRect initialViewport(QPoint(0, 0), initialSize);
-
- QVideoSurfaceFormat format(initialSize, QVideoFrame::Format_RGB32);
-
- format.setViewport(viewport);
-
- QCOMPARE(format.viewport(), viewport);
- QCOMPARE(format.property("viewport").toRect(), viewport);
-
- format.setFrameSize(newSize);
-
- QCOMPARE(format.viewport(), expectedViewport);
- QCOMPARE(format.property("viewport").toRect(), expectedViewport);
- }
- {
- QVideoSurfaceFormat format(initialSize, QVideoFrame::Format_RGB32);
-
- format.setProperty("viewport", viewport);
-
- QCOMPARE(format.viewport(), viewport);
- QCOMPARE(format.property("viewport").toRect(), viewport);
- }
-}
-
-void tst_QVideoSurfaceFormat::scanLineDirection_data()
-{
- QTest::addColumn<QVideoSurfaceFormat::Direction>("direction");
-
- QTest::newRow("top to bottom")
- << QVideoSurfaceFormat::TopToBottom;
-
- QTest::newRow("bottom to top")
- << QVideoSurfaceFormat::BottomToTop;
-}
-
-void tst_QVideoSurfaceFormat::scanLineDirection()
-{
- QFETCH(QVideoSurfaceFormat::Direction, direction);
-
- {
- QVideoSurfaceFormat format(QSize(16, 16), QVideoFrame::Format_RGB32);
-
- format.setScanLineDirection(direction);
-
- QCOMPARE(format.scanLineDirection(), direction);
- QCOMPARE(
- qvariant_cast<QVideoSurfaceFormat::Direction>(format.property("scanLineDirection")),
- direction);
- }
- {
- QVideoSurfaceFormat format(QSize(16, 16), QVideoFrame::Format_RGB32);
-
- format.setProperty("scanLineDirection", qVariantFromValue(direction));
-
- QCOMPARE(format.scanLineDirection(), direction);
- QCOMPARE(
- qvariant_cast<QVideoSurfaceFormat::Direction>(format.property("scanLineDirection")),
- direction);
- }
-}
-
-void tst_QVideoSurfaceFormat::frameRate_data()
-{
- QTest::addColumn<qreal>("frameRate");
-
- QTest::newRow("null")
- << qreal(0.0);
- QTest::newRow("1/1")
- << qreal(1.0);
- QTest::newRow("24/1")
- << qreal(24.0);
- QTest::newRow("15/2")
- << qreal(7.5);
-}
-
-void tst_QVideoSurfaceFormat::frameRate()
-{
- QFETCH(qreal, frameRate);
-
- {
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
-
- format.setFrameRate(frameRate);
-
- QCOMPARE(format.frameRate(), frameRate);
- QCOMPARE(qvariant_cast<qreal>(format.property("frameRate")), frameRate);
- }
- {
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
-
- format.setFrameRate(frameRate);
- format.setProperty("frameRate", frameRate);
-
- QCOMPARE(format.frameRate(), frameRate);
- QCOMPARE(qvariant_cast<qreal>(format.property("frameRate")), frameRate);
- }
-}
-
-void tst_QVideoSurfaceFormat::yCbCrColorSpace_data()
-{
- QTest::addColumn<QVideoSurfaceFormat::YCbCrColorSpace>("colorspace");
-
- QTest::newRow("undefined")
- << QVideoSurfaceFormat::YCbCr_Undefined;
- QTest::newRow("bt709")
- << QVideoSurfaceFormat::YCbCr_BT709;
- QTest::newRow("xvYCC601")
- << QVideoSurfaceFormat::YCbCr_xvYCC601;
- QTest::newRow("JPEG")
- << QVideoSurfaceFormat::YCbCr_JPEG;
-}
-
-void tst_QVideoSurfaceFormat::yCbCrColorSpace()
-{
- QFETCH(QVideoSurfaceFormat::YCbCrColorSpace, colorspace);
-
- {
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
- format.setYCbCrColorSpace(colorspace);
-
- QCOMPARE(format.yCbCrColorSpace(), colorspace);
- QCOMPARE(qvariant_cast<QVideoSurfaceFormat::YCbCrColorSpace>(format.property("yCbCrColorSpace")),
- colorspace);
- }
- {
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
- format.setProperty("yCbCrColorSpace", qVariantFromValue(colorspace));
-
- QCOMPARE(format.yCbCrColorSpace(), colorspace);
- QCOMPARE(qvariant_cast<QVideoSurfaceFormat::YCbCrColorSpace>(format.property("yCbCrColorSpace")),
- colorspace);
- }
-}
-
-void tst_QVideoSurfaceFormat::pixelAspectRatio_data()
-{
- QTest::addColumn<QSize>("aspectRatio");
-
- QTest::newRow("1:1")
- << QSize(1, 1);
- QTest::newRow("4:3")
- << QSize(4, 3);
- QTest::newRow("16:9")
- << QSize(16, 9);
-}
-
-void tst_QVideoSurfaceFormat::pixelAspectRatio()
-{
- QFETCH(QSize, aspectRatio);
-
- {
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
- format.setPixelAspectRatio(aspectRatio);
-
- QCOMPARE(format.pixelAspectRatio(), aspectRatio);
- QCOMPARE(format.property("pixelAspectRatio").toSize(), aspectRatio);
- }
- {
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
- format.setPixelAspectRatio(aspectRatio.width(), aspectRatio.height());
-
- QCOMPARE(format.pixelAspectRatio(), aspectRatio);
- QCOMPARE(format.property("pixelAspectRatio").toSize(), aspectRatio);
- }
- {
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
- format.setProperty("pixelAspectRatio", aspectRatio);
-
- QCOMPARE(format.pixelAspectRatio(), aspectRatio);
- QCOMPARE(format.property("pixelAspectRatio").toSize(), aspectRatio);
- }
-}
-
-void tst_QVideoSurfaceFormat::sizeHint_data()
-{
- QTest::addColumn<QSize>("frameSize");
- QTest::addColumn<QRect>("viewport");
- QTest::addColumn<QSize>("aspectRatio");
- QTest::addColumn<QSize>("sizeHint");
-
- QTest::newRow("(0, 0, 1024x768), 1:1")
- << QSize(1024, 768)
- << QRect(0, 0, 1024, 768)
- << QSize(1, 1)
- << QSize(1024, 768);
- QTest::newRow("0, 0, 1024x768), 4:3")
- << QSize(1024, 768)
- << QRect(0, 0, 1024, 768)
- << QSize(4, 3)
- << QSize(1365, 768);
- QTest::newRow("(168, 84, 800x600), 1:1")
- << QSize(1024, 768)
- << QRect(168, 84, 800, 600)
- << QSize(1, 1)
- << QSize(800, 600);
- QTest::newRow("(168, 84, 800x600), 4:3")
- << QSize(1024, 768)
- << QRect(168, 84, 800, 600)
- << QSize(4, 3)
- << QSize(1066, 600);
- QTest::newRow("(168, 84, 800x600), 4:0")
- << QSize(1024, 768)
- << QRect(168, 84, 800, 600)
- << QSize(4, 0)
- << QSize(800, 600);
-}
-
-void tst_QVideoSurfaceFormat::sizeHint()
-{
- QFETCH(QSize, frameSize);
- QFETCH(QRect, viewport);
- QFETCH(QSize, aspectRatio);
- QFETCH(QSize, sizeHint);
-
- QVideoSurfaceFormat format(frameSize, QVideoFrame::Format_RGB32);
- format.setViewport(viewport);
- format.setPixelAspectRatio(aspectRatio);
-
- QCOMPARE(format.sizeHint(), sizeHint);
- QCOMPARE(format.property("sizeHint").toSize(), sizeHint);
-}
-
-void tst_QVideoSurfaceFormat::staticPropertyNames()
-{
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
-
- QList<QByteArray> propertyNames = format.propertyNames();
-
- QVERIFY(propertyNames.contains("handleType"));
- QVERIFY(propertyNames.contains("pixelFormat"));
- QVERIFY(propertyNames.contains("frameSize"));
- QVERIFY(propertyNames.contains("frameWidth"));
- QVERIFY(propertyNames.contains("viewport"));
- QVERIFY(propertyNames.contains("scanLineDirection"));
- QVERIFY(propertyNames.contains("frameRate"));
- QVERIFY(propertyNames.contains("pixelAspectRatio"));
- QVERIFY(propertyNames.contains("yCbCrColorSpace"));
- QVERIFY(propertyNames.contains("sizeHint"));
- QCOMPARE(propertyNames.count(), 10);
-}
-
-void tst_QVideoSurfaceFormat::dynamicProperty()
-{
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
-
- QCOMPARE(format.property("integer"), QVariant());
- QCOMPARE(format.property("size"), QVariant());
- QCOMPARE(format.property("string"), QVariant());
- QCOMPARE(format.property("null"), QVariant());
-
- QList<QByteArray> propertyNames = format.propertyNames();
-
- QCOMPARE(propertyNames.count(QByteArray("integer")), 0);
- QCOMPARE(propertyNames.count(QByteArray("string")), 0);
- QCOMPARE(propertyNames.count(QByteArray("size")), 0);
- QCOMPARE(propertyNames.count(QByteArray("null")), 0);
-
- format.setProperty("string", QString::fromLatin1("Hello"));
- format.setProperty("integer", 198);
- format.setProperty("size", QSize(43, 65));
-
- QCOMPARE(format.property("integer").toInt(), 198);
- QCOMPARE(format.property("size").toSize(), QSize(43, 65));
- QCOMPARE(format.property("string").toString(), QString::fromLatin1("Hello"));
-
- propertyNames = format.propertyNames();
-
- QCOMPARE(propertyNames.count(QByteArray("integer")), 1);
- QCOMPARE(propertyNames.count(QByteArray("string")), 1);
- QCOMPARE(propertyNames.count(QByteArray("size")), 1);
-
- format.setProperty("integer", 125423);
- format.setProperty("size", QSize(1, 986));
-
- QCOMPARE(format.property("integer").toInt(), 125423);
- QCOMPARE(format.property("size").toSize(), QSize(1, 986));
- QCOMPARE(format.property("string").toString(), QString::fromLatin1("Hello"));
-
- propertyNames = format.propertyNames();
-
- QCOMPARE(propertyNames.count(QByteArray("integer")), 1);
- QCOMPARE(propertyNames.count(QByteArray("string")), 1);
- QCOMPARE(propertyNames.count(QByteArray("size")), 1);
-
- format.setProperty("string", QVariant());
- format.setProperty("size", QVariant());
- format.setProperty("null", QVariant());
-
- QCOMPARE(format.property("integer").toInt(), 125423);
- QCOMPARE(format.property("size"), QVariant());
- QCOMPARE(format.property("string"), QVariant());
- QCOMPARE(format.property("null"), QVariant());
-
- propertyNames = format.propertyNames();
-
- QCOMPARE(propertyNames.count(QByteArray("integer")), 1);
- QCOMPARE(propertyNames.count(QByteArray("string")), 0);
- QCOMPARE(propertyNames.count(QByteArray("size")), 0);
- QCOMPARE(propertyNames.count(QByteArray("null")), 0);
-}
-
-void tst_QVideoSurfaceFormat::compare()
-{
- QVideoSurfaceFormat format1(
- QSize(16, 16), QVideoFrame::Format_RGB32, QAbstractVideoBuffer::GLTextureHandle);
- QVideoSurfaceFormat format2(
- QSize(16, 16), QVideoFrame::Format_RGB32, QAbstractVideoBuffer::GLTextureHandle);
- QVideoSurfaceFormat format3(
- QSize(32, 32), QVideoFrame::Format_YUV444, QAbstractVideoBuffer::GLTextureHandle);
- QVideoSurfaceFormat format4(
- QSize(16, 16), QVideoFrame::Format_RGB32, QAbstractVideoBuffer::UserHandle);
-
- QCOMPARE(format1 == format2, true);
- QCOMPARE(format1 != format2, false);
- QCOMPARE(format1 == format3, false);
- QCOMPARE(format1 != format3, true);
- QCOMPARE(format1 == format4, false);
- QCOMPARE(format1 != format4, true);
-
- format2.setFrameSize(1024, 768);
-
- // Not equal, frame size differs.
- QCOMPARE(format1 == format2, false);
- QCOMPARE(format1 != format2, true);
-
- format1.setFrameSize(1024, 768);
-
- // Equal.
- QCOMPARE(format1 == format2, true);
- QCOMPARE(format1 != format2, false);
-
- format1.setViewport(QRect(0, 0, 800, 600));
- format2.setViewport(QRect(112, 84, 800, 600));
-
- // Not equal, viewports differ.
- QCOMPARE(format1 == format2, false);
- QCOMPARE(format1 != format2, true);
-
- format1.setViewport(QRect(112, 84, 800, 600));
-
- // Equal.
- QCOMPARE(format1 == format2, true);
- QCOMPARE(format1 != format2, false);
-
- format2.setScanLineDirection(QVideoSurfaceFormat::BottomToTop);
-
- // Not equal scan line direction differs.
- QCOMPARE(format1 == format2, false);
- QCOMPARE(format1 != format2, true);
-
- format1.setScanLineDirection(QVideoSurfaceFormat::BottomToTop);
-
- // Equal.
- QCOMPARE(format1 == format2, true);
- QCOMPARE(format1 != format2, false);
-
- format1.setFrameRate(7.5);
-
- // Not equal frame rate differs.
- QCOMPARE(format1 == format2, false);
- QCOMPARE(format1 != format2, true);
-
- format2.setFrameRate(qreal(7.50001));
-
- // Equal.
- QCOMPARE(format1 == format2, true);
- QCOMPARE(format1 != format2, false);
-
- format2.setPixelAspectRatio(4, 3);
-
- // Not equal pixel aspect ratio differs.
- QCOMPARE(format1 == format2, false);
- QCOMPARE(format1 != format2, true);
-
- format1.setPixelAspectRatio(QSize(4, 3));
-
- // Equal.
- QCOMPARE(format1 == format2, true);
- QCOMPARE(format1 != format2, false);
-
- format2.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601);
-
- // Not equal yuv color space differs.
- QCOMPARE(format1 == format2, false);
- QCOMPARE(format1 != format2, true);
-
- format1.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601);
-
- // Equal.
- QCOMPARE(format1 == format2, true);
- QCOMPARE(format1 != format2, false);
-
- format1.setProperty("integer", 12);
-
- // Not equal, property mismatch.
- QCOMPARE(format1 == format2, false);
- QCOMPARE(format1 != format2, true);
-
- format2.setProperty("integer", 45);
-
- // Not equal, integer differs.
- QCOMPARE(format1 == format2, false);
- QCOMPARE(format1 != format2, true);
-
- format2.setProperty("integer", 12);
-
- // Equal.
- QCOMPARE(format1 == format2, true);
- QCOMPARE(format1 != format2, false);
-
- format1.setProperty("string", QString::fromLatin1("Hello"));
- format2.setProperty("size", QSize(12, 54));
-
- // Not equal, property mismatch.
- QCOMPARE(format1 == format2, false);
- QCOMPARE(format1 != format2, true);
-
- format2.setProperty("string", QString::fromLatin1("Hello"));
- format1.setProperty("size", QSize(12, 54));
-
- // Equal.
- QCOMPARE(format1 == format2, true);
- QCOMPARE(format1 != format2, false);
-
- format1.setProperty("string", QVariant());
-
- // Not equal, property mismatch.
- QCOMPARE(format1 == format2, false);
- QCOMPARE(format1 != format2, true);
-}
-
-
-void tst_QVideoSurfaceFormat::copy()
-{
- QVideoSurfaceFormat original(
- QSize(1024, 768), QVideoFrame::Format_ARGB32, QAbstractVideoBuffer::GLTextureHandle);
- original.setScanLineDirection(QVideoSurfaceFormat::BottomToTop);
-
- QVideoSurfaceFormat copy(original);
-
- QCOMPARE(copy.handleType(), QAbstractVideoBuffer::GLTextureHandle);
- QCOMPARE(copy.pixelFormat(), QVideoFrame::Format_ARGB32);
- QCOMPARE(copy.frameSize(), QSize(1024, 768));
- QCOMPARE(copy.scanLineDirection(), QVideoSurfaceFormat::BottomToTop);
-
- QCOMPARE(original == copy, true);
- QCOMPARE(original != copy, false);
-
- copy.setScanLineDirection(QVideoSurfaceFormat::TopToBottom);
-
- QCOMPARE(copy.scanLineDirection(), QVideoSurfaceFormat::TopToBottom);
-
- QCOMPARE(original.scanLineDirection(), QVideoSurfaceFormat::BottomToTop);
-
- QCOMPARE(original == copy, false);
- QCOMPARE(original != copy, true);
-}
-
-void tst_QVideoSurfaceFormat::assign()
-{
- QVideoSurfaceFormat copy(
- QSize(64, 64), QVideoFrame::Format_AYUV444, QAbstractVideoBuffer::UserHandle);
-
- QVideoSurfaceFormat original(
- QSize(1024, 768), QVideoFrame::Format_ARGB32, QAbstractVideoBuffer::GLTextureHandle);
- original.setScanLineDirection(QVideoSurfaceFormat::BottomToTop);
-
- copy = original;
-
- QCOMPARE(copy.handleType(), QAbstractVideoBuffer::GLTextureHandle);
- QCOMPARE(copy.pixelFormat(), QVideoFrame::Format_ARGB32);
- QCOMPARE(copy.frameSize(), QSize(1024, 768));
- QCOMPARE(copy.scanLineDirection(), QVideoSurfaceFormat::BottomToTop);
-
- QCOMPARE(original == copy, true);
- QCOMPARE(original != copy, false);
-
- copy.setScanLineDirection(QVideoSurfaceFormat::TopToBottom);
-
- QCOMPARE(copy.scanLineDirection(), QVideoSurfaceFormat::TopToBottom);
-
- QCOMPARE(original.scanLineDirection(), QVideoSurfaceFormat::BottomToTop);
-
- QCOMPARE(original == copy, false);
- QCOMPARE(original != copy, true);
-}
-
-/* Test case for Enum YCbCr_BT601, YCbCr_xvYCC709 */
-
-#define ADD_YCBCR_TEST(x) \
- QTest::newRow(#x) \
- << QVideoSurfaceFormat::x \
- << QString(QLatin1String(#x));
-
-void tst_QVideoSurfaceFormat::yCbCrColorSpaceEnum_data()
-{
- QTest::addColumn<QVideoSurfaceFormat::YCbCrColorSpace>("colorspace");
- QTest::addColumn<QString>("stringized");
-
- ADD_YCBCR_TEST(YCbCr_BT601);
- ADD_YCBCR_TEST(YCbCr_BT709);
- ADD_YCBCR_TEST(YCbCr_xvYCC601);
- ADD_YCBCR_TEST(YCbCr_xvYCC709);
- ADD_YCBCR_TEST(YCbCr_JPEG);
- ADD_YCBCR_TEST(YCbCr_CustomMatrix);
- ADD_YCBCR_TEST(YCbCr_Undefined);
-}
-
-/* Test case for Enum YCbCr_BT601, YCbCr_xvYCC709 */
-void tst_QVideoSurfaceFormat::yCbCrColorSpaceEnum()
-{
- QFETCH(QVideoSurfaceFormat::YCbCrColorSpace, colorspace);
- QFETCH(QString, stringized);
-
- {
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
- format.setYCbCrColorSpace(colorspace);
-
- QCOMPARE(format.yCbCrColorSpace(), colorspace);
- QCOMPARE(qvariant_cast<QVideoSurfaceFormat::YCbCrColorSpace>(format.property("yCbCrColorSpace")),
- colorspace);
- }
- {
- QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
- format.setProperty("yCbCrColorSpace", qVariantFromValue(colorspace));
-
- QCOMPARE(format.yCbCrColorSpace(), colorspace);
- QCOMPARE(qvariant_cast<QVideoSurfaceFormat::YCbCrColorSpace>(format.property("yCbCrColorSpace")),
- colorspace);
- }
-
- QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
- qDebug() << colorspace;
-}
-
-/* Test case for api isValid */
-void tst_QVideoSurfaceFormat::isValid()
-{
- /* When both pixel format and framesize is not valid */
- QVideoSurfaceFormat format;
- QVERIFY(!format.isValid());
-
- /* When framesize is valid and pixel format is not valid */
- format.setFrameSize(64,64);
- QVERIFY(format.frameSize() == QSize(64,64));
- QVERIFY(!format.pixelFormat());
- QVERIFY(!format.isValid());
-
- /* When both the pixel format and framesize is valid. */
- QVideoSurfaceFormat format1(QSize(32, 32), QVideoFrame::Format_AYUV444);
- QVERIFY(format1.isValid());
-
- /* When pixel format is valid and frame size is not valid */
- format1.setFrameSize(-1,-1);
- QVERIFY(!format1.frameSize().isValid());
- QVERIFY(!format1.isValid());
-}
-
-/* Test case for copy constructor with all the parameters. */
-void tst_QVideoSurfaceFormat::copyAllParameters()
-{
- /* Create the instance and set all the parameters. */
- QVideoSurfaceFormat original(
- QSize(1024, 768), QVideoFrame::Format_ARGB32, QAbstractVideoBuffer::GLTextureHandle);
-
- original.setScanLineDirection(QVideoSurfaceFormat::BottomToTop);
- original.setViewport(QRect(0, 0, 1024, 1024));
- original.setFrameRate(qreal(15.0));
- original.setPixelAspectRatio(QSize(320,480));
- original.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_BT709);
-
- /* Copy the original instance to copy and verify if both the instances
- have the same parameters. */
- QVideoSurfaceFormat copy(original);
-
- QCOMPARE(copy.handleType(), QAbstractVideoBuffer::GLTextureHandle);
- QCOMPARE(copy.pixelFormat(), QVideoFrame::Format_ARGB32);
- QCOMPARE(copy.frameSize(), QSize(1024, 768));
- QCOMPARE(copy.scanLineDirection(), QVideoSurfaceFormat::BottomToTop);
- QCOMPARE(copy.viewport(), QRect(0, 0, 1024, 1024));
- QCOMPARE(copy.frameRate(), qreal(15.0));
- QCOMPARE(copy.pixelAspectRatio(), QSize(320,480));
- QCOMPARE(copy.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_BT709);
-
- /* Verify if both the instances are eqaul */
- QCOMPARE(original == copy, true);
- QCOMPARE(original != copy, false);
-}
-
-/* Test case for copy constructor with all the parameters. */
-void tst_QVideoSurfaceFormat::assignAllParameters()
-{
- /* Create the instance and set all the parameters. */
- QVideoSurfaceFormat copy(
- QSize(64, 64), QVideoFrame::Format_AYUV444, QAbstractVideoBuffer::UserHandle);
- copy.setScanLineDirection(QVideoSurfaceFormat::TopToBottom);
- copy.setViewport(QRect(0, 0, 640, 320));
- copy.setFrameRate(qreal(7.5));
- copy.setPixelAspectRatio(QSize(640,320));
- copy.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_BT601);
-
- /* Create the instance and set all the parameters. */
- QVideoSurfaceFormat original(
- QSize(1024, 768), QVideoFrame::Format_ARGB32, QAbstractVideoBuffer::GLTextureHandle);
- original.setScanLineDirection(QVideoSurfaceFormat::BottomToTop);
- original.setViewport(QRect(0, 0, 1024, 1024));
- original.setFrameRate(qreal(15.0));
- original.setPixelAspectRatio(QSize(320,480));
- original.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_BT709);
-
- /* Assign the original instance to copy and verify if both the instancess
- have the same parameters. */
- copy = original;
-
- QCOMPARE(copy.handleType(), QAbstractVideoBuffer::GLTextureHandle);
- QCOMPARE(copy.pixelFormat(), QVideoFrame::Format_ARGB32);
- QCOMPARE(copy.frameSize(), QSize(1024, 768));
- QCOMPARE(copy.scanLineDirection(), QVideoSurfaceFormat::BottomToTop);
- QCOMPARE(copy.viewport(), QRect(0, 0, 1024, 1024));
- QCOMPARE(copy.frameRate(), qreal(15.0));
- QCOMPARE(copy.pixelAspectRatio(), QSize(320,480));
- QCOMPARE(copy.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_BT709);
-
- /* Verify if both the instances are eqaul */
- QCOMPARE(original == copy, true);
- QCOMPARE(original != copy, false);
-}
-
-void tst_QVideoSurfaceFormat::propertyEdgeCases()
-{
- // Test setting read only properties doesn't change anything
- QVideoSurfaceFormat original(
- QSize(1024, 768), QVideoFrame::Format_ARGB32, QAbstractVideoBuffer::GLTextureHandle);
-
- original.setProperty("handleType", QAbstractVideoBuffer::UserHandle);
- QCOMPARE(original.handleType(), QAbstractVideoBuffer::GLTextureHandle);
-
- original.setProperty("pixelFormat", QVideoFrame::Format_AYUV444);
- QCOMPARE(original.pixelFormat(), QVideoFrame::Format_ARGB32);
-
- original.setProperty("frameWidth", 512);
- QCOMPARE(original.frameWidth(), 1024);
-
- original.setProperty("frameHeight", 77);
- QCOMPARE(original.frameHeight(), 768);
-
- original.setProperty("sizeHint", QSize(512, 384));
- QCOMPARE(original.sizeHint(), QSize(1024,768));
-
- // Now test setting some r/w properties with the wrong data type
- original.setProperty("frameSize", Qt::red);
- QCOMPARE(original.frameSize(), QSize(1024, 768));
-
- original.setProperty("viewport", Qt::red);
- QCOMPARE(original.viewport(), QRect(0, 0, 1024, 768));
-
- original.setScanLineDirection(QVideoSurfaceFormat::BottomToTop);
- original.setProperty("scanLineDirection", Qt::red);
- QCOMPARE(original.scanLineDirection(), QVideoSurfaceFormat::BottomToTop);
-
- original.setFrameRate(32);
- original.setProperty("frameRate", QSize(32, 43));
- QCOMPARE(original.frameRate(), qreal(32));
-
- original.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_BT709);
- original.setProperty("yCbCrColorSpace", QSize(43,43));
- QCOMPARE(original.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_BT709);
-
- original.setPixelAspectRatio(53, 45);
- original.setProperty("pixelAspectRatio", Qt::red);
- QCOMPARE(original.pixelAspectRatio(), QSize(53, 45));
-}
-
-#define ADDDEBUGTEST(format, w, h, r) \
- QTest::newRow(#format "-" #w "x" #h "@" #r) \
- << QVideoFrame::Format_ ##format \
- << "Format_" #format \
- << QSize(w, h) \
- << r;
-
-void tst_QVideoSurfaceFormat::debugOperator_data()
-{
- // This is not too exhaustive
- QTest::addColumn<QVideoFrame::PixelFormat>("format");
- QTest::addColumn<QString>("formatString");
- QTest::addColumn<QSize>("frameSize");
- QTest::addColumn<int>("frameRate"); // could be double, but formatting is unstable
-
- ADDDEBUGTEST(Invalid, 100, 200, 3);
- ADDDEBUGTEST(ARGB32,101, 201, 4);
- ADDDEBUGTEST(ARGB32_Premultiplied, 100, 202, 5);
- ADDDEBUGTEST(RGB32, 8, 16, 30);
- ADDDEBUGTEST(RGB24, 8, 16, 30);
- ADDDEBUGTEST(RGB565, 8, 16, 30);
- ADDDEBUGTEST(RGB555, 8, 16, 30);
- ADDDEBUGTEST(ARGB8565_Premultiplied, 8, 16, 30);
- ADDDEBUGTEST(BGRA32, 8, 16, 30);
- ADDDEBUGTEST(BGRA32_Premultiplied, 8, 16, 30);
- ADDDEBUGTEST(BGR32, 8, 16, 30);
- ADDDEBUGTEST(BGR24, 8, 16, 30);
- ADDDEBUGTEST(BGR565, 8, 16, 30);
- ADDDEBUGTEST(BGR555, 8, 16, 30);
- ADDDEBUGTEST(BGRA5658_Premultiplied, 8, 16, 30);
-
- ADDDEBUGTEST(AYUV444, 8, 16, 30);
- ADDDEBUGTEST(AYUV444, 8, 16, 31);
- ADDDEBUGTEST(AYUV444_Premultiplied, 8, 16, 30);
- ADDDEBUGTEST(YUV444, 8, 16, 30);
- ADDDEBUGTEST(YUV420P, 8, 16, 30);
- ADDDEBUGTEST(YV12, 8, 16, 30);
- ADDDEBUGTEST(UYVY, 8, 16, 30);
- ADDDEBUGTEST(YUYV, 8, 16, 30);
- ADDDEBUGTEST(NV12, 8, 16, 30);
- ADDDEBUGTEST(NV12, 80, 16, 30);
- ADDDEBUGTEST(NV21, 8, 16, 30);
- ADDDEBUGTEST(IMC1, 8, 16, 30);
- ADDDEBUGTEST(IMC2, 8, 16, 30);
- ADDDEBUGTEST(IMC3, 8, 16, 30);
- ADDDEBUGTEST(IMC3, 8, 160, 30);
- ADDDEBUGTEST(IMC4, 8, 16, 30);
- ADDDEBUGTEST(Y8, 8, 16, 30);
- ADDDEBUGTEST(Y16, 8, 16, 30);
-
- ADDDEBUGTEST(Jpeg, 8, 16, 30);
-
- ADDDEBUGTEST(CameraRaw, 8, 16, 30);
- ADDDEBUGTEST(AdobeDng, 8, 16, 30);
-
- // User is special
- QTest::newRow("User-0x0@0)")
- << QVideoFrame::Format_User
- << "UserType(1000)"
- << QSize()
- << 0;
-}
-
-void tst_QVideoSurfaceFormat::debugOperator()
-{
- QFETCH(QVideoFrame::PixelFormat, format);
- QFETCH(QString, formatString);
- QFETCH(QSize, frameSize);
- QFETCH(int, frameRate);
-
- QString templateOutput = QString("QVideoSurfaceFormat(%1, QSize(%2, %3) , viewport=QRect(0,1 800x600) , pixelAspectRatio=QSize(320, 200) "
- ", handleType=GLTextureHandle, yCbCrColorSpace=YCbCr_BT709)\n"
- " handleType = QVariant(QAbstractVideoBuffer::HandleType, ) \n"
- " pixelFormat = QVariant(QVideoFrame::PixelFormat, ) \n"
- " frameSize = QVariant(QSize, QSize(%4, %5) ) \n"
- " frameWidth = QVariant(int, %6) \n"
- " viewport = QVariant(QRect, QRect(0,1 800x600) ) \n"
- " scanLineDirection = QVariant(QVideoSurfaceFormat::Direction, ) \n"
-#if defined(QT_ARCH_ARM) // from qglobal.h
- " frameRate = QVariant(float, %7) \n"
-#else
- " frameRate = QVariant(double, %7) \n"
-#endif
- " pixelAspectRatio = QVariant(QSize, QSize(320, 200) ) \n"
- " sizeHint = QVariant(QSize, QSize(1280, 600) ) \n"
- " yCbCrColorSpace = QVariant(QVideoSurfaceFormat::YCbCrColorSpace, ) ")
- .arg(formatString)
- .arg(frameSize.width())
- .arg(frameSize.height())
- .arg(frameSize.width())
- .arg(frameSize.height())
- .arg(frameSize.width())
- .arg(frameRate);
-
- QVideoSurfaceFormat vsf(frameSize, format, QAbstractVideoBuffer::GLTextureHandle);
- vsf.setViewport(QRect(0,1, 800, 600));
- vsf.setPixelAspectRatio(QSize(320, 200));
- vsf.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_BT709);
- vsf.setFrameRate(frameRate);
-
- QTest::ignoreMessage(QtDebugMsg, templateOutput.toLatin1().constData());
- qDebug() << vsf;
-}
-
-
-
-QTEST_MAIN(tst_QVideoSurfaceFormat)
-
-
-
-#include "tst_qvideosurfaceformat.moc"
diff --git a/tests/auto/qvideowidget/qvideowidget.pro b/tests/auto/qvideowidget/qvideowidget.pro
deleted file mode 100644
index 4e44a1d..0000000
--- a/tests/auto/qvideowidget/qvideowidget.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qvideowidget
-
-QT += multimedia-private multimediawidgets-private testlib
-CONFIG += no_private_qt_headers_warning
-
-SOURCES += tst_qvideowidget.cpp
-
-# QPA seems to break some assumptions
-qpa:CONFIG += insignificant_test
-QT+=widgets
diff --git a/tests/auto/qvideowidget/tst_qvideowidget.cpp b/tests/auto/qvideowidget/tst_qvideowidget.cpp
deleted file mode 100644
index 9f9bafc..0000000
--- a/tests/auto/qvideowidget/tst_qvideowidget.cpp
+++ /dev/null
@@ -1,1567 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this 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 <qtmultimediadefs.h>
-#include <QtTest/QtTest>
-
-#include "qvideowidget.h"
-
-#include "qmediaobject.h"
-#include "qmediaservice.h"
-#include <private/qpaintervideosurface_p.h>
-#include "qvideowindowcontrol.h"
-#include "qvideowidgetcontrol.h"
-
-#include "qvideorenderercontrol.h"
-#include <qabstractvideosurface.h>
-#include <qvideosurfaceformat.h>
-
-#include <QtWidgets/qapplication.h>
-
-QT_USE_NAMESPACE
-class tst_QVideoWidget : public QObject
-{
- Q_OBJECT
-private slots:
- void nullObject();
- void nullService();
- void noOutputs();
- void serviceDestroyed();
- void objectDestroyed();
- void setMediaObject();
-
- void showWindowControl();
- void fullScreenWindowControl();
- void aspectRatioWindowControl();
- void sizeHintWindowControl_data() { sizeHint_data(); }
- void sizeHintWindowControl();
- void brightnessWindowControl_data() { color_data(); }
- void brightnessWindowControl();
- void contrastWindowControl_data() { color_data(); }
- void contrastWindowControl();
- void hueWindowControl_data() { color_data(); }
- void hueWindowControl();
- void saturationWindowControl_data() { color_data(); }
- void saturationWindowControl();
-
- void showWidgetControl();
- void fullScreenWidgetControl();
- void aspectRatioWidgetControl();
- void sizeHintWidgetControl_data() { sizeHint_data(); }
- void sizeHintWidgetControl();
- void brightnessWidgetControl_data() { color_data(); }
- void brightnessWidgetControl();
- void contrastWidgetControl_data() { color_data(); }
- void contrastWidgetControl();
- void hueWidgetControl_data() { color_data(); }
- void hueWidgetControl();
- void saturationWidgetControl_data() { color_data(); }
- void saturationWidgetControl();
-
- void showRendererControl();
- void fullScreenRendererControl();
- void aspectRatioRendererControl();
- void sizeHintRendererControl_data();
- void sizeHintRendererControl();
- void brightnessRendererControl_data() { color_data(); }
- void brightnessRendererControl();
- void contrastRendererControl_data() { color_data(); }
- void contrastRendererControl();
- void hueRendererControl_data() { color_data(); }
- void hueRendererControl();
- void saturationRendererControl_data() { color_data(); }
- void saturationRendererControl();
-
- void paintRendererControl();
-
-private:
- void sizeHint_data();
- void color_data();
-};
-
-Q_DECLARE_METATYPE(Qt::AspectRatioMode)
-Q_DECLARE_METATYPE(const uchar *)
-
-class QtTestWindowControl : public QVideoWindowControl
-{
-public:
- QtTestWindowControl()
- : m_winId(0)
- , m_repaintCount(0)
- , m_brightness(0)
- , m_contrast(0)
- , m_saturation(0)
- , m_aspectRatioMode(Qt::KeepAspectRatio)
- , m_fullScreen(0)
- {
- }
-
- WId winId() const { return m_winId; }
- void setWinId(WId id) { m_winId = id; }
-
- QRect displayRect() const { return m_displayRect; }
- void setDisplayRect(const QRect &rect) { m_displayRect = rect; }
-
- bool isFullScreen() const { return m_fullScreen; }
- void setFullScreen(bool fullScreen) { emit fullScreenChanged(m_fullScreen = fullScreen); }
-
- int repaintCount() const { return m_repaintCount; }
- void setRepaintCount(int count) { m_repaintCount = count; }
- void repaint() { ++m_repaintCount; }
-
- QSize nativeSize() const { return m_nativeSize; }
- void setNativeSize(const QSize &size) { m_nativeSize = size; emit nativeSizeChanged(); }
-
- Qt::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
- void setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; }
-
- int brightness() const { return m_brightness; }
- void setBrightness(int brightness) { emit brightnessChanged(m_brightness = brightness); }
-
- int contrast() const { return m_contrast; }
- void setContrast(int contrast) { emit contrastChanged(m_contrast = contrast); }
-
- int hue() const { return m_hue; }
- void setHue(int hue) { emit hueChanged(m_hue = hue); }
-
- int saturation() const { return m_saturation; }
- void setSaturation(int saturation) { emit saturationChanged(m_saturation = saturation); }
-
-private:
- WId m_winId;
- int m_repaintCount;
- int m_brightness;
- int m_contrast;
- int m_hue;
- int m_saturation;
- Qt::AspectRatioMode m_aspectRatioMode;
- QRect m_displayRect;
- QSize m_nativeSize;
- bool m_fullScreen;
-};
-
-class QtTestWidgetControl : public QVideoWidgetControl
-{
-public:
- QtTestWidgetControl()
- : m_brightness(1.0)
- , m_contrast(1.0)
- , m_hue(1.0)
- , m_saturation(1.0)
- , m_aspectRatioMode(Qt::KeepAspectRatio)
- , m_fullScreen(false)
- {
- }
-
- bool isFullScreen() const { return m_fullScreen; }
- void setFullScreen(bool fullScreen) { emit fullScreenChanged(m_fullScreen = fullScreen); }
-
- Qt::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
- void setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; }
-
- int brightness() const { return m_brightness; }
- void setBrightness(int brightness) { emit brightnessChanged(m_brightness = brightness); }
-
- int contrast() const { return m_contrast; }
- void setContrast(int contrast) { emit contrastChanged(m_contrast = contrast); }
-
- int hue() const { return m_hue; }
- void setHue(int hue) { emit hueChanged(m_hue = hue); }
-
- int saturation() const { return m_saturation; }
- void setSaturation(int saturation) { emit saturationChanged(m_saturation = saturation); }
-
- void setSizeHint(const QSize &size) { m_widget.setSizeHint(size); }
-
- QWidget *videoWidget() { return &m_widget; }
-
-private:
- class Widget : public QWidget
- {
- public:
- QSize sizeHint() const { return m_sizeHint; }
- void setSizeHint(const QSize &size) { m_sizeHint = size; updateGeometry(); }
- private:
- QSize m_sizeHint;
- } m_widget;
- int m_brightness;
- int m_contrast;
- int m_hue;
- int m_saturation;
- Qt::AspectRatioMode m_aspectRatioMode;
- QSize m_sizeHint;
- bool m_fullScreen;
-};
-
-class QtTestRendererControl : public QVideoRendererControl
-{
-public:
- QtTestRendererControl()
- : m_surface(0)
- {
- }
-
- QAbstractVideoSurface *surface() const { return m_surface; }
- void setSurface(QAbstractVideoSurface *surface) { m_surface = surface; }
-
-private:
- QAbstractVideoSurface *m_surface;
-};
-
-class QtTestVideoService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestVideoService(
- QtTestWindowControl *window,
- QtTestWidgetControl *widget,
- QtTestRendererControl *renderer)
- : QMediaService(0)
- , windowRef(0)
- , widgetRef(0)
- , rendererRef(0)
- , windowControl(window)
- , widgetControl(widget)
- , rendererControl(renderer)
- {
- }
-
- ~QtTestVideoService()
- {
- delete windowControl;
- delete widgetControl;
- delete rendererControl;
- }
-
- QMediaControl *requestControl(const char *name)
- {
- if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
- if (windowControl) {
- windowRef += 1;
-
- return windowControl;
- }
- } else if (qstrcmp(name, QVideoWidgetControl_iid) == 0) {
- if (widgetControl) {
- widgetRef += 1;
-
- return widgetControl;
- }
- } else if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
- if (rendererControl) {
- rendererRef += 1;
-
- return rendererControl;
- }
- }
- return 0;
- }
-
- void releaseControl(QMediaControl *control)
- {
- Q_ASSERT(control);
-
- if (control == windowControl)
- windowRef -= 1;
- else if (control == widgetControl)
- widgetRef -= 1;
- else if (control == rendererControl)
- rendererRef -= 1;
- }
-
- int windowRef;
- int widgetRef;
- int rendererRef;
-
- QtTestWindowControl *windowControl;
- QtTestWidgetControl *widgetControl;
- QtTestRendererControl *rendererControl;
-};
-
-class QtTestVideoObject : public QMediaObject
-{
- Q_OBJECT
-public:
- QtTestVideoObject(
- QtTestWindowControl *window,
- QtTestWidgetControl *widget,
- QtTestRendererControl *renderer):
- QMediaObject(0, new QtTestVideoService(window, widget, renderer))
- {
- testService = qobject_cast<QtTestVideoService*>(service());
- }
-
- QtTestVideoObject(QtTestVideoService *service):
- QMediaObject(0, service),
- testService(service)
- {
- }
-
- ~QtTestVideoObject()
- {
- delete testService;
- }
-
- QtTestVideoService *testService;
-};
-
-void tst_QVideoWidget::nullObject()
-{
- QVideoWidget widget;
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QVERIFY(widget.sizeHint().isEmpty());
-
- widget.setFullScreen(true);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), true);
-
- widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- {
- QSignalSpy spy(&widget, SIGNAL(brightnessChanged(int)));
-
- widget.setBrightness(100);
- QCOMPARE(widget.brightness(), 100);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), 100);
-
- widget.setBrightness(100);
- QCOMPARE(widget.brightness(), 100);
- QCOMPARE(spy.count(), 1);
-
- widget.setBrightness(-120);
- QCOMPARE(widget.brightness(), -100);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), -100);
- } {
- QSignalSpy spy(&widget, SIGNAL(contrastChanged(int)));
-
- widget.setContrast(100);
- QCOMPARE(widget.contrast(), 100);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), 100);
-
- widget.setContrast(100);
- QCOMPARE(widget.contrast(), 100);
- QCOMPARE(spy.count(), 1);
-
- widget.setContrast(-120);
- QCOMPARE(widget.contrast(), -100);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), -100);
- } {
- QSignalSpy spy(&widget, SIGNAL(hueChanged(int)));
-
- widget.setHue(100);
- QCOMPARE(widget.hue(), 100);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), 100);
-
- widget.setHue(100);
- QCOMPARE(widget.hue(), 100);
- QCOMPARE(spy.count(), 1);
-
- widget.setHue(-120);
- QCOMPARE(widget.hue(), -100);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), -100);
- } {
- QSignalSpy spy(&widget, SIGNAL(saturationChanged(int)));
-
- widget.setSaturation(100);
- QCOMPARE(widget.saturation(), 100);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), 100);
-
- widget.setSaturation(100);
- QCOMPARE(widget.saturation(), 100);
- QCOMPARE(spy.count(), 1);
-
- widget.setSaturation(-120);
- QCOMPARE(widget.saturation(), -100);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), -100);
- }
-}
-
-void tst_QVideoWidget::nullService()
-{
- QtTestVideoObject object(0);
-
- QVideoWidget widget;
- object.bind(&widget);
-
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QVERIFY(widget.sizeHint().isEmpty());
-
- widget.setFullScreen(true);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), true);
-
- widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- widget.setBrightness(100);
- QCOMPARE(widget.brightness(), 100);
-
- widget.setContrast(100);
- QCOMPARE(widget.contrast(), 100);
-
- widget.setHue(100);
- QCOMPARE(widget.hue(), 100);
-
- widget.setSaturation(100);
- QCOMPARE(widget.saturation(), 100);
-}
-
-void tst_QVideoWidget::noOutputs()
-{
- QtTestVideoObject object(0, 0, 0);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QVERIFY(widget.sizeHint().isEmpty());
-
- widget.setFullScreen(true);
- QCOMPARE(widget.isFullScreen(), true);
-
- widget.setBrightness(100);
- QCOMPARE(widget.brightness(), 100);
-
- widget.setContrast(100);
- QCOMPARE(widget.contrast(), 100);
-
- widget.setHue(100);
- QCOMPARE(widget.hue(), 100);
-
- widget.setSaturation(100);
- QCOMPARE(widget.saturation(), 100);
-}
-
-void tst_QVideoWidget::serviceDestroyed()
-{
- QtTestVideoObject object(new QtTestWindowControl, new QtTestWidgetControl, 0);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- widget.setBrightness(100);
- widget.setContrast(100);
- widget.setHue(100);
- widget.setSaturation(100);
-
- delete object.testService;
- object.testService = 0;
-
- QCOMPARE(widget.mediaObject(), static_cast<QMediaObject *>(&object));
-
- QCOMPARE(widget.brightness(), 100);
- QCOMPARE(widget.contrast(), 100);
- QCOMPARE(widget.hue(), 100);
- QCOMPARE(widget.saturation(), 100);
-
- widget.setFullScreen(true);
- QCOMPARE(widget.isFullScreen(), true);
-}
-
-void tst_QVideoWidget::objectDestroyed()
-{
- QtTestVideoObject *object = new QtTestVideoObject(
- new QtTestWindowControl,
- new QtTestWidgetControl,
- 0);
-
- QVideoWidget widget;
- object->bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QCOMPARE(object->testService->windowRef, 0);
- QCOMPARE(object->testService->widgetRef, 1);
- QCOMPARE(object->testService->rendererRef, 0);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- widget.setBrightness(100);
- widget.setContrast(100);
- widget.setHue(100);
- widget.setSaturation(100);
-
- // Delete the media object without deleting the service.
- QtTestVideoService *service = object->testService;
- object->testService = 0;
-
- delete object;
- object = 0;
-
- QCOMPARE(widget.mediaObject(), static_cast<QMediaObject *>(object));
-
- QCOMPARE(widget.brightness(), 100);
- QCOMPARE(widget.contrast(), 100);
- QCOMPARE(widget.hue(), 100);
- QCOMPARE(widget.saturation(), 100);
-
- widget.setFullScreen(true);
- QCOMPARE(widget.isFullScreen(), true);
-
- delete service;
-}
-
-void tst_QVideoWidget::setMediaObject()
-{
- QMediaObject *nullObject = 0;
- QtTestVideoObject windowObject(new QtTestWindowControl, 0, 0);
- QtTestVideoObject widgetObject(0, new QtTestWidgetControl, 0);
- QtTestVideoObject rendererObject(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QCOMPARE(widget.mediaObject(), nullObject);
- QCOMPARE(windowObject.testService->windowRef, 0);
- QCOMPARE(widgetObject.testService->widgetRef, 0);
- QCOMPARE(rendererObject.testService->rendererRef, 0);
-
- windowObject.bind(&widget);
- QCOMPARE(widget.mediaObject(), static_cast<QMediaObject *>(&windowObject));
- QCOMPARE(windowObject.testService->windowRef, 1);
- QCOMPARE(widgetObject.testService->widgetRef, 0);
- QCOMPARE(rendererObject.testService->rendererRef, 0);
- QVERIFY(windowObject.testService->windowControl->winId() != 0);
-
-
- widgetObject.bind(&widget);
- QCOMPARE(widget.mediaObject(), static_cast<QMediaObject *>(&widgetObject));
- QCOMPARE(windowObject.testService->windowRef, 0);
- QCOMPARE(widgetObject.testService->widgetRef, 1);
- QCOMPARE(rendererObject.testService->rendererRef, 0);
-
- QCoreApplication::processEvents(QEventLoop::AllEvents);
- QCOMPARE(widgetObject.testService->widgetControl->videoWidget()->isVisible(), true);
-
- QCOMPARE(windowObject.testService->windowRef, 0);
- QCOMPARE(widgetObject.testService->widgetRef, 1);
- QCOMPARE(rendererObject.testService->rendererRef, 0);
-
- rendererObject.bind(&widget);
- QCOMPARE(widget.mediaObject(), static_cast<QMediaObject *>(&rendererObject));
-
- QCOMPARE(windowObject.testService->windowRef, 0);
- QCOMPARE(widgetObject.testService->widgetRef, 0);
- QCOMPARE(rendererObject.testService->rendererRef, 1);
- QVERIFY(rendererObject.testService->rendererControl->surface() != 0);
-
- rendererObject.unbind(&widget);
- QCOMPARE(widget.mediaObject(), nullObject);
-
- QCOMPARE(windowObject.testService->windowRef, 0);
- QCOMPARE(widgetObject.testService->widgetRef, 0);
- QCOMPARE(rendererObject.testService->rendererRef, 0);
-}
-
-void tst_QVideoWidget::showWindowControl()
-{
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setNativeSize(QSize(240, 180));
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QVERIFY(object.testService->windowControl->winId() != 0);
- QVERIFY(object.testService->windowControl->repaintCount() > 0);
-
- widget.resize(640, 480);
- QCOMPARE(object.testService->windowControl->displayRect(), QRect(0, 0, 640, 480));
-
- widget.move(10, 10);
- QCOMPARE(object.testService->windowControl->displayRect(), QRect(0, 0, 640, 480));
-
- widget.hide();
-}
-
-void tst_QVideoWidget::showWidgetControl()
-{
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->widgetControl->videoWidget()->isVisible(), true);
-
- widget.resize(640, 480);
-
- widget.move(10, 10);
-
- widget.hide();
-
- QCOMPARE(object.testService->widgetControl->videoWidget()->isVisible(), false);
-}
-
-void tst_QVideoWidget::showRendererControl()
-{
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QVERIFY(object.testService->rendererControl->surface() != 0);
-
- widget.resize(640, 480);
-
- widget.move(10, 10);
-
- widget.hide();
-}
-
-void tst_QVideoWidget::aspectRatioWindowControl()
-{
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setAspectRatioMode(Qt::IgnoreAspectRatio);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- // Test the aspect ratio defaults to keeping the aspect ratio.
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
-
- // Test the control has been informed of the aspect ratio change, post show.
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::KeepAspectRatio);
-
- // Test an aspect ratio change is enforced immediately while visible.
- widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
- QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- // Test an aspect ratio set while not visible is respected.
- widget.hide();
- widget.setAspectRatioMode(Qt::KeepAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- widget.show();
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::KeepAspectRatio);
-}
-
-void tst_QVideoWidget::aspectRatioWidgetControl()
-{
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- object.testService->widgetControl->setAspectRatioMode(Qt::IgnoreAspectRatio);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- // Test the aspect ratio defaults to keeping the aspect ratio.
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
-
- // Test the control has been informed of the aspect ratio change, post show.
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::KeepAspectRatio);
-
- // Test an aspect ratio change is enforced immediately while visible.
- widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
- QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- // Test an aspect ratio set while not visible is respected.
- widget.hide();
- widget.setAspectRatioMode(Qt::KeepAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- widget.show();
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::KeepAspectRatio);
-}
-
-void tst_QVideoWidget::aspectRatioRendererControl()
-{
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- // Test the aspect ratio defaults to keeping the aspect ratio.
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
-
- // Test the control has been informed of the aspect ratio change, post show.
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
-
- // Test an aspect ratio change is enforced immediately while visible.
- widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- // Test an aspect ratio set while not visible is respected.
- widget.hide();
- widget.setAspectRatioMode(Qt::KeepAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- widget.show();
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
-}
-
-void tst_QVideoWidget::sizeHint_data()
-{
- QTest::addColumn<QSize>("size");
-
- QTest::newRow("720x576")
- << QSize(720, 576);
-}
-
-void tst_QVideoWidget::sizeHintWindowControl()
-{
- QFETCH(QSize, size);
-
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QVERIFY(widget.sizeHint().isEmpty());
-
- object.testService->windowControl->setNativeSize(size);
- QCOMPARE(widget.sizeHint(), size);
-}
-
-void tst_QVideoWidget::sizeHintWidgetControl()
-{
- QFETCH(QSize, size);
-
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QVERIFY(widget.sizeHint().isEmpty());
-
- object.testService->widgetControl->setSizeHint(size);
- QCOMPARE(widget.sizeHint(), size);
-}
-
-void tst_QVideoWidget::sizeHintRendererControl_data()
-{
- QTest::addColumn<QSize>("frameSize");
- QTest::addColumn<QRect>("viewport");
- QTest::addColumn<QSize>("pixelAspectRatio");
- QTest::addColumn<QSize>("expectedSize");
-
- QTest::newRow("640x480")
- << QSize(640, 480)
- << QRect(0, 0, 640, 480)
- << QSize(1, 1)
- << QSize(640, 480);
-
- QTest::newRow("800x600, (80,60, 640x480) viewport")
- << QSize(800, 600)
- << QRect(80, 60, 640, 480)
- << QSize(1, 1)
- << QSize(640, 480);
-
- QTest::newRow("800x600, (80,60, 640x480) viewport, 4:3")
- << QSize(800, 600)
- << QRect(80, 60, 640, 480)
- << QSize(4, 3)
- << QSize(853, 480);
-
-}
-
-void tst_QVideoWidget::sizeHintRendererControl()
-{
- QFETCH(QSize, frameSize);
- QFETCH(QRect, viewport);
- QFETCH(QSize, pixelAspectRatio);
- QFETCH(QSize, expectedSize);
-
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QVideoSurfaceFormat format(frameSize, QVideoFrame::Format_ARGB32);
- format.setViewport(viewport);
- format.setPixelAspectRatio(pixelAspectRatio);
-
- QVERIFY(object.testService->rendererControl->surface()->start(format));
-
- QCOMPARE(widget.sizeHint(), expectedSize);
-}
-
-
-void tst_QVideoWidget::fullScreenWindowControl()
-{
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- QVideoWidget widget;
- object.bind(&widget);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- Qt::WindowFlags windowFlags = widget.windowFlags();
-
- QSignalSpy spy(&widget, SIGNAL(fullScreenChanged(bool)));
-
- // Test showing full screen with setFullScreen(true).
- widget.setFullScreen(true);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->windowControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toBool(), true);
-
- // Test returning to normal with setFullScreen(false).
- widget.setFullScreen(false);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->windowControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toBool(), false);
- QCOMPARE(widget.windowFlags(), windowFlags);
-
- // Test showing full screen with showFullScreen().
- widget.showFullScreen();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->windowControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 3);
- QCOMPARE(spy.value(2).value(0).toBool(), true);
-
- // Test returning to normal with showNormal().
- widget.showNormal();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->windowControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
- QCOMPARE(spy.value(3).value(0).toBool(), false);
- QCOMPARE(widget.windowFlags(), windowFlags);
-
- // Test setFullScreen(false) and showNormal() do nothing when isFullScreen() == false.
- widget.setFullScreen(false);
- QCOMPARE(object.testService->windowControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
- widget.showNormal();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->windowControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
-
- // Test setFullScreen(true) and showFullScreen() do nothing when isFullScreen() == true.
- widget.showFullScreen();
- QTest::qWaitForWindowShown(&widget);
- widget.setFullScreen(true);
- QCOMPARE(object.testService->windowControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 5);
- widget.showFullScreen();
- QCOMPARE(object.testService->windowControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 5);
-
- // Test if the window control exits full screen mode, the widget follows suit.
- object.testService->windowControl->setFullScreen(false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 6);
- QCOMPARE(spy.value(5).value(0).toBool(), false);
-
- // Test if the window control enters full screen mode, the widget does nothing.
- object.testService->windowControl->setFullScreen(false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 6);
-}
-
-void tst_QVideoWidget::fullScreenWidgetControl()
-{
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- QVideoWidget widget;
- object.bind(&widget);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- Qt::WindowFlags windowFlags = widget.windowFlags();
-
- QSignalSpy spy(&widget, SIGNAL(fullScreenChanged(bool)));
-
- // Test showing full screen with setFullScreen(true).
- widget.setFullScreen(true);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->widgetControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toBool(), true);
-
- // Test returning to normal with setFullScreen(false).
- widget.setFullScreen(false);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->widgetControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toBool(), false);
- QCOMPARE(widget.windowFlags(), windowFlags);
-
- // Test showing full screen with showFullScreen().
- widget.showFullScreen();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->widgetControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 3);
- QCOMPARE(spy.value(2).value(0).toBool(), true);
-
- // Test returning to normal with showNormal().
- widget.showNormal();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->widgetControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
- QCOMPARE(spy.value(3).value(0).toBool(), false);
- QCOMPARE(widget.windowFlags(), windowFlags);
-
- // Test setFullScreen(false) and showNormal() do nothing when isFullScreen() == false.
- widget.setFullScreen(false);
- QCOMPARE(object.testService->widgetControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
- widget.showNormal();
- QCOMPARE(object.testService->widgetControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
-
- // Test setFullScreen(true) and showFullScreen() do nothing when isFullScreen() == true.
- widget.showFullScreen();
- QTest::qWaitForWindowShown(&widget);
- widget.setFullScreen(true);
- QCOMPARE(object.testService->widgetControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 5);
- widget.showFullScreen();
- QCOMPARE(object.testService->widgetControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 5);
-
- // Test if the window control exits full screen mode, the widget follows suit.
- object.testService->widgetControl->setFullScreen(false);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 6);
- QCOMPARE(spy.value(5).value(0).toBool(), false);
-
- // Test if the window control enters full screen mode, the widget does nothing.
- object.testService->widgetControl->setFullScreen(false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 6);
-}
-
-
-void tst_QVideoWidget::fullScreenRendererControl()
-{
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
- QVideoWidget widget;
- object.bind(&widget);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- Qt::WindowFlags windowFlags = widget.windowFlags();
-
- QSignalSpy spy(&widget, SIGNAL(fullScreenChanged(bool)));
-
- // Test showing full screen with setFullScreen(true).
- widget.setFullScreen(true);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toBool(), true);
-
- // Test returning to normal with setFullScreen(false).
- widget.setFullScreen(false);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toBool(), false);
- QCOMPARE(widget.windowFlags(), windowFlags);
-
- // Test showing full screen with showFullScreen().
- widget.showFullScreen();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 3);
- QCOMPARE(spy.value(2).value(0).toBool(), true);
-
- // Test returning to normal with showNormal().
- widget.showNormal();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
- QCOMPARE(spy.value(3).value(0).toBool(), false);
- QCOMPARE(widget.windowFlags(), windowFlags);
-
- // Test setFullScreen(false) and showNormal() do nothing when isFullScreen() == false.
- widget.setFullScreen(false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
- widget.showNormal();
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
-
- // Test setFullScreen(true) and showFullScreen() do nothing when isFullScreen() == true.
- widget.showFullScreen();
- QTest::qWaitForWindowShown(&widget);
- widget.setFullScreen(true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 5);
- widget.showFullScreen();
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 5);
-}
-
-
-void tst_QVideoWidget::color_data()
-{
- QTest::addColumn<int>("controlValue");
- QTest::addColumn<int>("value");
- QTest::addColumn<int>("expectedValue");
-
- QTest::newRow("12")
- << 0
- << 12
- << 12;
- QTest::newRow("-56")
- << 87
- << -56
- << -56;
- QTest::newRow("100")
- << 32
- << 100
- << 100;
- QTest::newRow("1294")
- << 0
- << 1294
- << 100;
- QTest::newRow("-102")
- << 34
- << -102
- << -100;
-}
-
-void tst_QVideoWidget::brightnessWindowControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setBrightness(controlValue);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- // Test the video widget resets the controls starting brightness to the default.
- QCOMPARE(widget.brightness(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(brightnessChanged(int)));
-
- // Test the video widget sets the brightness value, bounded if necessary and emits a changed
- // signal.
- widget.setBrightness(value);
- QCOMPARE(widget.brightness(), expectedValue);
- QCOMPARE(object.testService->windowControl->brightness(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- // Test the changed signal isn't emitted if the value is unchanged.
- widget.setBrightness(value);
- QCOMPARE(widget.brightness(), expectedValue);
- QCOMPARE(object.testService->windowControl->brightness(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- // Test the changed signal is emitted if the brightness is changed internally.
- object.testService->windowControl->setBrightness(controlValue);
- QCOMPARE(widget.brightness(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::brightnessWidgetControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- object.testService->widgetControl->setBrightness(controlValue);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QCOMPARE(widget.brightness(), 0);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QSignalSpy spy(&widget, SIGNAL(brightnessChanged(int)));
-
- widget.setBrightness(value);
- QCOMPARE(widget.brightness(), expectedValue);
- QCOMPARE(object.testService->widgetControl->brightness(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setBrightness(value);
- QCOMPARE(widget.brightness(), expectedValue);
- QCOMPARE(object.testService->widgetControl->brightness(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->widgetControl->setBrightness(controlValue);
- QCOMPARE(widget.brightness(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::brightnessRendererControl()
-{
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QSignalSpy spy(&widget, SIGNAL(brightnessChanged(int)));
-
- widget.setBrightness(value);
- QCOMPARE(widget.brightness(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setBrightness(value);
- QCOMPARE(widget.brightness(), expectedValue);
- QCOMPARE(spy.count(), 1);
-}
-
-void tst_QVideoWidget::contrastWindowControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setContrast(controlValue);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QCOMPARE(widget.contrast(), 0);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.contrast(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(contrastChanged(int)));
-
- widget.setContrast(value);
- QCOMPARE(widget.contrast(), expectedValue);
- QCOMPARE(object.testService->windowControl->contrast(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setContrast(value);
- QCOMPARE(widget.contrast(), expectedValue);
- QCOMPARE(object.testService->windowControl->contrast(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->windowControl->setContrast(controlValue);
- QCOMPARE(widget.contrast(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::contrastWidgetControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- object.testService->widgetControl->setContrast(controlValue);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- QCOMPARE(widget.contrast(), 0);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.contrast(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(contrastChanged(int)));
-
- widget.setContrast(value);
- QCOMPARE(widget.contrast(), expectedValue);
- QCOMPARE(object.testService->widgetControl->contrast(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setContrast(value);
- QCOMPARE(widget.contrast(), expectedValue);
- QCOMPARE(object.testService->widgetControl->contrast(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->widgetControl->setContrast(controlValue);
- QCOMPARE(widget.contrast(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::contrastRendererControl()
-{
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QSignalSpy spy(&widget, SIGNAL(contrastChanged(int)));
-
- widget.setContrast(value);
- QCOMPARE(widget.contrast(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setContrast(value);
- QCOMPARE(widget.contrast(), expectedValue);
- QCOMPARE(spy.count(), 1);
-}
-
-void tst_QVideoWidget::hueWindowControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setHue(controlValue);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- QCOMPARE(widget.hue(), 0);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.hue(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(hueChanged(int)));
-
- widget.setHue(value);
- QCOMPARE(widget.hue(), expectedValue);
- QCOMPARE(object.testService->windowControl->hue(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setHue(value);
- QCOMPARE(widget.hue(), expectedValue);
- QCOMPARE(object.testService->windowControl->hue(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->windowControl->setHue(controlValue);
- QCOMPARE(widget.hue(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::hueWidgetControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- object.testService->widgetControl->setHue(controlValue);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- QCOMPARE(widget.hue(), 0);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.hue(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(hueChanged(int)));
-
- widget.setHue(value);
- QCOMPARE(widget.hue(), expectedValue);
- QCOMPARE(object.testService->widgetControl->hue(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setHue(value);
- QCOMPARE(widget.hue(), expectedValue);
- QCOMPARE(object.testService->widgetControl->hue(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->widgetControl->setHue(controlValue);
- QCOMPARE(widget.hue(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::hueRendererControl()
-{
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QSignalSpy spy(&widget, SIGNAL(hueChanged(int)));
-
- widget.setHue(value);
- QCOMPARE(widget.hue(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setHue(value);
- QCOMPARE(widget.hue(), expectedValue);
- QCOMPARE(spy.count(), 1);
-}
-
-void tst_QVideoWidget::saturationWindowControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setSaturation(controlValue);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- QCOMPARE(widget.saturation(), 0);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.saturation(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(saturationChanged(int)));
-
- widget.setSaturation(value);
- QCOMPARE(widget.saturation(), expectedValue);
- QCOMPARE(object.testService->windowControl->saturation(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setSaturation(value);
- QCOMPARE(widget.saturation(), expectedValue);
- QCOMPARE(object.testService->windowControl->saturation(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->windowControl->setSaturation(controlValue);
- QCOMPARE(widget.saturation(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::saturationWidgetControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- object.testService->widgetControl->setSaturation(controlValue);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QCOMPARE(widget.saturation(), 0);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.saturation(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(saturationChanged(int)));
-
- widget.setSaturation(value);
- QCOMPARE(widget.saturation(), expectedValue);
- QCOMPARE(object.testService->widgetControl->saturation(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setSaturation(value);
- QCOMPARE(widget.saturation(), expectedValue);
- QCOMPARE(object.testService->widgetControl->saturation(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->widgetControl->setSaturation(controlValue);
- QCOMPARE(widget.saturation(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-
-}
-
-void tst_QVideoWidget::saturationRendererControl()
-{
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QSignalSpy spy(&widget, SIGNAL(saturationChanged(int)));
-
- widget.setSaturation(value);
- QCOMPARE(widget.saturation(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setSaturation(value);
- QCOMPARE(widget.saturation(), expectedValue);
- QCOMPARE(spy.count(), 1);
-}
-
-static const uchar rgb32ImageData[] =
-{
- 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00,
- 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00
-};
-
-void tst_QVideoWidget::paintRendererControl()
-{
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- object.bind(&widget);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.resize(640,480);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QPainterVideoSurface *surface = qobject_cast<QPainterVideoSurface *>(
- object.testService->rendererControl->surface());
-
- QVideoSurfaceFormat format(QSize(2, 2), QVideoFrame::Format_RGB32);
-
- QVERIFY(surface->start(format));
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), true);
-
- QCoreApplication::processEvents(QEventLoop::AllEvents);
-
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), true);
-
- QVideoFrame frame(sizeof(rgb32ImageData), QSize(2, 2), 8, QVideoFrame::Format_RGB32);
-
- frame.map(QAbstractVideoBuffer::WriteOnly);
- memcpy(frame.bits(), rgb32ImageData, frame.mappedBytes());
- frame.unmap();
-
- QVERIFY(surface->present(frame));
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), false);
-
- //wait up to 2 seconds for the frame to be presented
- for (int i=0; i<200 && !surface->isReady(); i++)
- QTest::qWait(10);
-
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), true);
-}
-
-QTEST_MAIN(tst_QVideoWidget)
-
-#include "tst_qvideowidget.moc"
diff --git a/tests/auto/qwavedecoder/data/corrupt_datadesc_1_16_8000.le.wav b/tests/auto/qwavedecoder/data/corrupt_datadesc_1_16_8000.le.wav
deleted file mode 100644
index b6eac4d..0000000
--- a/tests/auto/qwavedecoder/data/corrupt_datadesc_1_16_8000.le.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/corrupt_fmtdesc_1_16_8000.le.wav b/tests/auto/qwavedecoder/data/corrupt_fmtdesc_1_16_8000.le.wav
deleted file mode 100644
index 2f0da13..0000000
--- a/tests/auto/qwavedecoder/data/corrupt_fmtdesc_1_16_8000.le.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/corrupt_fmtstring_1_16_8000.le.wav b/tests/auto/qwavedecoder/data/corrupt_fmtstring_1_16_8000.le.wav
deleted file mode 100644
index b14a53c..0000000
--- a/tests/auto/qwavedecoder/data/corrupt_fmtstring_1_16_8000.le.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/empty.wav b/tests/auto/qwavedecoder/data/empty.wav
deleted file mode 100644
index e69de29..0000000
--- a/tests/auto/qwavedecoder/data/empty.wav
+++ /dev/null
diff --git a/tests/auto/qwavedecoder/data/gendata.sh b/tests/auto/qwavedecoder/data/gendata.sh
deleted file mode 100755
index 0dd82ce..0000000
--- a/tests/auto/qwavedecoder/data/gendata.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/bash
-#############################################################################
-##
-## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-## All rights reserved.
-## Contact: Nokia Corporation (qt-info@nokia.com)
-##
-## This file is the build configuration utility of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:LGPL$
-## GNU Lesser General Public License Usage
-## This file may be used under the terms of the GNU Lesser General Public
-## License version 2.1 as published by the Free Software Foundation and
-## appearing in the file LICENSE.LGPL included in the packaging of this
-## file. Please review the following information to ensure the GNU Lesser
-## General Public License version 2.1 requirements will be met:
-## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-##
-## In addition, as a special exception, Nokia gives you certain additional
-## rights. These rights are described in the Nokia Qt LGPL Exception
-## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU General
-## Public License version 3.0 as published by the Free Software Foundation
-## and appearing in the file LICENSE.GPL included in the packaging of this
-## file. Please review the following information to ensure the GNU General
-## Public License version 3.0 requirements will be met:
-## http://www.gnu.org/copyleft/gpl.html.
-##
-## Other Usage
-## Alternatively, this file may be used in accordance with the terms and
-## conditions contained in a signed written agreement between you and Nokia.
-##
-##
-##
-##
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-# Generate some simple test data. Uses "sox".
-
-endian=""
-endian_extn=""
-
-for channel in 1 2; do
- if [ $channel -eq 1 ]; then
- endian="little"
- endian_extn="le"
- fi
-
- if [ $channel -eq 2 ]; then
- endian="big"
- endian_extn="be"
- fi
- for samplebits in 8 16 32; do
- for samplerate in 44100 8000; do
- if [ $samplebits -ne 8 ]; then
- sox -n --endian "${endian}" -c ${channel} -b ${samplebits} -r ${samplerate} isawav_${channel}_${samplebits}_${samplerate}_${endian_extn}.wav synth 0.25 sine 300-3300
- else
- sox -n -c ${channel} -b ${samplebits} -r ${samplerate} isawav_${channel}_${samplebits}_${samplerate}.wav synth 0.25 sine 300-3300
- fi
- done
- done
-done
-
diff --git a/tests/auto/qwavedecoder/data/isawav_1_16_44100_le.wav b/tests/auto/qwavedecoder/data/isawav_1_16_44100_le.wav
deleted file mode 100644
index 88b1a83..0000000
--- a/tests/auto/qwavedecoder/data/isawav_1_16_44100_le.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/isawav_1_16_8000_le.wav b/tests/auto/qwavedecoder/data/isawav_1_16_8000_le.wav
deleted file mode 100644
index 83a4059..0000000
--- a/tests/auto/qwavedecoder/data/isawav_1_16_8000_le.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/isawav_1_32_44100_le.wav b/tests/auto/qwavedecoder/data/isawav_1_32_44100_le.wav
deleted file mode 100644
index 9c437b1..0000000
--- a/tests/auto/qwavedecoder/data/isawav_1_32_44100_le.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/isawav_1_32_8000_le.wav b/tests/auto/qwavedecoder/data/isawav_1_32_8000_le.wav
deleted file mode 100644
index f90a8bc..0000000
--- a/tests/auto/qwavedecoder/data/isawav_1_32_8000_le.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/isawav_1_8_44100.wav b/tests/auto/qwavedecoder/data/isawav_1_8_44100.wav
deleted file mode 100644
index 7d10829..0000000
--- a/tests/auto/qwavedecoder/data/isawav_1_8_44100.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/isawav_1_8_8000.wav b/tests/auto/qwavedecoder/data/isawav_1_8_8000.wav
deleted file mode 100644
index 76c08e8..0000000
--- a/tests/auto/qwavedecoder/data/isawav_1_8_8000.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/isawav_2_16_44100_be.wav b/tests/auto/qwavedecoder/data/isawav_2_16_44100_be.wav
deleted file mode 100644
index ca0cd42..0000000
--- a/tests/auto/qwavedecoder/data/isawav_2_16_44100_be.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/isawav_2_16_8000_be.wav b/tests/auto/qwavedecoder/data/isawav_2_16_8000_be.wav
deleted file mode 100644
index 3a68459..0000000
--- a/tests/auto/qwavedecoder/data/isawav_2_16_8000_be.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/isawav_2_32_44100_be.wav b/tests/auto/qwavedecoder/data/isawav_2_32_44100_be.wav
deleted file mode 100644
index f1aaf29..0000000
--- a/tests/auto/qwavedecoder/data/isawav_2_32_44100_be.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/isawav_2_32_8000_be.wav b/tests/auto/qwavedecoder/data/isawav_2_32_8000_be.wav
deleted file mode 100644
index c10c208..0000000
--- a/tests/auto/qwavedecoder/data/isawav_2_32_8000_be.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/isawav_2_8_44100.wav b/tests/auto/qwavedecoder/data/isawav_2_8_44100.wav
deleted file mode 100644
index befd02b..0000000
--- a/tests/auto/qwavedecoder/data/isawav_2_8_44100.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/isawav_2_8_8000.wav b/tests/auto/qwavedecoder/data/isawav_2_8_8000.wav
deleted file mode 100644
index ce8b0d0..0000000
--- a/tests/auto/qwavedecoder/data/isawav_2_8_8000.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/nosampledata.wav b/tests/auto/qwavedecoder/data/nosampledata.wav
deleted file mode 100644
index 8dbde95..0000000
--- a/tests/auto/qwavedecoder/data/nosampledata.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qwavedecoder/data/notawav.wav b/tests/auto/qwavedecoder/data/notawav.wav
deleted file mode 100644
index 36a20ea..0000000
--- a/tests/auto/qwavedecoder/data/notawav.wav
+++ /dev/null
@@ -1 +0,0 @@
-Ceci n'est pas une wav file
diff --git a/tests/auto/qwavedecoder/data/onebyte.wav b/tests/auto/qwavedecoder/data/onebyte.wav
deleted file mode 100644
index d00491f..0000000
--- a/tests/auto/qwavedecoder/data/onebyte.wav
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/tests/auto/qwavedecoder/qwavedecoder.pro b/tests/auto/qwavedecoder/qwavedecoder.pro
deleted file mode 100644
index db3f264..0000000
--- a/tests/auto/qwavedecoder/qwavedecoder.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = tst_qwavedecoder
-HEADERS += ../../../src/multimedia/effects/qwavedecoder_p.h
-SOURCES += tst_qwavedecoder.cpp \
- ../../../src/multimedia/effects/qwavedecoder_p.cpp
-
-QT += multimedia-private testlib network
-CONFIG += no_private_qt_headers_warning testcase
-
-data.files = data/*
-data.path = data
-DEPLOYMENT += data
-
diff --git a/tests/auto/qwavedecoder/tst_qwavedecoder.cpp b/tests/auto/qwavedecoder/tst_qwavedecoder.cpp
deleted file mode 100644
index c91ae7c..0000000
--- a/tests/auto/qwavedecoder/tst_qwavedecoder.cpp
+++ /dev/null
@@ -1,327 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-#include <QtTest/QtTest>
-#include <private/qwavedecoder_p.h>
-
-#include <QNetworkAccessManager>
-#include <QNetworkRequest>
-#include <QNetworkReply>
-
-#ifndef QTRY_COMPARE
-#define QTRY_COMPARE(__expr, __expected) \
- do { \
- const int __step = 50; \
- const int __timeout = 1000; \
- if (!(__expr)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && !((__expr) == (__expected)); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QCOMPARE(__expr, __expected); \
- } while (0)
-#endif
-
-
-class tst_QWaveDecoder : public QObject
-{
- Q_OBJECT
-public:
- enum Corruption {
- None = 1,
- NotAWav = 2,
- NoSampleData = 4,
- FormatDescriptor = 8,
- FormatString = 16,
- DataDescriptor = 32
- };
-
-public slots:
-
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
-private slots:
-
- void file_data();
- void file();
-
- void http_data() {file_data();}
- void http();
-
- void readAllAtOnce();
- void readPerByte();
-};
-
-void tst_QWaveDecoder::init()
-{
-}
-
-void tst_QWaveDecoder::cleanup()
-{
-}
-
-void tst_QWaveDecoder::initTestCase()
-{
-}
-
-void tst_QWaveDecoder::cleanupTestCase()
-{
-}
-
-void tst_QWaveDecoder::file_data()
-{
- QTest::addColumn<QString>("file");
- QTest::addColumn<tst_QWaveDecoder::Corruption>("corruption");
- QTest::addColumn<int>("channels");
- QTest::addColumn<int>("samplesize");
- QTest::addColumn<int>("samplerate");
- QTest::addColumn<QAudioFormat::Endian>("byteorder");
-
- QTest::newRow("File is empty") << QString("empty.wav") << tst_QWaveDecoder::NotAWav << -1 << -1 << -1 << QAudioFormat::LittleEndian;
- QTest::newRow("File is one byte") << QString("onebyte.wav") << tst_QWaveDecoder::NotAWav << -1 << -1 << -1 << QAudioFormat::LittleEndian;
- QTest::newRow("File is not a wav(text)") << QString("notawav.wav") << tst_QWaveDecoder::NotAWav << -1 << -1 << -1 << QAudioFormat::LittleEndian;
- QTest::newRow("Wav file has no sample data") << QString("nosampledata.wav") << tst_QWaveDecoder::NoSampleData << -1 << -1 << -1 << QAudioFormat::LittleEndian;
- QTest::newRow("corrupt fmt chunk descriptor") << QString("corrupt_fmtdesc_1_16_8000.le.wav") << tst_QWaveDecoder::FormatDescriptor << -1 << -1 << -1 << QAudioFormat::LittleEndian;
- QTest::newRow("corrupt fmt string") << QString("corrupt_fmtstring_1_16_8000.le.wav") << tst_QWaveDecoder::FormatString << -1 << -1 << -1 << QAudioFormat::LittleEndian;
- QTest::newRow("corrupt data chunk descriptor") << QString("corrupt_datadesc_1_16_8000.le.wav") << tst_QWaveDecoder::DataDescriptor << -1 << -1 << -1 << QAudioFormat::LittleEndian;
-
- QTest::newRow("File isawav_1_8_8000.wav") << QString("isawav_1_8_8000.wav") << tst_QWaveDecoder::None << 1 << 8 << 8000 << QAudioFormat::LittleEndian;
- QTest::newRow("File isawav_1_8_44100.wav") << QString("isawav_1_8_44100.wav") << tst_QWaveDecoder::None << 1 << 8 << 44100 << QAudioFormat::LittleEndian;
- QTest::newRow("File isawav_2_8_8000.wav") << QString("isawav_2_8_8000.wav") << tst_QWaveDecoder::None << 2 << 8 << 8000 << QAudioFormat::LittleEndian;
- QTest::newRow("File isawav_2_8_44100.wav") << QString("isawav_2_8_44100.wav") << tst_QWaveDecoder::None << 2 << 8 << 44100 << QAudioFormat::LittleEndian;
-
- QTest::newRow("File isawav_1_16_8000_le.wav") << QString("isawav_1_16_8000_le.wav") << tst_QWaveDecoder::None << 1 << 16 << 8000 << QAudioFormat::LittleEndian;
- QTest::newRow("File isawav_1_16_44100_le.wav") << QString("isawav_1_16_44100_le.wav") << tst_QWaveDecoder::None << 1 << 16 << 44100 << QAudioFormat::LittleEndian;
- QTest::newRow("File isawav_2_16_8000_be.wav") << QString("isawav_2_16_8000_be.wav") << tst_QWaveDecoder::None << 2 << 16 << 8000 << QAudioFormat::BigEndian;
- QTest::newRow("File isawav_2_16_44100_be.wav") << QString("isawav_2_16_44100_be.wav") << tst_QWaveDecoder::None << 2 << 16 << 44100 << QAudioFormat::BigEndian;
-
- // 32 bit waves are not supported
- QTest::newRow("File isawav_1_32_8000_le.wav") << QString("isawav_1_32_8000_le.wav") << tst_QWaveDecoder::FormatDescriptor << 1 << 32 << 8000 << QAudioFormat::LittleEndian;
- QTest::newRow("File isawav_1_32_44100_le.wav") << QString("isawav_1_32_44100_le.wav") << tst_QWaveDecoder::FormatDescriptor << 1 << 32 << 44100 << QAudioFormat::LittleEndian;
- QTest::newRow("File isawav_2_32_8000_be.wav") << QString("isawav_2_32_8000_be.wav") << tst_QWaveDecoder::FormatDescriptor << 2 << 32 << 8000 << QAudioFormat::BigEndian;
- QTest::newRow("File isawav_2_32_44100_be.wav") << QString("isawav_2_32_44100_be.wav") << tst_QWaveDecoder::FormatDescriptor << 2 << 32 << 44100 << QAudioFormat::BigEndian;
-}
-
-void tst_QWaveDecoder::file()
-{
- QFETCH(QString, file);
- QFETCH(tst_QWaveDecoder::Corruption, corruption);
- QFETCH(int, channels);
- QFETCH(int, samplesize);
- QFETCH(int, samplerate);
- QFETCH(QAudioFormat::Endian, byteorder);
-
- QFile stream;
- stream.setFileName(QString("data/") + file);
- stream.open(QIODevice::ReadOnly);
-
- QVERIFY(stream.isOpen());
-
- QWaveDecoder waveDecoder(&stream);
- QSignalSpy validFormatSpy(&waveDecoder, SIGNAL(formatKnown()));
- QSignalSpy parsingErrorSpy(&waveDecoder, SIGNAL(parsingError()));
-
- if (corruption == NotAWav) {
- QSKIP("Not all failures detected correctly yet", SkipSingle);
- QTRY_COMPARE(parsingErrorSpy.count(), 1);
- QCOMPARE(validFormatSpy.count(), 0);
- } else if (corruption == NoSampleData) {
- QTRY_COMPARE(validFormatSpy.count(), 1);
- QCOMPARE(parsingErrorSpy.count(), 0);
- QVERIFY(waveDecoder.audioFormat().isValid());
- QVERIFY(waveDecoder.size() == 0);
- QVERIFY(waveDecoder.duration() == 0);
- } else if (corruption == FormatDescriptor) {
- QTRY_COMPARE(parsingErrorSpy.count(), 1);
- QCOMPARE(validFormatSpy.count(), 0);
- } else if (corruption == FormatString) {
- QTRY_COMPARE(parsingErrorSpy.count(), 1);
- QCOMPARE(validFormatSpy.count(), 0);
- QVERIFY(!waveDecoder.audioFormat().isValid());
- } else if (corruption == DataDescriptor) {
- QTRY_COMPARE(parsingErrorSpy.count(), 1);
- QCOMPARE(validFormatSpy.count(), 0);
- QVERIFY(waveDecoder.size() == 0);
- } else if (corruption == None) {
- QTRY_COMPARE(validFormatSpy.count(), 1);
- QCOMPARE(parsingErrorSpy.count(), 0);
- QVERIFY(waveDecoder.audioFormat().isValid());
- QVERIFY(waveDecoder.size() > 0);
- QVERIFY(waveDecoder.duration() == 250);
- QAudioFormat format = waveDecoder.audioFormat();
- QVERIFY(format.isValid());
- QVERIFY(format.channels() == channels);
- QVERIFY(format.sampleSize() == samplesize);
- QVERIFY(format.sampleRate() == samplerate);
- if (format.sampleSize() != 8) {
- QVERIFY(format.byteOrder() == byteorder);
- }
- }
-
- stream.close();
-}
-
-void tst_QWaveDecoder::http()
-{
- QFETCH(QString, file);
- QFETCH(tst_QWaveDecoder::Corruption, corruption);
- QFETCH(int, channels);
- QFETCH(int, samplesize);
- QFETCH(int, samplerate);
- QFETCH(QAudioFormat::Endian, byteorder);
-
- QFile stream;
- stream.setFileName(QString("data/") + file);
- stream.open(QIODevice::ReadOnly);
-
- QVERIFY(stream.isOpen());
-
- QNetworkAccessManager nam;
-
- QNetworkReply *reply = nam.get(QNetworkRequest(QUrl::fromLocalFile(QString::fromLatin1("data/") + file)));
-
- QWaveDecoder waveDecoder(reply);
- QSignalSpy validFormatSpy(&waveDecoder, SIGNAL(formatKnown()));
- QSignalSpy parsingErrorSpy(&waveDecoder, SIGNAL(parsingError()));
-
- if (corruption == NotAWav) {
- QSKIP("Not all failures detected correctly yet", SkipSingle);
- QTRY_COMPARE(parsingErrorSpy.count(), 1);
- QCOMPARE(validFormatSpy.count(), 0);
- } else if (corruption == NoSampleData) {
- QTRY_COMPARE(validFormatSpy.count(), 1);
- QCOMPARE(parsingErrorSpy.count(), 0);
- QVERIFY(waveDecoder.audioFormat().isValid());
- QVERIFY(waveDecoder.size() == 0);
- QVERIFY(waveDecoder.duration() == 0);
- } else if (corruption == FormatDescriptor) {
- QTRY_COMPARE(parsingErrorSpy.count(), 1);
- QCOMPARE(validFormatSpy.count(), 0);
- } else if (corruption == FormatString) {
- QTRY_COMPARE(parsingErrorSpy.count(), 1);
- QCOMPARE(validFormatSpy.count(), 0);
- QVERIFY(!waveDecoder.audioFormat().isValid());
- } else if (corruption == DataDescriptor) {
- QTRY_COMPARE(parsingErrorSpy.count(), 1);
- QCOMPARE(validFormatSpy.count(), 0);
- QVERIFY(waveDecoder.size() == 0);
- } else if (corruption == None) {
- QTRY_COMPARE(validFormatSpy.count(), 1);
- QCOMPARE(parsingErrorSpy.count(), 0);
- QVERIFY(waveDecoder.audioFormat().isValid());
- QVERIFY(waveDecoder.size() > 0);
- QVERIFY(waveDecoder.duration() == 250);
- QAudioFormat format = waveDecoder.audioFormat();
- QVERIFY(format.isValid());
- QVERIFY(format.channels() == channels);
- QVERIFY(format.sampleSize() == samplesize);
- QVERIFY(format.sampleRate() == samplerate);
- if (format.sampleSize() != 8) {
- QVERIFY(format.byteOrder() == byteorder);
- }
- }
-
- delete reply;
-}
-
-void tst_QWaveDecoder::readAllAtOnce()
-{
- QFile stream;
- stream.setFileName(QString("data/isawav_2_8_44100.wav"));
- stream.open(QIODevice::ReadOnly);
-
- QVERIFY(stream.isOpen());
-
- QWaveDecoder waveDecoder(&stream);
- QSignalSpy validFormatSpy(&waveDecoder, SIGNAL(formatKnown()));
-
- QTRY_COMPARE(validFormatSpy.count(), 1);
- QVERIFY(waveDecoder.size() > 0);
-
- QByteArray buffer;
- buffer.resize(waveDecoder.size());
-
- qint64 readSize = waveDecoder.read(buffer.data(), waveDecoder.size());
- QVERIFY(readSize == waveDecoder.size());
-
- readSize = waveDecoder.read(buffer.data(), 1);
- QVERIFY(readSize == 0);
-
- stream.close();
-}
-
-void tst_QWaveDecoder::readPerByte()
-{
- QFile stream;
- stream.setFileName(QString("data/isawav_2_8_44100.wav"));
- stream.open(QIODevice::ReadOnly);
-
- QVERIFY(stream.isOpen());
-
- QWaveDecoder waveDecoder(&stream);
- QSignalSpy validFormatSpy(&waveDecoder, SIGNAL(formatKnown()));
-
- QTRY_COMPARE(validFormatSpy.count(), 1);
- QVERIFY(waveDecoder.size() > 0);
-
- qint64 readSize = 0;
- char buf;
- for (int ii = 0; ii < waveDecoder.size(); ++ii)
- readSize += waveDecoder.read(&buf, 1);
- QVERIFY(readSize == waveDecoder.size());
- QVERIFY(waveDecoder.read(&buf,1) == 0);
-
- stream.close();
-}
-
-Q_DECLARE_METATYPE(tst_QWaveDecoder::Corruption)
-Q_DECLARE_METATYPE(QAudioFormat::Endian)
-
-QTEST_MAIN(tst_QWaveDecoder)
-
-#include "tst_qwavedecoder.moc"
-
diff --git a/tests/systemtests/audio/sys_audio.qtt b/tests/systemtests/audio/sys_audio.qtt
deleted file mode 100644
index 142a964..0000000
--- a/tests/systemtests/audio/sys_audio.qtt
+++ /dev/null
@@ -1,295 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-testcase = {
-
-/* Notes
-Ensure 2 test .mp3 file available on device
-Ensure 2 test .wav file available on device
-Ensure a valid m3u file referring to locations where indicated media is available on the device
-Ensure the device can ping destinations on the network (if applicable)
-Have an audio stream url available (e.g. http://202.6.74.107:8060/triplej.mp3 for example)
-Ensure access to Internet available to device either via 3G and WiFi
-SIM cards from Vodafone and Testra (Australia) needed for 3G streaming testing
-*/
- initTestCase: function()
- {
- },
-
- play_an_audio_file_data: {
- mp3:[".mp3", "filename", "mpeg audio layer 3"],
- wav:[".wav", "filename", "waveform audio"]
- },
-
- play_an_audio_file: function(extension, filename, format)
- {
- // Test meta data
- testApplication = "Multimedia - Play Audio File";
- testBinary = "player";
- testGoal = "Verify that Audio files can be played.";
- testPreconditions = "Audio files in " + extension + " format are available on device.";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | Select [Open] | |
- | Click Open, then select desired "+filename+extension+" file to return to player UI | Verify selected file has populated playlist window |
- | Highlight file in playlist window by clicking on it | |
- | Select [Play] | Verify that the " + format + " file is audible on device |
- "));
- },
-
- basic_player_controls_for_audio_data: {
- mp3:[".mp3", "filename", "mpeg audio layer 3"],
- },
-
- basic_player_controls_for_audio: function(extension, filename, format)
- {
- // Test meta data
- testApplication = "Multimedia - Audio Player Controls";
- testBinary = "player";
- testGoal = "Verify basic API for controling audio playback ";
- testPreconditions = "a test "+extension+" file is available on device";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | Select Open | |
- | In [Open Files] either double click the desired "+filename+extension+" or highlight and click Open to be returned to the player UI | |
- | Highlight and click Play or doubleclick to play the file | Verify that file plays properly from the start |
- | | Verify that the correct track details are displayed on the application title bar |
- | Select [Pause] | Verify that file has paused |
- | | Verify that [Pause] icon has now changed to a [Play] icon |
- | Select [Play] | Verify that file continues to play properly from where previously paused. |
- | | Verify that [Play] icon is now a [Pause] icon again |
- | Select [Next File] control | Verify that next file in playlist is playing from start |
- | | Verify that the title bar has changed to reflect the seclected audio track |
- | After some time (10-20 sec) Select [Beginning of File] icon | Verify that current file is being played from start |
- | Let some arbitrary time pass, then Select [Beginning of File] control twice in quick succession. | Verify that previous file in playlist is playing from start |
- | Select [Stop] control | Verify that file has stopped playing |
- | Select [Play] | Verify that file continues to play from start of file. |
- | Let file play till end | Verify player continues playing the next file in the playlist window |
- | After some arbitrary time, Select [Stop] | |
- | Select [Next File] control | Verify that next file in playlist is highlighted |
- | | Verify that file is not automatically playing |
- | Select [Beginning of File] control | Verify that previous file in playlist is highlighted |
- | Select file in playlist | Verify that file plays in player. |
- | Select number of files greater than can be displayed without scrolling in to playlist | Verify that list can be scrolled through |
- | With file playing, verify that hardware keys can change volume up and down | |
- | With file playing, verify that UI volume control slider can change volume up and down | |
- | Select volume at 50% (or thereabout) | |
- | Select [Mute] | Verify that sound is muted while file is playing |
- | | Verify that [Mute] control is displaying the Muted icon |
- | Select [Mute] control again | Verify that sound has reverted back to level selected prior to muting |
- | Click on Full Screen | Verify that nothing happens when playing an audio file |
- | Click Color Option | Verify that this has no effect when playing an audio file |
- "));
-
- },
-
- seek_controls_for_audio_data: {
- mp3:[".mp3", "filename", "mpeg audio layer 3"],
- },
-
- seek_controls_for_audio: function(extension, filename, format)
- {
- // Test meta data
- testApplication = "Multimedia - Audio Seek Controls";
- testBinary = "player";
- testGoal = "Verify FastForward and Rewind functionality of the API";
- testPreconditions = "a test "+extension+" file is available on device";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | Select [Open] | |
- | In [Open File] select the "+filename+extension+" file to return to player UI | |
- | Select [Play] to play the file | |
- | Click on the [1.0x] (Multiplier) dropbox and select 2.0x | Verify that file is playing at double speed |
- | With multiplier control set on [2.0], select a new file from the playlist window | Verify that the Multiplier control has reverted back to [1.0x] |
- | | Verify that the audio is playing at normal speed |
- | Click on the [Multiplier] control and select 0.5x | Verify that file is playing at half speed |
- | With multiplier control set on [0.5], select a new file from the playlist window | Verify that the Multiplier control has reverted back to [1.0x] |
- | | Verify that the audio is playing at normal speed |
- | Drag positional slider to right, then release | Verify that player continues to play file at later part of file |
- | Drag positional slider to left, then release | Verify that player continues to play file at earlier part of file |
- | Click on the [1.0x] (Multiplier) dropbox and select 2.0x | Verify that file is playing at double speed |
- | Drag positional slider to right, then release | Verify that player continues to play file at later part of file at double speed |
- | Drag positional slider to left, then release | Verify that player continues to play file at earlier part of file at double speed |
- | Click on the Multiplier dropbox and select 0.5x | Verify that file is playing at half the speed |
- | Drag positional slider to right, then release | Verify that player continues to play file at later part of file at half speed |
- | Drag positional slider to left, then release | Verify that player continues to play file at earlier part of file at half speed |
- "));
- },
-
-
-
- basic_controls_for_streamed_audio_content: function()
- {
-
-//*Note* For this test you need a playlist of streaming media urls. Suggest: http://202.6.74.107:8060/triplej.mp3 ; http://www.abc.net.au/streaming/triplej.asx ; rtsp://media1.abc.net.au/broadcast/triplej.rm ; mms://media3.abc.net.au/triplej ; depending on your platform and backend support.
-
- // Test meta data
- testApplication = "Multimedia - Content Streaming";
- testBinary = "player";
- testGoal = "Verify playback of streaming audio media";
- testPreconditions = "";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | In player application, Select or Tap [Open] | |
- | In [Open File] navigate and highlight test (streaming) playlist file | |
- | Select or Tap on selected file to return to player UI | Verify selected file has populated playlist |
- | Highlight file in playlist by selecting or clicking it | |
- | Select [Play] | Verify that stream is playing on device |
- | Select [Pause] | Verify that stream is paused on device |
- | | Verify that the [Pause] button has changed to a [Play] button |
- | Select [Play] again | Verify that stream is playing on device |
- | Select [Stop] | |
- | Open local mp3 file in to play list and select it to play | Verify that the mp3 plays while the stream name is still present in the playlist |
- | Re-select the stream in the playlist | Verify that the stream starts playing again |
- | Select [Next File] | Verify that the player started playing the next file in the playlist |
- | Select [Previous File] | Verify that the original stream is playing again |
- | During stream playback, have headphones connected to device | Verify that the sound is now playing through the headphones |
- | Invoke a system notification on the device (such as an incoming SMS) | Verify that the device correctly transmits the audible system notification through the devices speakers and then returns to playing the stream through the headphones |
- "));
- },
-
- record_an_audio_file: function()
- {
-
- // Test meta data
- testApplication = "Multimedia - Recording Audio";
- testBinary = "audiorecorder";
- testGoal = "Verify that audio can be recorded.";
- testPreconditions = "";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | Select Input Device | |
- | Select Audio Codec | |
- | Select File Container | |
- | Select Sample Rate | |
- | Select Quality and Bitrate | |
- | Select Output... and select location and name of output file | |
- | Select Record | Verify that [Record] button has changed in to [Stop] |
- | | Verify that Duration is counting seconds |
- | | Verify that Recording is displayed |
- | Select Stop | Verify that Duration is now 0 |
- | Select Output File in file browser | Verify that an audio file has been generated |
- | Play output file in media player | Verify that audible audio is recorded in file |
- "));
- },
-
-pause_recording_an_audio_file: function()
- {
-
- // Test meta data
- testApplication = "Multimedia - Pause Recording Audio";
- testBinary = "audiorecorder";
- testGoal = "Verify API to be able to pause audio recording without unwanted artifacts.";
- testPreconditions = "";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | Select Input Device | |
- | Select Audio Codec | |
- | Select File Container | |
- | Select Sample Rate | |
- | Select Quality and Bitrate | |
- | Select Output... and select location and name of output file | |
- | Select Record | Verify that [Record] button has changed in to [Stop] |
- | | Verify that Duration is counting seconds |
- | | Verify that Recording is displayed |
- | Speak in to the microphone. Suggest counting from 1 to 5 | |
- | Select Pause | Verify that instead of Duration, Paused is displayed |
- | Keep speaking in to microfon, continue counting from 6 to 10 | |
- | Select Resume | Verify that the counter has resumed the seconds count from where it was previously paused. |
- | Continue counting from 11 to 15 in to the microphone | |
- | After a arbitrary time, Stop the recording. | |
- | Select Output File in file browser | Verify that an audio file has been generated |
- | Play output file in media player | Verify that audible audio is recorded in file and that audio is only recorded for period that Pause was not selected |
- | | Verify that the recording reproduces the counting from 1 to 5 then continues from 11 to 15 and that the counting from 6 - 10 is not recorded |
- | | Verify there is no audible artifact that separates the two or more recording periods, that is that the joint is seamless |
- "));
- },
-}
diff --git a/tests/systemtests/camera/sys_camera.qtt b/tests/systemtests/camera/sys_camera.qtt
deleted file mode 100644
index 781e50b..0000000
--- a/tests/systemtests/camera/sys_camera.qtt
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-testcase = {
-
-/* Notes
-*/
- initTestCase: function()
- {
- },
-
- take_a_photo: function()
- {
- // Test meta data
- testApplication = "Multimedia - Still Camera";
- testBinary = "declarative camera";
- testGoal = "Verify that a photo can be taken with the camera.";
- testPreconditions = "";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | If device has lens cover, make sure it is open | |
- | Select Image tab to put camera in still mode | Verify the intended scene is reproduced in the preview pane/viewfinder |
- | Select Capture Photo | Verify that image is shown on screen for preview |
- | | Verify that a new file is in the Images folder and accessabble with the image viewer |
- | Select given image | Verify that it is a true representation of the intended sceen |
- | | Verify the image has no unintended artifacts and noise and is properly formatted |
- "));
- },
-
-change_camera_settings: function()
-{
- // Test meta data
- testApplication = "Multimedia - Still Camera";
- testBinary = "declarative camera";
- testGoal = "Verify that the camera can change its Still Camera settings successfully.";
- testPreconditions = "";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | If device has lens cover, make sure it is open | |
- | Select the primary camera device from Menu/Devices | Verify the viewfinder is displaying the scene from the main camera device |
- | Select Capture Photo | Verify that a photo was taken and that a preview image is shown on screen |
- | Select the secandary camera device from Menu/Devices | Verify the viewfinder is displaying the scene from the secondary camera device |
- | Select Capture Photo | Verify that a photo was taken from the secondary camera device and that a preview image is shown on screen |
- | Change Exposure Compensatioin on the slider in the main UI | Verify that the change in value affects the picture qwality in expected fashion |
- | Select Settings/File/Setrtings | Verify that you have an option to change Image Resolution, Image Format and Quality |
- | Change Image Resolution to another supported resolution | Verify that you can take stills with various resolutions |
- | Selct Flash always on from the setitngs menu | Verify that when photo is taken, the flash is always triggered |
- | Select No Flash on from the menu | Verify that despite the lack of natural light, the flash will not trigger when taking photos |
- | Change Image Format to another supported format | Verify that you can take stills with various Image Formats |
- | Sellect Settings/Device/Secondary Device | Verify that you can see the view from the Front Facing Camera on the viewfinder |
- | | Varify that you can take still images from the Front Facing Camera |
- | Select Settings/File/Exit | Verify that the application has now closed |
-
- "));
-},
-
- take_a_video: function()
- {
- // Test meta data
- testApplication = "Multimedia - Video Camera";
- testBinary = "camera";
- testGoal = "Verify that the camera can capture and save an audio/video file.";
- testPreconditions = "";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | If device has lens cover, make sure it is open | |
- | Select Video tab to put camera in video mode | Verify the intended scene is reproduced in the preview/viewfinder |
- | Select Record Video | Verify that video is shown on screen for preview |
- | Select Pause | Verify that the Recorded counter has stopped |
- | Select Record again | Verify that the Recorded counter has continued counting |
- | Select Stop | Verify that the recording has now stopped |
- | | Verify that a new file is in the Images folder and accessabble with the player |
- | Select given video | Verify that it is a true representation of the intended sceen |
- | | Verify that the Pause in the recording has happened and that recording continued without an issue after that |
- | | Verify the image has no unintended artifacts and noise and is properly formatted |
- "));
- },
-
- change_video_settings: function()
- {
- // Test meta data
- testApplication = "Multimedia - Video Camera";
- testBinary = "camera";
- testGoal = "Verify that the camera can change its Video settings successfully.";
- testPreconditions = "";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | If device has lens cover, make sure it is open | |
- | Select Video tab to put camera in video mode | Verify the intended scene is reproduced in the preview/viewfinder |
- | In the Menu Bar, select Settings/Devices | Verify that you can select Primay and Secondary Camera on Device |
- | Select Secondary Camera | Verify that devise is now showing video stram from Front Facing camera |
- | Select Settings/File/Settings | Verify that you now have otion to select Audio Codecs, Resolution Sample Rate, Framerate, Quality, Video Codecs and Container Format |
- | Change Audio Codecs to another supported Codecs | Verify that camera can record |
- | Change Resolutiuon to another supported Resolution | Verify that camera can record |
- | Change Sample Rate to another supported Sample Rate | Verify that camera can record |
- | Change Framerate to another supported Framerate | Verify that camera can record |
- | Change Quality | Verify that camera can record |
- | Change Video Codecs to another supported Video Codecs | Verify that camera can record |
- | Change Container Format | Verify that camera can record |
- | Change Quality | Verify that camera can record |
- "));
- },
-
-
-
-
-
-
-}
diff --git a/tests/systemtests/radio/sys_radio.qtt b/tests/systemtests/radio/sys_radio.qtt
deleted file mode 100644
index fa82b63..0000000
--- a/tests/systemtests/radio/sys_radio.qtt
+++ /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 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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-testcase = {
-
-/* Notes
-Ensure radio reception is available in testing area
-A device specific headset is required to be connected to device for radio testing
-*/
-
- initTestCase: function()
- {
- },
-
- play_a_radio_transmission: function()
- {
- // Test meta data
- testTitle = "Multimedia - Play Radio Transmission";
- testBinary = "radio";
- testSource ="$QTDIR/qtmultimediakit/examples/Radio"
- testGoal = "Verify that radio stations can be played.";
- testPreconditions = "1. Radio reception should be available in the test area.<br>2. Wired headphones act as an antena to the device and must be connected.";
- testGroups = "BAT, 1.2";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | | Verify that 0 KHz and No Signal is displayed |
- | Select [Scan Up] | Audible white noise should be heard as the radio searches for a frequency lock. Frequency should be increasing in 100 KHz steps until a strong signal is found |
- | | Verify that a radio signal can be heard. It is possible for the radio to lock on a silent station signal, in that case progress further up the frequencies |
- | Once a strong audible signal is found | Verify that the stations frequency and Got Signal message is displayed |
- | Select [Scan Up] | Verify that the radio has moved off the previous station and in progressing through the frequencies |
- | Once on a radio station, Select [Freq Up] | Verify that the radio frequency has moved off the station by 100KHz and is stationary |
- | Select [Freq Up] again | Verify that the radio frequency has moved up another 100KHz and is stationary |
- | Select [Freq Down] twice | Verify that you are now at the frequency of the previous radio station and that the signal is audible |
- | Select [Scan Down] | Verify that the radio has moved off the previous station, progressing through the frequencies, and finds the original station from this test |
- | Exit the radio application | Verify that the radio station is no longer heard |
- "));
- },
-
- radio_interrupted_by_system_notification: function()
- {
- // Test meta data
- testTitle = "Multimedia - Radio interrupted by System Notification";
- testBinary = "radio";
- testSource ="$QTDIR/qtmultimediakit/examples/Radio"
- testGoal = "Verify that radio can recover audio playback from various system notifications.";
- testPreconditions = "1. Radio reception should be available in the test area.<br>2. Wired headphones act as an antena to the device and must be connected.";
- testGroups = "BAT, 1.2";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | Locate a strong radio station signal by scanning up/down | |
- | While on a strong and audible radio signal, evoke a system notification on device (eg: incoming SMS, alarm notification) | Verify that the radio has muted, and after the system notification has been delivered, the radio reverts to outputting the audio signal back through the headphones |
- | While on a strong and audible radio signal, call the device | Verify that the radio has been muted, and stays muted during the duration of the call, and resumes once the call has ended |
- "));
- },
-
- radio_volume_control: function()
- {
- // Test meta data
- testTitle = "Multimedia - Radio Volume Control";
- testBinary = "radio";
- testGoal = "Verify that the radio volume can be controlled via volume controls.";
- testPreconditions = "1. Radio reception should be available in the test area.<br>2. Wired headphones act as an antena to the device and must be connected.";
- testGroups = "BAT, 1.2";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | Locate a strong radio station signal by scanning up or down the frequency | |
- | While on a strong and audible radio signal, move volume slider to the right | Verify that the audio volume of the radio station is amplified |
- | Move volume slider to the left | Verify that the audio volume is lowered |
- | Move the volume slider all the way to the left | Verify that the sound is now completely muted |
- | Return the volume to a value above 50% and click the Mute/unmute comend | Verify that the audio changes from being muted to unmuted and back |
- "));
- },
-
- display_radio_metadata: function()
- {
- // Test meta data
- testTitle = "Multimedia - Display Radio Metadata";
- testBinary = "radio";
- testGoal = "Verify that the radio API can display properly formated meta data.";
- testPreconditions = "1. Radio reception should be available in the test area.<br>2. Wired headphones act as an antena to the device and must be connected.";
- testGroups = "BAT, 1.2";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | Locate a strong radio station signal by scanning up or down the frequency | Verify that the Frequency field is populated with the correct frequency for the given radio station |
- | | Verify that the Volume field is displaying the proper volume % |
- | Click on the Mute/Unmute comand | Verify that Muted field changes from 'false' to 'true' and back |
- | | If applicable, confirm that the Station Name field is properly displayed |
- | | If applicable, confirm that the Station Id field is properly displayed |
- | | If applicable, confirm that the Program Type field is properly displayed |
- | | If applicable, confirm that the PRadio Text field is properly displayed |
- "));
- },
-}
diff --git a/tests/systemtests/video/sys_video.qtt b/tests/systemtests/video/sys_video.qtt
deleted file mode 100644
index 5922745..0000000
--- a/tests/systemtests/video/sys_video.qtt
+++ /dev/null
@@ -1,269 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-testcase = {
-
-/* Notes
-Ensure 2 test .mp4 files are available on device
-Ensure the device can ping destinations on the network (if applicable)
-Have a video stream url available (e.g. http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4)
-Ensure access to Internet available to device
-Ensure an active SIM card is available on the device. As some video streaming tests are carrier spacific, it is recomended in Australia to have access to Testra, Optus and Vodafone SIM's
-*/
- initTestCase: function()
- {
- },
-
- play_a_video_file_data: {
- mp4:[".mp4", "filename", "mpeg video layer 4"]
- },
-
- play_a_video_file: function(extension, filename, format)
- {
- // Test meta data
- testApplication = "Multimedia - Play Video File";
- testBinary = "player";
- testGoal = "Verify that local, networked and carrier streamed video files can be played. ";
- testPreconditions = "1. A test "+extension+" file is available on device.<br>2. Internet acces is enabled on the device.<br>3. Operator SIM cards are available to the device";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | Select [Open] | |
- | In [Open File] select the "+filename+extension+" file to return to player UI | |
- | Select [Play] to play the file | Verify selected file has populated playlist |
- | Highlight file in playlist by clicking on it | |
- | Select [Play] | Verify that .MP4 file is playing on device |
- "));
- },
-
- basic_controls_for_video_data: {
- mp4:[".mp4", "filename", "mpeg video layer 4"]
- },
-
- basic_controls_for_video: function(extension, filename, format)
- {
- // Test meta data
- testApplication = "Multimedia - Video Controls";
- testBinary = "player";
- testGoal = "Verify the API for basic video playback functionality";
- testPreconditions = "a test "+extension+" file is available on device.";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | Select [Open] | |
- | In [Open File] select the "+filename+extension+" file to return to player UI | |
- | Select [Play] to play the file | |
- | Select [Pause] | Verify that file has paused |
- | | Verify that the [Pause] icon has changed to a [Play] icon |
- | Select [Play] | Verify that the [Play] icon has changed to a [Pause] icon |
- | | Verify that file continues to play from where previously paused. |
- | Select [Next File] | Verify that next file in playlist is playing from start |
- | After some time (10-20 sec) Select [Beginning of File] control | Verify that current file is being played from start |
- | Let arbitrary time pass, then Select [Beginning of File] control twice in quick succession.| Verify that previous file in playlist is playing from start |
- | Select [Stop] | Verify that file has stopped playing |
- | Select [Play] | Verify that file continues to play from start of file. |
- | Let file play till end | Verify player stops at end of file. |
- | Start playing file. | |
- | After arbitrary time, Select [Stop] | |
- | Select [Next File] | Verify that next file in playlist is highlighted |
- | | Verify that file is not automatically playing |
- | Select [Beginning of File] | Verify that previous file in playlist is highlighted |
- | Select file in playlist | Verify that file plays in player. |
- | Select number of files greater than can be displayed without scrolling in to playlist | Verify that list can be scrolled through |
- | With file playing, verify that hardware keys can change volume up and down | |
- | With file playing, verify that UI volume control slider can change volume up and down | |
- | Select volume at 50% (or thereabout) | |
- | Select [Mute] control | Verify that sound is muted while file is playing |
- | | Verify that [Mute] control is displaying the Muted icon |
- | Select [Mute] control again | Verify that sound has reverted back to level selected prior to muting |
- | Drag positional slider to right, then release | Verify that player continues to play file at later part of file |
- | Drag positional slider to left, then release | Verify that player continues to play file at earlier part of file |
- | Start playing file | |
- | Select [FullScreen] control | Verify that video is now playing in Fullscreen mode |
- | When at end of current file | Verify that next file in playlist is being played |
- | When at last file in playlist and at end of file | Verify that fullscreen mode is exited and user returned to player interface and that [FullScreen] is no longer selected. |
- "));
- },
-
- seek_controls_for_video: function()
- {
- // Test meta data
- testApplication = "Multimedia - Video Seek";
- testBinary = "player";
- testGoal = "Verify the API for Fast Forward/Rewind functionality.";
- testPreconditions = "Video files are available for testing on the device.";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | While playing a video file, Select or Tap on [1.0] (Multiplier) control | |
- | Select [2.0] | Verify that file is playing at double speed |
- | Select [Multiplier] control | |
- | Select [0.5] | Verify that file is playing at half speed |
- "));
- },
-
- basic_controls_for_streamed_content: function()
- {
-
-//*Note* In order to play stream on Maemo, invoke player with following command from console:
-// run-standalone.sh ./player http://202.6.74.107:8060/triplej.mp3
-//*Note* For this test you need a playlist of streaming media urls. Suggest: http://202.6.74.107:8060/triplej.mp3 ; http://www.abc.net.au/streaming/triplej.asx ; rtsp://media1.abc.net.au/broadcast/triplej.rm ; mms://media3.abc.net.au/triplej ; depending on your platform and backend support.
-
- // Test meta data
- testApplication = "Multimedia - Content Streaming";
- testBinary = "player";
- testGoal = "Verify various forms of video streaming.";
- testPreconditions = "";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | In player application, Select or Tap [Open] | |
- | In [Open File] navigate and highlight test (streaming) playlist file | |
- | Select or Tap on selected file to return to player UI | Verify selected file has populated playlist |
- | Highlight file in playlist by selecting or clicking it | |
- | Select [Play] | Verify that stream is playing on device |
- | Select [Pause] | Verify that stream is paused on device |
- | | Verify that the [Pause] button has changed to a [Play] button |
- | Select [Play] again | Verify that stream is playing on device |
- | Select [Stop] | |
- | Open local mp3 file in to play list and select it to play | Verify that the mp3 plays while the stream name is still present in the playlist |
- | Re-select the stream in the playlist | Verify that the stream starts playing again |
- | Select [Next File] | Verify that the player started playing the next file in the playlist |
- | Select [Previous File] | Verify that the original stream is playing again |
- | During stream playback, have headphones connected to device | Verify that the sound is now playing through the headphones |
- | Invoke a system notification on the device (such as an incoming SMS) | Verify that the device correctly transmits the audible system notification through the devices speakers and then returns to playing the stream through the headphones |
- "));
- },
-
- take_a_video: function()
- {
- // Test meta data
- testApplication = "Multimedia - Video Camera";
- testBinary = "camera";
- testGoal = "Verify that the camera can capture and save an audio/video file.";
- testPreconditions = "";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | If device has lens cover, make sure it is open | |
- | Select Video tab to put camera in video mode | Verify the intended scene is reproduced in the preview/viewfinder |
- | Select Record Video | Verify that video is shown on screen for preview |
- | Select Pause | Verify that the Recorded counter has stopped |
- | Select Record again | Verify that the Recorded counter has continued counting |
- | Select Stop | Verify that the recording has now stopped |
- | | Verify that a new file is in the Images folder and accessabble with the player |
- | Select given video | Verify that it is a true representation of the intended sceen |
- | | Verify that the Pause in the recording has happened and that recording continued without an issue after that |
- | | Verify the image has no unintended artifacts and noise and is properly formatted |
- "));
- },
-
- change_video_settings: function()
- {
- // Test meta data
- testApplication = "Multimedia - Video Camera";
- testBinary = "camera";
- testGoal = "Verify that the camera can change its Video settings successfully.";
- testPreconditions = "";
- testGroups = "BAT";
-
- // Test steps
- prompt(twiki("---+++ " + testApplication + "<br><br>
- *Goal:* " + testGoal + "<br>
- *Pre-Requisites:* " + testPreconditions + "<br>
- *Tested Binary:* " + testBinary + "<br>
-
- | *Step* | *Verification* |
- | Launch " + testBinary + " | App launches normally |
- | If device has lens cover, make sure it is open | |
- | Select Video tab to put camera in video mode | Verify the intended scene is reproduced in the preview/viewfinder |
- | In the Menu Bar, select Settings/Devices | Verify that you can select Primay and Secondary Camera on Device |
- | Select Secondary Camera | Verify that devise is now showing video stram from Front Facing camera |
- | Select Settings/File/Settings | Verify that you now have otion to select Audio Codecs, Resolution Sample Rate, Framerate, Quality, Video Codecs and Container Format |
- | Change Audio Codecs to another supported Codecs | Verify that camera can record |
- | Change Resolutiuon to another supported Resolution | Verify that camera can record |
- | Change Sample Rate to another supported Sample Rate | Verify that camera can record |
- | Change Framerate to another supported Framerate | Verify that camera can record |
- | Change Quality | Verify that camera can record |
- | Change Video Codecs to another supported Video Codecs | Verify that camera can record |
- | Change Container Format | Verify that camera can record |
- | Change Quality | Verify that camera can record |
- "));
- },
-
-}
diff --git a/tests/tests.pro b/tests/tests.pro
deleted file mode 100644
index 2bd49bd..0000000
--- a/tests/tests.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += auto
-
-# Disabled since we don't have any source.
-# SUBDIRS += benchmarks manual