diff options
author | Yoann Lopes <yoann.lopes@digia.com> | 2013-08-23 16:55:46 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@digia.com> | 2013-08-23 16:55:46 +0200 |
commit | 39c7b87c4930f9eb3b2fd51b8e99381710e12d99 (patch) | |
tree | acc4ae263430528889ca2e34479851609b330ed1 | |
parent | 6fb2c610d6790933c593b272511f5da0d90aa454 (diff) | |
parent | 9f15a98891bd59e56a237711949e94e0c5f13e88 (diff) | |
download | qtmultimedia-39c7b87c4930f9eb3b2fd51b8e99381710e12d99.tar.gz |
Merge branch 'dev' into wip/android
Conflicts:
src/multimedia/multimedia.pro
src/plugins/android/mediaplayer/mediaplayer.json
src/plugins/android/src/common/qandroidvideooutput.h
src/plugins/android/src/common/qandroidvideorendercontrol.cpp
src/plugins/android/src/common/qandroidvideorendercontrol.h
src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp
src/plugins/plugins.pro
Change-Id: I24161d48f4b913308cea55bee9834481cb04ef3d
111 files changed, 922 insertions, 347 deletions
diff --git a/config.tests/android/android.pro b/config.tests/android/android.pro deleted file mode 100644 index dcf5df184..000000000 --- a/config.tests/android/android.pro +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG += java -API_VERSION = android-11 -JAVASOURCES += main.java - diff --git a/config.tests/android/main.java b/config.tests/android/main.java deleted file mode 100644 index 1ab872599..000000000 --- a/config.tests/android/main.java +++ /dev/null @@ -1,6 +0,0 @@ -import android.graphics.SurfaceTexture; - -class BuildTest -{ - public static void main(String [] args) { } -} diff --git a/config.tests/resourcepolicy/resourcepolicy.pro b/config.tests/resourcepolicy/resourcepolicy.pro index 9dddaa966..7627d4805 100644 --- a/config.tests/resourcepolicy/resourcepolicy.pro +++ b/config.tests/resourcepolicy/resourcepolicy.pro @@ -3,5 +3,5 @@ SOURCES += main.cpp CONFIG += link_pkgconfig PKGCONFIG += \ - libresourceqt1 + libresourceqt5 diff --git a/dist/changes-5.1.0 b/dist/changes-5.1.0 new file mode 100644 index 000000000..937d6facd --- /dev/null +++ b/dist/changes-5.1.0 @@ -0,0 +1,38 @@ +Qt 5.1 introduces many new features and improvements as well as bugfixes +over the 5.0.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + + http://qt-project.org/doc/qt-5.1 + +The Qt version 5.1 series is binary compatible with the 5.0.x series. +Applications compiled for 5.0 will continue to run with 5.1. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt-project.org/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* General * +**************************************************************************** + + - Fixed signal not being emitted in QDeclarativeCameraFocus. + - Decouple qmediametadata.h from qmultimedia.h + - Reset VideoSurface pointer when deleted + - Fix crash on idle status change with 64 bit architectures. + - Add support for m3u8 playlist formats + - Fix calculation bug in QWaveDecoder. + + - [QTBUG-28047]Â Make directshow-plugin available. + - [QTBUG-28589]Â Add error handling in image capturing in camera + - [QTBUG-30411]Â AVFoundation: Emit error when media fails to load + +Qt for Android +-------------- + + - Add libQt5MultimediaQuick_p to the list of dependencies. + - Fixed crash when resetting the video surface. + - Add MediaPlayer support for Android diff --git a/examples/multimediawidgets/declarative-camera/CameraButton.qml b/examples/multimedia/declarative-camera/CameraButton.qml index b0353b4c3..b0353b4c3 100644 --- a/examples/multimediawidgets/declarative-camera/CameraButton.qml +++ b/examples/multimedia/declarative-camera/CameraButton.qml diff --git a/examples/multimediawidgets/declarative-camera/CameraPropertyButton.qml b/examples/multimedia/declarative-camera/CameraPropertyButton.qml index 033f73415..033f73415 100644 --- a/examples/multimediawidgets/declarative-camera/CameraPropertyButton.qml +++ b/examples/multimedia/declarative-camera/CameraPropertyButton.qml diff --git a/examples/multimediawidgets/declarative-camera/CameraPropertyPopup.qml b/examples/multimedia/declarative-camera/CameraPropertyPopup.qml index 130de95f4..130de95f4 100644 --- a/examples/multimediawidgets/declarative-camera/CameraPropertyPopup.qml +++ b/examples/multimedia/declarative-camera/CameraPropertyPopup.qml diff --git a/examples/multimediawidgets/declarative-camera/FocusButton.qml b/examples/multimedia/declarative-camera/FocusButton.qml index b3966f249..b3966f249 100644 --- a/examples/multimediawidgets/declarative-camera/FocusButton.qml +++ b/examples/multimedia/declarative-camera/FocusButton.qml diff --git a/examples/multimediawidgets/declarative-camera/PhotoCaptureControls.qml b/examples/multimedia/declarative-camera/PhotoCaptureControls.qml index 991a46e14..991a46e14 100644 --- a/examples/multimediawidgets/declarative-camera/PhotoCaptureControls.qml +++ b/examples/multimedia/declarative-camera/PhotoCaptureControls.qml diff --git a/examples/multimediawidgets/declarative-camera/PhotoPreview.qml b/examples/multimedia/declarative-camera/PhotoPreview.qml index 34b272dc6..34b272dc6 100644 --- a/examples/multimediawidgets/declarative-camera/PhotoPreview.qml +++ b/examples/multimedia/declarative-camera/PhotoPreview.qml diff --git a/examples/multimediawidgets/declarative-camera/VideoCaptureControls.qml b/examples/multimedia/declarative-camera/VideoCaptureControls.qml index e178ff15c..e178ff15c 100644 --- a/examples/multimediawidgets/declarative-camera/VideoCaptureControls.qml +++ b/examples/multimedia/declarative-camera/VideoCaptureControls.qml diff --git a/examples/multimediawidgets/declarative-camera/VideoPreview.qml b/examples/multimedia/declarative-camera/VideoPreview.qml index 597b5b8c7..597b5b8c7 100644 --- a/examples/multimediawidgets/declarative-camera/VideoPreview.qml +++ b/examples/multimedia/declarative-camera/VideoPreview.qml diff --git a/examples/multimediawidgets/declarative-camera/ZoomControl.qml b/examples/multimedia/declarative-camera/ZoomControl.qml index 1bfda7500..1bfda7500 100644 --- a/examples/multimediawidgets/declarative-camera/ZoomControl.qml +++ b/examples/multimedia/declarative-camera/ZoomControl.qml diff --git a/examples/multimediawidgets/declarative-camera/declarative-camera.pro b/examples/multimedia/declarative-camera/declarative-camera.pro index 5fb0a1b51..71d4f68b0 100644 --- a/examples/multimediawidgets/declarative-camera/declarative-camera.pro +++ b/examples/multimedia/declarative-camera/declarative-camera.pro @@ -6,6 +6,6 @@ QT += quick qml multimedia SOURCES += qmlcamera.cpp RESOURCES += declarative-camera.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/multimediawidgets/declarative-camera +target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/declarative-camera INSTALLS += target diff --git a/examples/multimediawidgets/declarative-camera/declarative-camera.qml b/examples/multimedia/declarative-camera/declarative-camera.qml index 3e7ed4c25..3e7ed4c25 100644 --- a/examples/multimediawidgets/declarative-camera/declarative-camera.qml +++ b/examples/multimedia/declarative-camera/declarative-camera.qml diff --git a/examples/multimediawidgets/declarative-camera/declarative-camera.qmlproject b/examples/multimedia/declarative-camera/declarative-camera.qmlproject index 53f5ecb8d..53f5ecb8d 100644 --- a/examples/multimediawidgets/declarative-camera/declarative-camera.qmlproject +++ b/examples/multimedia/declarative-camera/declarative-camera.qmlproject diff --git a/examples/multimediawidgets/declarative-camera/declarative-camera.qrc b/examples/multimedia/declarative-camera/declarative-camera.qrc index d99b86c0c..d99b86c0c 100644 --- a/examples/multimediawidgets/declarative-camera/declarative-camera.qrc +++ b/examples/multimedia/declarative-camera/declarative-camera.qrc diff --git a/examples/multimediawidgets/declarative-camera/doc/images/qml-camera.png b/examples/multimedia/declarative-camera/doc/images/qml-camera.png Binary files differindex 0cd61f0a0..0cd61f0a0 100644 --- a/examples/multimediawidgets/declarative-camera/doc/images/qml-camera.png +++ b/examples/multimedia/declarative-camera/doc/images/qml-camera.png diff --git a/examples/multimediawidgets/declarative-camera/doc/src/declarative-camera.qdoc b/examples/multimedia/declarative-camera/doc/src/declarative-camera.qdoc index 02e77854c..02e77854c 100644 --- a/examples/multimediawidgets/declarative-camera/doc/src/declarative-camera.qdoc +++ b/examples/multimedia/declarative-camera/doc/src/declarative-camera.qdoc diff --git a/examples/multimediawidgets/declarative-camera/images/camera_auto_mode.png b/examples/multimedia/declarative-camera/images/camera_auto_mode.png Binary files differindex f168296cf..f168296cf 100644 --- a/examples/multimediawidgets/declarative-camera/images/camera_auto_mode.png +++ b/examples/multimedia/declarative-camera/images/camera_auto_mode.png diff --git a/examples/multimediawidgets/declarative-camera/images/camera_camera_setting.png b/examples/multimedia/declarative-camera/images/camera_camera_setting.png Binary files differindex 7b993eee9..7b993eee9 100644 --- a/examples/multimediawidgets/declarative-camera/images/camera_camera_setting.png +++ b/examples/multimedia/declarative-camera/images/camera_camera_setting.png diff --git a/examples/multimediawidgets/declarative-camera/images/camera_flash_auto.png b/examples/multimedia/declarative-camera/images/camera_flash_auto.png Binary files differindex fb5cc40ec..fb5cc40ec 100644 --- a/examples/multimediawidgets/declarative-camera/images/camera_flash_auto.png +++ b/examples/multimedia/declarative-camera/images/camera_flash_auto.png diff --git a/examples/multimediawidgets/declarative-camera/images/camera_flash_fill.png b/examples/multimedia/declarative-camera/images/camera_flash_fill.png Binary files differindex 7bc5949ac..7bc5949ac 100644 --- a/examples/multimediawidgets/declarative-camera/images/camera_flash_fill.png +++ b/examples/multimedia/declarative-camera/images/camera_flash_fill.png diff --git a/examples/multimediawidgets/declarative-camera/images/camera_flash_off.png b/examples/multimedia/declarative-camera/images/camera_flash_off.png Binary files differindex 3c5db10cc..3c5db10cc 100644 --- a/examples/multimediawidgets/declarative-camera/images/camera_flash_off.png +++ b/examples/multimedia/declarative-camera/images/camera_flash_off.png diff --git a/examples/multimediawidgets/declarative-camera/images/camera_flash_redeye.png b/examples/multimedia/declarative-camera/images/camera_flash_redeye.png Binary files differindex 534a087df..534a087df 100644 --- a/examples/multimediawidgets/declarative-camera/images/camera_flash_redeye.png +++ b/examples/multimedia/declarative-camera/images/camera_flash_redeye.png diff --git a/examples/multimediawidgets/declarative-camera/images/camera_white_balance_cloudy.png b/examples/multimedia/declarative-camera/images/camera_white_balance_cloudy.png Binary files differindex 243b699e7..243b699e7 100644 --- a/examples/multimediawidgets/declarative-camera/images/camera_white_balance_cloudy.png +++ b/examples/multimedia/declarative-camera/images/camera_white_balance_cloudy.png diff --git a/examples/multimediawidgets/declarative-camera/images/camera_white_balance_flourescent.png b/examples/multimedia/declarative-camera/images/camera_white_balance_flourescent.png Binary files differindex 032efe1d1..032efe1d1 100644 --- a/examples/multimediawidgets/declarative-camera/images/camera_white_balance_flourescent.png +++ b/examples/multimedia/declarative-camera/images/camera_white_balance_flourescent.png diff --git a/examples/multimediawidgets/declarative-camera/images/camera_white_balance_incandescent.png b/examples/multimedia/declarative-camera/images/camera_white_balance_incandescent.png Binary files differindex 98f906741..98f906741 100644 --- a/examples/multimediawidgets/declarative-camera/images/camera_white_balance_incandescent.png +++ b/examples/multimedia/declarative-camera/images/camera_white_balance_incandescent.png diff --git a/examples/multimediawidgets/declarative-camera/images/camera_white_balance_sunny.png b/examples/multimedia/declarative-camera/images/camera_white_balance_sunny.png Binary files differindex d7d5c9a36..d7d5c9a36 100644 --- a/examples/multimediawidgets/declarative-camera/images/camera_white_balance_sunny.png +++ b/examples/multimedia/declarative-camera/images/camera_white_balance_sunny.png diff --git a/examples/multimediawidgets/declarative-camera/images/toolbutton.png b/examples/multimedia/declarative-camera/images/toolbutton.png Binary files differindex 11310013e..11310013e 100644 --- a/examples/multimediawidgets/declarative-camera/images/toolbutton.png +++ b/examples/multimedia/declarative-camera/images/toolbutton.png diff --git a/examples/multimediawidgets/declarative-camera/images/toolbutton.sci b/examples/multimedia/declarative-camera/images/toolbutton.sci index 9e4f96530..9e4f96530 100644 --- a/examples/multimediawidgets/declarative-camera/images/toolbutton.sci +++ b/examples/multimedia/declarative-camera/images/toolbutton.sci diff --git a/examples/multimediawidgets/declarative-camera/qmlcamera.cpp b/examples/multimedia/declarative-camera/qmlcamera.cpp index bf74831a3..bf74831a3 100644 --- a/examples/multimediawidgets/declarative-camera/qmlcamera.cpp +++ b/examples/multimedia/declarative-camera/qmlcamera.cpp diff --git a/examples/multimedia/multimedia.pro b/examples/multimedia/multimedia.pro index bacbba984..449cb150f 100644 --- a/examples/multimedia/multimedia.pro +++ b/examples/multimedia/multimedia.pro @@ -13,8 +13,9 @@ qtHaveModule(widgets) { audiooutput \ } -qtHaveModule(gui):qtHaveModule(qml) { +qtHaveModule(quick) { SUBDIRS += \ + declarative-camera \ declarative-radio \ video } diff --git a/examples/multimedia/video/doc/src/qmlvideo.qdoc b/examples/multimedia/video/doc/src/qmlvideo.qdoc index 1efed8005..6d6833497 100644 --- a/examples/multimedia/video/doc/src/qmlvideo.qdoc +++ b/examples/multimedia/video/doc/src/qmlvideo.qdoc @@ -52,15 +52,15 @@ which moves across the \l{VideoOutput} item. \section1 Application structure -The \l{multimedia/video/qmlvideo/qml/qmlvideo/main.qml} file creates a UI which includes +The \l{video/qmlvideo/qml/qmlvideo/main.qml} file creates a UI which includes the following items: \list - \li Two \l{multimedia/video/qmlvideo/qml/qmlvideo/Button.qml}{Button} instances, each + \li Two \l{video/qmlvideo/qml/qmlvideo/Button.qml}{Button} instances, each of which displays a filename, and can be used to launch a - \l{multimedia/video/qmlvideo/qml/qmlvideo/FileBrowser.qml}{FileBrowser} - \li An exit \l{multimedia/video/qmlvideo/qml/qmlvideo/Button.qml}{Button} - \li A \l{multimedia/video/qmlvideo/qml/qmlvideo/SceneSelectionPanel.qml}{SceneSelectionPanel}, + \l{video/qmlvideo/qml/qmlvideo/FileBrowser.qml}{FileBrowser} + \li An exit \l{video/qmlvideo/qml/qmlvideo/Button.qml}{Button} + \li A \l{video/qmlvideo/qml/qmlvideo/SceneSelectionPanel.qml}{SceneSelectionPanel}, which is a flickable list displaying the available scenes \li At the lower left, an item which displays the QML repainting rate - the upper number is the instantaneous frame rate and the lower number is the @@ -72,18 +72,18 @@ the following items: Each scene in the flickable list is implemented in its own QML file - for example the video-basic scene (which just displays a static \l{VideoOutput} in the center of the screen) is implemented in the -\l{multimedia/video/qmlvideo/qml/qmlvideo/VideoBasic.qml}{VideoBasic.qml} file. As you +\l{video/qmlvideo/qml/qmlvideo/VideoBasic.qml}{VideoBasic.qml} file. As you can see from the code, this makes use of a type of inheritance: a -\l{multimedia/video/qmlvideo/qml/qmlvideo/VideoBasic.qml}{VideoBasic} item ... +\l{video/qmlvideo/qml/qmlvideo/VideoBasic.qml}{VideoBasic} item ... -\quotefromfile multimedia/video/qmlvideo/qml/qmlvideo/VideoBasic.qml +\quotefromfile video/qmlvideo/qml/qmlvideo/VideoBasic.qml \skipto import \printuntil /^\}/ ... is-a -\l{multimedia/video/qmlvideo/qml/qmlvideo/SceneBasic.qml}{SceneBasic} ... +\l{video/qmlvideo/qml/qmlvideo/SceneBasic.qml}{SceneBasic} ... -\quotefromfile multimedia/video/qmlvideo/qml/qmlvideo/SceneBasic.qml +\quotefromfile video/qmlvideo/qml/qmlvideo/SceneBasic.qml \skipto import \printuntil contentType \dots @@ -94,9 +94,9 @@ can see from the code, this makes use of a type of inheritance: a \printuntil /^\}/ ... which is-a -\l{multimedia/video/qmlvideo/qml/qmlvideo/Scene.qml}{Scene}: +\l{video/qmlvideo/qml/qmlvideo/Scene.qml}{Scene}: -\quotefromfile multimedia/video/qmlvideo/qml/qmlvideo/Scene.qml +\quotefromfile video/qmlvideo/qml/qmlvideo/Scene.qml \skipto import \printuntil root \dots @@ -106,25 +106,25 @@ can see from the code, this makes use of a type of inheritance: a \skipto Button \printuntil /^\}/ -\l{multimedia/video/qmlvideo/qml/qmlvideo/SceneBasic.qml}{SceneBasic} describes the +\l{video/qmlvideo/qml/qmlvideo/SceneBasic.qml}{SceneBasic} describes the structure and behaviour of the scene, but is agnostic of the type of content which will be displayed - this is abstracted by -\l{multimedia/video/qmlvideo/qml/qmlvideo/Content.qml}{Content}. +\l{video/qmlvideo/qml/qmlvideo/Content.qml}{Content}. This pattern allows us to define a particular use case (in this case, simply display a static piece of content), and then instantiate that use case for both video content -(\l{multimedia/video/qmlvideo/qml/qmlvideo/VideoBasic.qml}{VideoBasic}) and cameracontent -(\l{multimedia/video/qmlvideo/qml/qmlvideo/CameraBasic.qml}{CameraBasic}). This approach +(\l{video/qmlvideo/qml/qmlvideo/VideoBasic.qml}{VideoBasic}) and camera content +(\l{video/qmlvideo/qml/qmlvideo/CameraBasic.qml}{CameraBasic}). This approach is used to implement many of the other scenes - for example, "repeatedly slide the content from left to right and back again" is implemented by -\l{multimedia/video/qmlvideo/qml/qmlvideo/SceneMove.qml}{SceneMove}, on which -\l{multimedia/video/qmlvideo/qml/qmlvideo/VideoMove.qml}{VideoMove} and -\l{multimedia/video/qmlvideo/qml/qmlvideo/CameraMove.qml}{CameraMove} are based. +\l{video/qmlvideo/qml/qmlvideo/SceneMove.qml}{SceneMove}, on which +\l{video/qmlvideo/qml/qmlvideo/VideoMove.qml}{VideoMove} and +\l{video/qmlvideo/qml/qmlvideo/CameraMove.qml}{CameraMove} are based. Depending on the value of the contentType property in the top-level scene instance, the embedded -\l{multimedia/video/qmlvideo/qml/qmlvideo/Content.qml}{Content} item creates either a +\l{video/qmlvideo/qml/qmlvideo/Content.qml}{Content} item creates either a \l{MediaPlayer} or a \l{Camera} item. \section1 Calculating and displaying QML painting rate @@ -134,7 +134,7 @@ instance, the embedded All that remains is to connect the afterRendering() signal of the QQuickView object to a JavaScript function, which will eventually call frequencyItem.notify(): -\quotefromfile multimedia/video/qmlvideo/main.cpp +\quotefromfile video/qmlvideo/main.cpp \skipto QGuiApplication \printuntil ; \dots diff --git a/examples/multimedia/video/doc/src/qmlvideofx.qdoc b/examples/multimedia/video/doc/src/qmlvideofx.qdoc index f4abbc571..b7bd78ac7 100644 --- a/examples/multimedia/video/doc/src/qmlvideofx.qdoc +++ b/examples/multimedia/video/doc/src/qmlvideofx.qdoc @@ -134,10 +134,10 @@ types is a bit more complicated, for the following reasons: \endlist The abstraction of source item type is achieved by the -\l{multimedia/video/qmlvideofx/qml/qmlvideofx/Content.qml}{Content}, which uses a +\l{video/qmlvideofx/qml/qmlvideofx/Content.qml}{Content}, which uses a \l{Loader} to create either a \l{MediaPlayer}, \l{Camera} or \l{Image}: -\quotefromfile multimedia/video/qmlvideofx/qml/qmlvideofx/Content.qml +\quotefromfile video/qmlvideofx/qml/qmlvideofx/Content.qml \skipto import \printuntil { \dots @@ -164,10 +164,10 @@ The abstraction of source item type is achieved by the \printuntil } Each effect is implemented as a QML item which is based on the -\l{multimedia/video/qmlvideofx/qml/qmlvideofx/Effect.qml}{Effect}, which in turn +\l{video/qmlvideofx/qml/qmlvideofx/Effect.qml}{Effect}, which in turn is based on the \l{ShaderEffect}: -\quotefromfile multimedia/video/qmlvideofx/qml/qmlvideofx/Effect.qml +\quotefromfile video/qmlvideofx/qml/qmlvideofx/Effect.qml \skipto import \printuntil /^\}/ @@ -179,20 +179,20 @@ implementation of the pixelation effect. As you can see, the pixelation effect supports one parameter (which controls the pixelation granularity), and states that the divider should be displayed. -\quotefromfile multimedia/video/qmlvideofx/qml/qmlvideofx/EffectPixelate.qml +\quotefromfile video/qmlvideofx/qml/qmlvideofx/EffectPixelate.qml \skipto import \printuntil /^\}/ The main.qml file shows a -\l{multimedia/video/qmlvideofx/qml/qmlvideofx/FileOpen.qml}{FileOpen}, which allows +\l{video/qmlvideofx/qml/qmlvideofx/FileOpen.qml}{FileOpen}, which allows the user to select the input source and an -\l{multimedia/video/qmlvideofx/qml/qmlvideofx/EffectSelectionPanel.qml}{EffectSelectionPanel} +\l{video/qmlvideofx/qml/qmlvideofx/EffectSelectionPanel.qml}{EffectSelectionPanel} item, which lists each of the available shader effects. As described above, a -\l{multimedia/video/qmlvideofx/qml/qmlvideofx/Content.qml}{Content} item is used to load the +\l{video/qmlvideofx/qml/qmlvideofx/Content.qml}{Content} item is used to load the appropriate input and effect type. A -\l{multimedia/video/qmlvideofx/qml/qmlvideofx/Divider.qml}{Divider} item draws the +\l{video/qmlvideofx/qml/qmlvideofx/Divider.qml}{Divider} item draws the vertical dividing line, which can be dragged left / right by the user. Finally, -a \l{multimedia/video/qmlvideofx/qml/qmlvideofx/ParameterPanel.qml}{ParameterPanel} item +a \l{video/qmlvideofx/qml/qmlvideofx/ParameterPanel.qml}{ParameterPanel} item renders the sliders corresponding to each effect parameter. Here is the source selection menu: @@ -208,7 +208,7 @@ And here is the effect selection menu: All that remains is to connect the afterRendering() signal of the QQuickView object to a JavaScript function, which will eventually call frequencyItem.notify(): -\quotefromfile multimedia/video/qmlvideofx/main.cpp +\quotefromfile video/qmlvideofx/main.cpp \skipto QGuiApplication \printuntil ; \dots diff --git a/examples/multimedia/video/qmlvideo/main.cpp b/examples/multimedia/video/qmlvideo/main.cpp index e44476a15..a14684ff7 100644 --- a/examples/multimedia/video/qmlvideo/main.cpp +++ b/examples/multimedia/video/qmlvideo/main.cpp @@ -129,13 +129,11 @@ int main(int argc, char *argv[]) rootObject, SLOT(qmlFramePainted())); #endif - QUrl videoPath; const QStringList moviesLocation = QStandardPaths::standardLocations(QStandardPaths::MoviesLocation); - if (moviesLocation.isEmpty()) { - QUrl appPath(QString("file:///%1").arg(app.applicationDirPath())); - videoPath = appPath.resolved(QUrl("./")); - } else - videoPath = QString("file:///%1").arg(moviesLocation.first()); + const QUrl videoPath = + QUrl::fromLocalFile(moviesLocation.isEmpty() ? + app.applicationDirPath() : + moviesLocation.front()); viewer.rootContext()->setContextProperty("videoPath", videoPath); QMetaObject::invokeMethod(rootObject, "init"); diff --git a/examples/multimedia/video/qmlvideo/qml/qmlvideo/FileBrowser.qml b/examples/multimedia/video/qmlvideo/qml/qmlvideo/FileBrowser.qml index 04f1092f4..b3e82c8d2 100644 --- a/examples/multimedia/video/qmlvideo/qml/qmlvideo/FileBrowser.qml +++ b/examples/multimedia/video/qmlvideo/qml/qmlvideo/FileBrowser.qml @@ -101,7 +101,10 @@ Rectangle { Rectangle { id: wrapper function launch() { - var path = "file:///" + filePath; + var path = "file://"; + if (filePath.length > 2 && filePath[1] === ':') // Windows drive logic, see QUrl::fromLocalFile() + path += '/'; + path += filePath; if (folders.isFolder(index)) down(path); else @@ -306,7 +309,7 @@ Rectangle { MouseArea { id: upRegion; anchors.centerIn: parent width: 56 height: 56 - onClicked: if (folders.parentFolder != "") up() + onClicked: up() } states: [ State { @@ -352,6 +355,8 @@ Rectangle { function up() { var path = folders.parentFolder; + if (path.toString().length === 0 || path.toString() === 'file:') + return; if (folders == folders1) { view = view2 folders = folders2; diff --git a/examples/multimedia/video/qmlvideo/qmlvideo.pro b/examples/multimedia/video/qmlvideo/qmlvideo.pro index 3ea513d3a..26865c59a 100644 --- a/examples/multimedia/video/qmlvideo/qmlvideo.pro +++ b/examples/multimedia/video/qmlvideo/qmlvideo.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = qmlvideo -QT += quick +QT += quick multimedia LOCAL_SOURCES = main.cpp LOCAL_HEADERS = trace.h diff --git a/examples/multimedia/video/qmlvideofx/main.cpp b/examples/multimedia/video/qmlvideofx/main.cpp index ab613daa8..b0698e236 100644 --- a/examples/multimedia/video/qmlvideofx/main.cpp +++ b/examples/multimedia/video/qmlvideofx/main.cpp @@ -116,13 +116,13 @@ int main(int argc, char *argv[]) FileReader fileReader; viewer.rootContext()->setContextProperty("fileReader", &fileReader); - QUrl appPath(QString("file:///%1").arg(app.applicationDirPath())); + QUrl appPath(QString("file://%1").arg(app.applicationDirPath())); QUrl imagePath; const QStringList picturesLocation = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); if (picturesLocation.isEmpty()) imagePath = appPath.resolved(QUrl("images")); else - imagePath = QString("file:///%1").arg(picturesLocation.first()); + imagePath = QString("file://%1").arg(picturesLocation.first()); viewer.rootContext()->setContextProperty("imagePath", imagePath); QUrl videoPath; @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) if (moviesLocation.isEmpty()) videoPath = appPath.resolved(QUrl("./")); else - videoPath = QString("file:///%1").arg(moviesLocation.first()); + videoPath = QString("file://%1").arg(moviesLocation.first()); viewer.rootContext()->setContextProperty("videoPath", videoPath); viewer.setTitle("qmlvideofx"); diff --git a/examples/multimedia/video/qmlvideofx/qml/qmlvideofx/FileBrowser.qml b/examples/multimedia/video/qmlvideofx/qml/qmlvideofx/FileBrowser.qml index c089f6b1b..3d4343c25 100644 --- a/examples/multimedia/video/qmlvideofx/qml/qmlvideofx/FileBrowser.qml +++ b/examples/multimedia/video/qmlvideofx/qml/qmlvideofx/FileBrowser.qml @@ -102,7 +102,7 @@ Rectangle { Rectangle { id: wrapper function launch() { - var path = "file:///" + filePath + var path = "file://" + filePath if (folders.isFolder(index)) down(path); else diff --git a/examples/multimedia/video/qmlvideofx/qmlvideofx.pro b/examples/multimedia/video/qmlvideofx/qmlvideofx.pro index d62ade86d..563444903 100644 --- a/examples/multimedia/video/qmlvideofx/qmlvideofx.pro +++ b/examples/multimedia/video/qmlvideofx/qmlvideofx.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = qmlvideofx -QT += quick +QT += quick multimedia SOURCES += filereader.cpp main.cpp HEADERS += filereader.h trace.h diff --git a/examples/multimediawidgets/multimediawidgets.pro b/examples/multimediawidgets/multimediawidgets.pro index d8990cdc3..001a78d50 100644 --- a/examples/multimediawidgets/multimediawidgets.pro +++ b/examples/multimediawidgets/multimediawidgets.pro @@ -9,8 +9,3 @@ qtHaveModule(widgets) { player \ customvideosurface } - -qtHaveModule(gui):qtHaveModule(qml) { - disabled:SUBDIRS += declarative-camera -} - diff --git a/qtmultimedia.pro b/qtmultimedia.pro index 264bbc1f8..d285c3cbc 100644 --- a/qtmultimedia.pro +++ b/qtmultimedia.pro @@ -1,3 +1,5 @@ +requires(qtHaveModule(gui)) + load(configure) qtCompileTest(openal) qtCompileTest(opensles) @@ -5,12 +7,14 @@ win32 { qtCompileTest(directshow) qtCompileTest(wmsdk) qtCompileTest(wmp) - qtCompileTest(wmf) + contains(QT_CONFIG, wmf-backend): qtCompileTest(wmf) qtCompileTest(evr) } else:mac { qtCompileTest(avfoundation) } else:android { - !qtCompileTest(android):error("QtMultimedia for Android requires API level 11") + SDK_ROOT = $$(ANDROID_SDK_ROOT) + isEmpty(SDK_ROOT): SDK_ROOT = $$DEFAULT_ANDROID_SDK_ROOT + !exists($$SDK_ROOT/platforms/android-11/android.jar): error("QtMultimedia for Android requires API level 11") } else { qtCompileTest(alsa) qtCompileTest(pulseaudio) diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro index 9d1f7c8f0..d3025797b 100644 --- a/src/gsttools/gsttools.pro +++ b/src/gsttools/gsttools.pro @@ -26,7 +26,7 @@ maemo*:PKGCONFIG +=gstreamer-plugins-bad-0.10 config_resourcepolicy { DEFINES += HAVE_RESOURCE_POLICY - PKGCONFIG += libresourceqt1 + PKGCONFIG += libresourceqt5 } # Header files must go inside source directory of a module diff --git a/src/imports/audioengine/qmldir b/src/imports/audioengine/qmldir index 94335c03a..d853c8022 100644 --- a/src/imports/audioengine/qmldir +++ b/src/imports/audioengine/qmldir @@ -1 +1,3 @@ +module QtAudioEngine plugin declarative_audioengine +typeinfo plugins.qmltypes diff --git a/src/imports/multimedia/plugins.qmltypes b/src/imports/multimedia/plugins.qmltypes index b2970649f..12d7ea85d 100644 --- a/src/imports/multimedia/plugins.qmltypes +++ b/src/imports/multimedia/plugins.qmltypes @@ -132,6 +132,7 @@ Module { name: "QDeclarativeAudio" prototype: "QObject" exports: ["QtMultimedia/Audio 5.0", "QtMultimedia/MediaPlayer 5.0"] + exportMetaObjectRevisions: [0, 0] Enum { name: "Status" values: { @@ -230,6 +231,7 @@ Module { name: "QDeclarativeCamera" prototype: "QObject" exports: ["QtMultimedia/Camera 5.0"] + exportMetaObjectRevisions: [0] Enum { name: "CaptureMode" values: { @@ -448,6 +450,7 @@ Module { name: "QDeclarativeCameraCapture" prototype: "QObject" exports: ["QtMultimedia/CameraCapture 5.0"] + exportMetaObjectRevisions: [0] Property { name: "ready"; type: "bool"; isReadonly: true } Property { name: "capturedImagePath"; type: "string"; isReadonly: true } Property { name: "resolution"; type: "QSize" } @@ -506,6 +509,7 @@ Module { name: "QDeclarativeCameraExposure" prototype: "QObject" exports: ["QtMultimedia/CameraExposure 5.0"] + exportMetaObjectRevisions: [0] Property { name: "exposureCompensation"; type: "double" } Property { name: "iso"; type: "int"; isReadonly: true } Property { name: "shutterSpeed"; type: "double"; isReadonly: true } @@ -584,6 +588,7 @@ Module { name: "QDeclarativeCameraFlash" prototype: "QObject" exports: ["QtMultimedia/CameraFlash 5.0"] + exportMetaObjectRevisions: [0] Property { name: "ready"; type: "bool"; isReadonly: true } Property { name: "mode"; type: "int" } Signal { @@ -603,6 +608,7 @@ Module { name: "QDeclarativeCameraFocus" prototype: "QObject" exports: ["QtMultimedia/CameraFocus 5.0"] + exportMetaObjectRevisions: [0] Property { name: "focusMode"; type: "QDeclarativeCamera::FocusMode" } Property { name: "focusPointMode"; type: "QDeclarativeCamera::FocusPointMode" } Property { name: "customFocusPoint"; type: "QPointF" } @@ -646,6 +652,7 @@ Module { name: "QDeclarativeCameraImageProcessing" prototype: "QObject" exports: ["QtMultimedia/CameraImageProcessing 5.0"] + exportMetaObjectRevisions: [0] Enum { name: "WhiteBalanceMode" values: { @@ -720,6 +727,7 @@ Module { name: "QDeclarativeCameraRecorder" prototype: "QObject" exports: ["QtMultimedia/CameraRecorder 5.0"] + exportMetaObjectRevisions: [0] Enum { name: "RecorderState" values: { @@ -918,6 +926,7 @@ Module { name: "QDeclarativeRadio" prototype: "QObject" exports: ["QtMultimedia/Radio 5.0"] + exportMetaObjectRevisions: [0] Enum { name: "State" values: { @@ -1071,6 +1080,7 @@ Module { name: "QDeclarativeRadioData" prototype: "QObject" exports: ["QtMultimedia/RadioData 5.0"] + exportMetaObjectRevisions: [0] Enum { name: "Error" values: { @@ -1192,6 +1202,7 @@ Module { name: "QDeclarativeTorch" prototype: "QObject" exports: ["QtMultimedia/Torch 5.0"] + exportMetaObjectRevisions: [0] Property { name: "enabled"; type: "bool" } Property { name: "power"; type: "int" } } @@ -1200,6 +1211,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtMultimedia/VideoOutput 5.0"] + exportMetaObjectRevisions: [0] Enum { name: "FillMode" values: { @@ -1289,6 +1301,7 @@ Module { name: "QSoundEffect" prototype: "QObject" exports: ["QtMultimedia/SoundEffect 5.0"] + exportMetaObjectRevisions: [0] Enum { name: "Loop" values: { diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index 9b9c3fb25..d2a4eea3a 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -197,23 +197,22 @@ 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; + int err = -1; + snd_pcm_t* pcmHandle; snd_pcm_hw_params_t *params; - QString dev = device; - - QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput); + QString dev; - if(dev.compare(QLatin1String("default")) == 0) { #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) - dev = QLatin1String(devices.first().constData()); + dev = device; + if (dev.compare(QLatin1String("default")) == 0) { + QList<QByteArray> devices = availableDevices(QAudio::AudioOutput); + if (!devices.isEmpty()) + dev = QLatin1String(devices.first().constData()); + } #else + if (dev.compare(QLatin1String("default")) == 0) { 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; @@ -225,156 +224,81 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const 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; } +#endif - bool testChannel = false; - bool testCodec = false; - bool testSampleRate = false; - bool testType = false; - bool testSize = false; + snd_pcm_stream_t stream = mode == QAudio::AudioOutput + ? SND_PCM_STREAM_PLAYBACK : SND_PCM_STREAM_CAPTURE; - int dir = 0; + if (snd_pcm_open(&pcmHandle, dev.toLocal8Bit().constData(), stream, 0) < 0) + return false; - snd_pcm_nonblock( handle, 0 ); - snd_pcm_hw_params_alloca( ¶ms ); - snd_pcm_hw_params_any( handle, params ); + snd_pcm_nonblock(pcmHandle, 0); + snd_pcm_hw_params_alloca(¶ms); + snd_pcm_hw_params_any(pcmHandle, params); // set the values! - snd_pcm_hw_params_set_channels(handle,params,format.channelCount()); - snd_pcm_hw_params_set_rate(handle,params,format.sampleRate(),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); - } else if (format.sampleType() == QAudioFormat::Float) { - if (format.byteOrder() == QAudioFormat::LittleEndian) - err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_FLOAT_LE); - else if (format.byteOrder() == QAudioFormat::BigEndian) - err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_FLOAT_BE); - } + snd_pcm_hw_params_set_channels(pcmHandle, params, format.channelCount()); + snd_pcm_hw_params_set_rate(pcmHandle, params, format.sampleRate(), 0); + + snd_pcm_format_t pcmFormat = SND_PCM_FORMAT_UNKNOWN; + switch (format.sampleSize()) { + case 8: + if (format.sampleType() == QAudioFormat::SignedInt) + pcmFormat = SND_PCM_FORMAT_S8; + else if (format.sampleType() == QAudioFormat::UnSignedInt) + pcmFormat = SND_PCM_FORMAT_U8; + break; + case 16: + if (format.sampleType() == QAudioFormat::SignedInt) { + pcmFormat = format.byteOrder() == QAudioFormat::LittleEndian + ? SND_PCM_FORMAT_S16_LE : SND_PCM_FORMAT_S16_BE; + } else if (format.sampleType() == QAudioFormat::UnSignedInt) { + pcmFormat = format.byteOrder() == QAudioFormat::LittleEndian + ? SND_PCM_FORMAT_U16_LE : SND_PCM_FORMAT_U16_BE; + } + break; + case 32: + if (format.sampleType() == QAudioFormat::SignedInt) { + pcmFormat = format.byteOrder() == QAudioFormat::LittleEndian + ? SND_PCM_FORMAT_S32_LE : SND_PCM_FORMAT_S32_BE; + } else if (format.sampleType() == QAudioFormat::UnSignedInt) { + pcmFormat = format.byteOrder() == QAudioFormat::LittleEndian + ? SND_PCM_FORMAT_U32_LE : SND_PCM_FORMAT_U32_BE; + } else if (format.sampleType() == QAudioFormat::Float) { + pcmFormat = format.byteOrder() == QAudioFormat::LittleEndian + ? SND_PCM_FORMAT_FLOAT_LE : SND_PCM_FORMAT_FLOAT_BE; + } } + if (pcmFormat != SND_PCM_FORMAT_UNKNOWN) + err = snd_pcm_hw_params_set_format(pcmHandle, params, pcmFormat); + // For now, just accept only audio/pcm codec - if(!format.codec().startsWith(QLatin1String("audio/pcm"))) { - err=-1; - } else - testCodec = true; - - if (err>=0 && format.channelCount() != -1) { - err = snd_pcm_hw_params_test_channels(handle,params,format.channelCount()); - if(err>=0) - err = snd_pcm_hw_params_set_channels(handle,params,format.channelCount()); - if(err>=0) - testChannel = true; - } + if (!format.codec().startsWith(QLatin1String("audio/pcm"))) + err = -1; - if (err>=0 && format.sampleRate() != -1) { - err = snd_pcm_hw_params_test_rate(handle,params,format.sampleRate(),0); - if(err>=0) - err = snd_pcm_hw_params_set_rate(handle,params,format.sampleRate(),dir); - if(err>=0) - testSampleRate = true; + if (err >= 0 && format.channelCount() != -1) { + err = snd_pcm_hw_params_test_channels(pcmHandle, params, format.channelCount()); + if (err >= 0) + err = snd_pcm_hw_params_set_channels(pcmHandle, params, format.channelCount()); } - 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); - } else if (format.sampleType() == QAudioFormat::Float) { - if (format.byteOrder() == QAudioFormat::LittleEndian) - err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_FLOAT_LE); - else if (format.byteOrder() == QAudioFormat::BigEndian) - err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_FLOAT_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 (err >= 0 && format.sampleRate() != -1) { + err = snd_pcm_hw_params_test_rate(pcmHandle, params, format.sampleRate(), 0); + if (err >= 0) + err = snd_pcm_hw_params_set_rate(pcmHandle, params, format.sampleRate(), 0); } - if(handle) - snd_pcm_close(handle); - return false; + if (err >= 0 && pcmFormat != SND_PCM_FORMAT_UNKNOWN) + err = snd_pcm_hw_params_set_format(pcmHandle, params, pcmFormat); + + if (err >= 0) + err = snd_pcm_hw_params(pcmHandle, params); + + snd_pcm_close(pcmHandle); + + return (err == 0); } void QAudioDeviceInfoInternal::updateLists() @@ -451,12 +375,10 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) devices.append(deviceName.toLocal8Bit().constData()); } - free(name); - if (descr != NULL) - free(descr); - if (io != NULL) - free(io); + free(descr); + free(io); } + free(name); ++n; } snd_device_name_free_hint(hints); diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index f3af7e0d2..e9503d4c3 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -469,20 +469,22 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() { - QList<QByteArray> list = availableDevices(QAudio::AudioOutput); - if (list.size() > 0) - return list.at(0); - else - return QByteArray(); + QByteArray defaultDevice; + QDataStream ds(&defaultDevice, QIODevice::WriteOnly); + ds << quint32(WAVE_MAPPER) // device ID for default device + << QStringLiteral("Default Output Device"); + + return defaultDevice; } QByteArray QAudioDeviceInfoInternal::defaultInputDevice() { - QList<QByteArray> list = availableDevices(QAudio::AudioInput); - if (list.size() > 0) - return list.at(0); - else - return QByteArray(); + QByteArray defaultDevice; + QDataStream ds(&defaultDevice, QIODevice::WriteOnly); + ds << quint32(WAVE_MAPPER) // device ID for default device + << QStringLiteral("Default Input Device"); + + return defaultDevice; } QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp index 1384dfdc5..3a779f322 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp @@ -125,7 +125,7 @@ void QAudioOutputPrivate::async_callback(snd_async_handler_t *ahandler) audioOut = static_cast<QAudioOutputPrivate*> (snd_async_handler_get_callback_private(ahandler)); - if((audioOut->deviceState==QAudio::ActiveState)||(audioOut->resuming)) + if (audioOut && (audioOut->deviceState == QAudio::ActiveState || audioOut->resuming)) audioOut->feedback(); } diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp index b3318ec94..328a3b0b3 100644 --- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp +++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp @@ -147,9 +147,20 @@ public: Q_SIGNALS: void contextReady(); + void contextFailed(); void volumeChanged(); -private: +private Q_SLOTS: + void onContextFailed() + { + release(); + + // Try to reconnect later + QTimer::singleShot(30000, this, SLOT(prepare())); + + emit contextFailed(); + } + void prepare() { m_vol = PA_VOLUME_NORM; @@ -196,12 +207,23 @@ private: m_prepared = true; } +private: void release() { - if (!m_prepared) return; - pa_context_unref(m_context); - pa_threaded_mainloop_stop(m_mainLoop); - pa_threaded_mainloop_free(m_mainLoop); + if (!m_prepared) + return; + + if (m_context) { + pa_context_unref(m_context); + m_context = 0; + } + + if (m_mainLoop) { + pa_threaded_mainloop_stop(m_mainLoop); + pa_threaded_mainloop_free(m_mainLoop); + m_mainLoop = 0; + } + m_prepared = false; } @@ -221,6 +243,9 @@ private: #endif QMetaObject::invokeMethod(self, "contextReady", Qt::QueuedConnection); break; + case PA_CONTEXT_FAILED: + QMetaObject::invokeMethod(self, "onContextFailed", Qt::QueuedConnection); + break; default: break; } @@ -511,7 +536,8 @@ void QSoundEffectPrivate::updateVolume() PulseDaemonLocker locker; pa_cvolume volume; volume.channels = m_pulseSpec.channels; - pa_operation_unref(pa_context_set_sink_input_volume(pulseDaemon()->context(), m_sinkInputId, pulseDaemon()->calcVolume(&volume, m_volume), setvolume_callback, m_ref->getRef())); + if (pulseDaemon()->context()) + pa_operation_unref(pa_context_set_sink_input_volume(pulseDaemon()->context(), m_sinkInputId, pulseDaemon()->calcVolume(&volume, m_volume), setvolume_callback, m_ref->getRef())); Q_ASSERT(pa_cvolume_valid(&volume)); #ifdef QT_PA_DEBUG qDebug() << this << "updateVolume =" << pa_cvolume_max(&volume); @@ -535,7 +561,8 @@ void QSoundEffectPrivate::updateMuted() if (m_sinkInputId < 0) return; PulseDaemonLocker locker; - pa_operation_unref(pa_context_set_sink_input_mute(pulseDaemon()->context(), m_sinkInputId, m_muted, setmuted_callback, m_ref->getRef())); + if (pulseDaemon()->context()) + pa_operation_unref(pa_context_set_sink_input_mute(pulseDaemon()->context(), m_sinkInputId, m_muted, setmuted_callback, m_ref->getRef())); #ifdef QT_PA_DEBUG qDebug() << this << "updateMuted = " << m_muted; #endif @@ -705,7 +732,7 @@ void QSoundEffectPrivate::sampleReady() } #endif } else { - if (pa_context_get_state(pulseDaemon()->context()) != PA_CONTEXT_READY) { + if (!pulseDaemon()->context() || pa_context_get_state(pulseDaemon()->context()) != PA_CONTEXT_READY) { connect(pulseDaemon(), SIGNAL(contextReady()), SLOT(contextReady())); return; } @@ -741,6 +768,7 @@ void QSoundEffectPrivate::unloadPulseStream() pa_stream_disconnect(m_pulseStream); pa_stream_unref(m_pulseStream); disconnect(pulseDaemon(), SIGNAL(volumeChanged()), this, SLOT(updateVolume())); + disconnect(pulseDaemon(), SIGNAL(contextFailed()), this, SLOT(contextFailed())); m_pulseStream = 0; m_reloadCategory = false; // category will be reloaded when we connect anyway } @@ -895,6 +923,9 @@ void QSoundEffectPrivate::createPulseStream() qDebug() << this << "createPulseStream"; #endif + if (!pulseDaemon()->context()) + return; + pa_proplist *propList = pa_proplist_new(); if (m_category.isNull()) { // Meant to be one of the strings "video", "music", "game", "event", "phone", "animation", "production", "a11y", "test" @@ -906,6 +937,7 @@ void QSoundEffectPrivate::createPulseStream() pa_proplist_free(propList); connect(pulseDaemon(), SIGNAL(volumeChanged()), this, SLOT(updateVolume())); + connect(pulseDaemon(), SIGNAL(contextFailed()), this, SLOT(contextFailed())); if (stream == 0) { qWarning("QSoundEffect(pulseaudio): Failed to create stream"); @@ -947,6 +979,12 @@ void QSoundEffectPrivate::contextReady() createPulseStream(); } +void QSoundEffectPrivate::contextFailed() +{ + unloadPulseStream(); + connect(pulseDaemon(), SIGNAL(contextReady()), this, SLOT(contextReady())); +} + void QSoundEffectPrivate::stream_write_callback(pa_stream *s, size_t length, void *userdata) { Q_UNUSED(length); diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.h b/src/multimedia/audio/qsoundeffect_pulse_p.h index e43bd2fdf..4dc58f0b6 100644 --- a/src/multimedia/audio/qsoundeffect_pulse_p.h +++ b/src/multimedia/audio/qsoundeffect_pulse_p.h @@ -111,6 +111,7 @@ private Q_SLOTS: void sampleReady(); void uploadSample(); void contextReady(); + void contextFailed(); void underRun(); void prepare(); void streamReady(); diff --git a/src/multimedia/audio/qwavedecoder_p.cpp b/src/multimedia/audio/qwavedecoder_p.cpp index b75bfaf8f..497a146df 100644 --- a/src/multimedia/audio/qwavedecoder_p.cpp +++ b/src/multimedia/audio/qwavedecoder_p.cpp @@ -244,16 +244,18 @@ bool QWaveDecoder::enoughDataAvailable() bool QWaveDecoder::findChunk(const char *chunkId) { chunk descriptor; - if (!peekChunk(&descriptor)) - return false; - if (qstrncmp(descriptor.id, chunkId, 4) == 0) - return true; + do { + 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); - // 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); @@ -263,12 +265,7 @@ bool QWaveDecoder::findChunk(const char *chunkId) if (junkToSkip > 0) return false; - if (!peekChunk(&descriptor)) - return false; - - if (qstrncmp(descriptor.id, chunkId, 4) == 0) - return true; - } + } while (source->bytesAvailable() > 0); return false; } diff --git a/src/multimedia/doc/qtmultimedia.qdocconf b/src/multimedia/doc/qtmultimedia.qdocconf index b78c91989..5f82a330b 100644 --- a/src/multimedia/doc/qtmultimedia.qdocconf +++ b/src/multimedia/doc/qtmultimedia.qdocconf @@ -44,3 +44,7 @@ sourcedirs += ../.. excludedirs += ../../multimediawidgets depends += qtcore qtdoc qtquick qtqml qtmultimediawidgets + +navigation.landingpage = "Qt Multimedia" +navigation.cppclassespage = "Qt Multimedia C++ Classes" +navigation.qmltypespage = "Qt Multimedia QML Types" diff --git a/src/multimedia/doc/src/examples/video-qml-paint-rate.qdocinc b/src/multimedia/doc/src/examples/video-qml-paint-rate.qdocinc index 860f14270..84098e241 100644 --- a/src/multimedia/doc/src/examples/video-qml-paint-rate.qdocinc +++ b/src/multimedia/doc/src/examples/video-qml-paint-rate.qdocinc @@ -2,7 +2,7 @@ The QML painting rate is calculated by the FrequencyMonitor class, which turns a stream of events (received via the notify() slot), into an instantaneous and an averaged frequency: -\quotefromfile multimedia/video/snippets/frequencymonitor/frequencymonitor.h +\quotefromfile video/snippets/frequencymonitor/frequencymonitor.h \skipto class FrequencyMonitor : public QObject \printuntil Q_OBJECT \skipto Q_PROPERTY(qreal instantaneousFrequency @@ -19,13 +19,13 @@ instantaneous and an averaged frequency: The FrequencyMonitor class is exposed to QML like this -\quotefromfile multimedia/video/snippets/frequencymonitor/frequencymonitordeclarative.cpp +\quotefromfile video/snippets/frequencymonitor/frequencymonitordeclarative.cpp \skipto FrequencyMonitor::qmlRegisterType \printuntil } and its data is displayed by defining a QML item called FrequencyItem, like this: -\quotefromfile multimedia/video/snippets/frequencymonitor/qml/frequencymonitor/FrequencyItem.qml +\quotefromfile video/snippets/frequencymonitor/qml/frequencymonitor/FrequencyItem.qml \skipto import FrequencyMonitor \printuntil id: root \dots diff --git a/src/multimedia/doc/src/multimedia.qdoc b/src/multimedia/doc/src/multimedia.qdoc index d93468273..b18236a93 100644 --- a/src/multimedia/doc/src/multimedia.qdoc +++ b/src/multimedia/doc/src/multimedia.qdoc @@ -30,8 +30,6 @@ \title Multimedia \brief A set of APIs for working with audio, video, radio and camera devices. -\ingroup technology-apis - Multimedia support in Qt is provided by the \l{Qt Multimedia} module. The Qt Multimedia module provides a rich feature set that enables you to easily take advantage of a platform's multimedia capabilities such as media playback and diff --git a/src/multimedia/doc/src/platform-notes-windows.qdoc b/src/multimedia/doc/src/platform-notes-windows.qdoc new file mode 100644 index 000000000..d1ac8b6de --- /dev/null +++ b/src/multimedia/doc/src/platform-notes-windows.qdoc @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qtmultimedia-windows.html +\title Qt Multimedia on Windows +\brief Platform notes for Windows + +This page covers the availability of Qt Multimedia features on Windows. + +\section1 Implementation + +Qt Multimedia features for Windows are implemented in two plugins; one +using the Microsoft DirectShow API, and another using WMF (Windows Media +Foundation) framework. DirectShow API was introduced in Windows 98, and +gradually deprecated from Windows XP onwards. Media Foundation framework +was introduced in Windows Vista as a replacement for DirectShow and other +multimedia APIs. Consequently, WMF plugin in Qt is supported only for +Windows Vista and later versions of the operating system. + +\section1 Limitations + +The WMF plugin in Qt does not currently provide a camera backend. Instead, +limited support for camera features is provided by the DirectShow +plugin. Basic features such as displaying a viewfinder and capturing a +still image are supported, however, majority of camera controls are not +implemented. + +Video recording is currently not supported. Additionally, the DirectShow +plugin does not support any low-level video functionality such as +monitoring video frames being played or recorded using \l QVideoProbe or +related classes. +*/ diff --git a/src/multimedia/doc/src/qtmultimedia-cpp.qdoc b/src/multimedia/doc/src/qtmultimedia-cpp.qdoc index a821088d8..b67163efe 100644 --- a/src/multimedia/doc/src/qtmultimedia-cpp.qdoc +++ b/src/multimedia/doc/src/qtmultimedia-cpp.qdoc @@ -29,6 +29,7 @@ \module QtMultimedia \title Qt Multimedia C++ Classes \ingroup modules + \qtvariable multimedia \brief The \l {Qt Multimedia} module provides audio, video, radio and camera functionality. diff --git a/src/multimedia/doc/src/qtmultimedia-index.qdoc b/src/multimedia/doc/src/qtmultimedia-index.qdoc index 417c0c494..4cd59fd52 100644 --- a/src/multimedia/doc/src/qtmultimedia-index.qdoc +++ b/src/multimedia/doc/src/qtmultimedia-index.qdoc @@ -131,6 +131,7 @@ \section2 Platform Notes \list \li \l{BlackBerry} + \li \l{Qt Multimedia on Windows}{Windows} \endlist \section2 Reference diff --git a/src/multimedia/doc/src/qtmultimedia5.qdoc b/src/multimedia/doc/src/qtmultimedia5.qdoc index bbf9907f6..c1267f097 100644 --- a/src/multimedia/doc/src/qtmultimedia5.qdoc +++ b/src/multimedia/doc/src/qtmultimedia5.qdoc @@ -31,9 +31,7 @@ \ingroup qmlmodules \brief Provides QML types for multimedia support. -\section1 Overview - -The QML types for Qt Multimedia support the basic use cases such as: +The QML types for \l{Qt Multimedia} support the basic use cases such as: \list \li audio and video playback, \li access camera and radio functionality, @@ -41,6 +39,11 @@ The QML types for Qt Multimedia support the basic use cases such as: \li and access camera settings. \endlist +The QML types can be imported into your application using the following import +statement in your .qml file: +\code +import QtMultimedia 5.0 +\endcode + \section1 QML types */ - diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro index 83ab82c75..440bd6849 100644 --- a/src/multimedia/multimedia.pro +++ b/src/multimedia/multimedia.pro @@ -58,7 +58,11 @@ ANDROID_JAR_DEPENDENCIES = \ jar/QtMultimedia.jar:org.qtproject.qt5.android.multimedia.QtMultimediaUtils \ jar/QtMultimedia.jar:org.qtproject.qt5.android.multimedia.QtActivityStateListener ANDROID_LIB_DEPENDENCIES = \ - plugins/mediaservice/libqtmedia_android.so + plugins/mediaservice/libqtmedia_android.so \ + lib/libQt5MultimediaQuick_p.so:Qt5Quick +ANDROID_BUNDLED_FILES += \ + lib/libQt5MultimediaQuick_p.so + MODULE_PLUGIN_TYPES = \ mediaservice diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp index c3eb09ebf..eaac82820 100644 --- a/src/multimedia/playback/qmediaplayer.cpp +++ b/src/multimedia/playback/qmediaplayer.cpp @@ -1220,7 +1220,7 @@ QMultimedia::AvailabilityStatus QMediaPlayer::availability() const \property QMediaPlayer::volume \brief the current playback volume. - The playback volume is a linear in effect and the value can range from 0 - + The playback volume is linear in effect and the value can range from 0 - 100, values outside this range will be clamped. */ diff --git a/src/multimedia/qmediapluginloader.cpp b/src/multimedia/qmediapluginloader.cpp index e23e32a3f..1b4a13f83 100644 --- a/src/multimedia/qmediapluginloader.cpp +++ b/src/multimedia/qmediapluginloader.cpp @@ -127,7 +127,12 @@ void QMediaPluginLoader::loadMetadata() qDebug() << "QMediaPluginLoader: Inserted index " << i << " into metadata: " << jsonobj; #endif - QJsonArray arr = jsonobj.value(QStringLiteral("Keys")).toArray(); + QJsonArray arr = jsonobj.value(QStringLiteral("Services")).toArray(); + // Preserve compatibility with older plugins (made before 5.1) in which + // services were declared in the 'Keys' property + if (arr.isEmpty()) + arr = jsonobj.value(QStringLiteral("Keys")).toArray(); + foreach (QJsonValue value, arr) { QString key = value.toString(); diff --git a/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf b/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf index e44a73d77..5648041ad 100644 --- a/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf +++ b/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf @@ -40,3 +40,6 @@ sourcedirs += ../ excludedirs += depends += qtcore qtdoc qtquick qtqml qtmultimedia qtwidgets qtgui + +navigation.landingpage = "Qt Multimedia Widgets" +navigation.cppclassespage = "Qt Multimedia Widgets C++ Classes" diff --git a/src/multimediawidgets/doc/src/qtmultimediawidgets-index.qdoc b/src/multimediawidgets/doc/src/qtmultimediawidgets-index.qdoc index 07fa63205..e722f4cb3 100644 --- a/src/multimediawidgets/doc/src/qtmultimediawidgets-index.qdoc +++ b/src/multimediawidgets/doc/src/qtmultimediawidgets-index.qdoc @@ -57,7 +57,6 @@ QT += multimediawidgets \section2 Examples \list -\li \l{QML Camera Example} \li \l{Camera Example} \li \l{Media Player Example} \li \l{Video Graphics Item Example} diff --git a/src/multimediawidgets/doc/src/qtmultimediawidgets.qdoc b/src/multimediawidgets/doc/src/qtmultimediawidgets.qdoc index cc64ed173..1df92d75f 100644 --- a/src/multimediawidgets/doc/src/qtmultimediawidgets.qdoc +++ b/src/multimediawidgets/doc/src/qtmultimediawidgets.qdoc @@ -29,6 +29,7 @@ \module QtMultimediaWidgets \title Qt Multimedia Widgets C++ Classes \brief Classes provided by the Qt Multimedia Widgets module. +\qtvariable multimediawidgets These classes are part of the \l{Qt Multimedia Widgets}Â module. diff --git a/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java index d09883e15..d1abf658e 100644 --- a/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java +++ b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java @@ -85,7 +85,7 @@ public class QtAndroidMediaPlayer extends MediaPlayer try { mApplicationContext = activity.getApplicationContext(); } catch(final Exception e) { - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } } @@ -104,7 +104,7 @@ public class QtAndroidMediaPlayer extends MediaPlayer currentPosition = getCurrentPosition(); } } catch (final InterruptedException e) { - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); return; } } @@ -265,7 +265,7 @@ public class QtAndroidMediaPlayer extends MediaPlayer progressThread.start(); } catch (final IllegalStateException e) { reset(); - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } } @@ -279,7 +279,7 @@ public class QtAndroidMediaPlayer extends MediaPlayer super.pause(); } catch (final IllegalStateException e) { reset(); - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } } @@ -292,7 +292,7 @@ public class QtAndroidMediaPlayer extends MediaPlayer try { super.stop(); } catch (final IllegalStateException e) { - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } finally { reset(); } @@ -308,7 +308,7 @@ public class QtAndroidMediaPlayer extends MediaPlayer super.seekTo(msec); onMediaPlayerInfoNative(MEDIA_PLAYER_PROGRESS, msec, mID); } catch (final IllegalStateException e) { - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } } @@ -323,7 +323,7 @@ public class QtAndroidMediaPlayer extends MediaPlayer try { playing = super.isPlaying(); } catch (final IllegalStateException e) { - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } return playing; @@ -358,13 +358,13 @@ public class QtAndroidMediaPlayer extends MediaPlayer /* MEDIA_ERROR_UNSUPPORTED= */ -1010, mID); } catch (final IllegalArgumentException e) { - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } catch (final SecurityException e) { - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } catch (final IllegalStateException e) { - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } catch (final NullPointerException e) { - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } } @@ -379,7 +379,7 @@ public class QtAndroidMediaPlayer extends MediaPlayer try { currentPosition = super.getCurrentPosition(); } catch (final IllegalStateException e) { - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } return currentPosition; @@ -396,7 +396,7 @@ public class QtAndroidMediaPlayer extends MediaPlayer try { duration = super.getDuration(); } catch (final IllegalStateException e) { - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } return duration; @@ -428,7 +428,7 @@ public class QtAndroidMediaPlayer extends MediaPlayer if (!mMuted) mVolume = volume; } catch (final IllegalStateException e) { - Log.d(TAG, e.getMessage()); + Log.d(TAG, "" + e.getMessage()); } } diff --git a/src/plugins/android/src/android_mediaservice.json b/src/plugins/android/src/android_mediaservice.json index a12be52bc..df4bccb2b 100644 --- a/src/plugins/android/src/android_mediaservice.json +++ b/src/plugins/android/src/android_mediaservice.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.camera", "org.qt-project.qt.mediaplayer", "org.qt-project.qt.audiosource"] + "Keys": ["androidmultimedia"], + "Services": ["org.qt-project.qt.camera", "org.qt-project.qt.mediaplayer", "org.qt-project.qt.audiosource"] } diff --git a/src/plugins/android/src/common/qandroidvideooutput.h b/src/plugins/android/src/common/qandroidvideooutput.h index 8110b67b0..fd10407bf 100644 --- a/src/plugins/android/src/common/qandroidvideooutput.h +++ b/src/plugins/android/src/common/qandroidvideooutput.h @@ -57,10 +57,10 @@ public: virtual ~QAndroidVideoOutput() { } virtual jobject surfaceHolder() = 0; + virtual jobject surfaceTexture() = 0; virtual bool isTextureReady() = 0; virtual void setTextureReadyCallback(TextureReadyCallback cb, void *context = 0) = 0; - virtual jobject surfaceTexture() = 0; virtual void setVideoSize(const QSize &size) = 0; virtual void stop() = 0; diff --git a/src/plugins/android/src/common/qandroidvideorendercontrol.h b/src/plugins/android/src/common/qandroidvideorendercontrol.h index d8078f075..9e9a1fe82 100644 --- a/src/plugins/android/src/common/qandroidvideorendercontrol.h +++ b/src/plugins/android/src/common/qandroidvideorendercontrol.h @@ -65,9 +65,9 @@ public: void setSurface(QAbstractVideoSurface *surface) Q_DECL_OVERRIDE; jobject surfaceHolder() Q_DECL_OVERRIDE; + jobject surfaceTexture() Q_DECL_OVERRIDE; bool isTextureReady() Q_DECL_OVERRIDE; void setTextureReadyCallback(TextureReadyCallback cb, void *context = 0) Q_DECL_OVERRIDE; - jobject surfaceTexture() Q_DECL_OVERRIDE; void setVideoSize(const QSize &size) Q_DECL_OVERRIDE; void stop() Q_DECL_OVERRIDE; QImage toImage() Q_DECL_OVERRIDE; diff --git a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp index aa9650ac1..a70f4e130 100644 --- a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp +++ b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp @@ -64,7 +64,8 @@ QAndroidMediaPlayerControl::QAndroidMediaPlayerControl(QObject *parent) mVideoAvailable(false), mBuffering(false), mMediaPlayerReady(false), - mPendingPosition(-1) + mPendingPosition(-1), + mPendingSetMedia(false) { connect(mMediaPlayer, SIGNAL(bufferingUpdate(qint32)), this, SLOT(onBufferChanged(qint32))); @@ -80,6 +81,7 @@ QAndroidMediaPlayerControl::QAndroidMediaPlayerControl(QObject *parent) QAndroidMediaPlayerControl::~QAndroidMediaPlayerControl() { + mMediaPlayer->release(); delete mMediaPlayer; } @@ -213,6 +215,13 @@ void QAndroidMediaPlayerControl::setMedia(const QMediaContent &mediaContent, mMediaContent = mediaContent; mMediaStream = stream; + if (mVideoOutput && !mMediaPlayer->display()) { + // if a video output is set but the video texture is not ready, delay loading the media + // since it can cause problems on some hardware + mPendingSetMedia = true; + return; + } + const QString uri = mediaContent.canonicalUrl().toString(); if (!uri.isEmpty()) @@ -236,6 +245,13 @@ void QAndroidMediaPlayerControl::setVideoOutput(QAndroidVideoOutput *videoOutput mVideoOutput->stop(); mVideoOutput = videoOutput; + + if (mVideoOutput && !mMediaPlayer->display()) { + if (mVideoOutput->isTextureReady()) + mMediaPlayer->setDisplay(mVideoOutput->surfaceHolder()); + else + mVideoOutput->setTextureReadyCallback(textureReadyCallback, this); + } } void QAndroidMediaPlayerControl::play() @@ -244,7 +260,8 @@ void QAndroidMediaPlayerControl::play() mPendingState = QMediaPlayer::PlayingState; if (mCurrentState == QMediaPlayer::StoppedState && !mMediaContent.isNull() - && mCurrentMediaStatus != QMediaPlayer::LoadingMedia) { + && mCurrentMediaStatus != QMediaPlayer::LoadingMedia + && !mPendingSetMedia) { setMedia(mMediaContent, 0); } return; @@ -405,22 +422,16 @@ void QAndroidMediaPlayerControl::onVideoSizeChanged(qint32 width, qint32 height) setVideoAvailable(true); mVideoSize = newSize; - if (mVideoOutput) { - if (!mMediaPlayer->display()) { - if (mVideoOutput->isTextureReady()) - mMediaPlayer->setDisplay(mVideoOutput->surfaceHolder()); - else - mVideoOutput->setTextureReadyCallback(textureReadyCallback, this); - } - + if (mVideoOutput) mVideoOutput->setVideoSize(mVideoSize); - } } void QAndroidMediaPlayerControl::onSurfaceTextureReady() { - if (!mMediaPlayer->display() && mVideoOutput) + if (!mMediaPlayer->display() && mVideoOutput) { mMediaPlayer->setDisplay(mVideoOutput->surfaceHolder()); + flushPendingStates(); + } } void QAndroidMediaPlayerControl::setState(QMediaPlayer::State state) @@ -500,6 +511,12 @@ void QAndroidMediaPlayerControl::resetBufferingProgress() void QAndroidMediaPlayerControl::flushPendingStates() { + if (mPendingSetMedia) { + setMedia(mMediaContent, 0); + mPendingSetMedia = false; + return; + } + switch (mPendingState) { case QMediaPlayer::PlayingState: if (mPendingPosition > -1) diff --git a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.h b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.h index 03c0b306c..93eced853 100644 --- a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.h +++ b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.h @@ -113,6 +113,7 @@ private: bool mMediaPlayerReady; QMediaPlayer::State mPendingState; qint64 mPendingPosition; + bool mPendingSetMedia; void setState(QMediaPlayer::State state); void setMediaStatus(QMediaPlayer::MediaStatus status); diff --git a/src/plugins/android/src/wrappers/jmediaplayer.cpp b/src/plugins/android/src/wrappers/jmediaplayer.cpp index 48e743b26..f6e03ee22 100644 --- a/src/plugins/android/src/wrappers/jmediaplayer.cpp +++ b/src/plugins/android/src/wrappers/jmediaplayer.cpp @@ -82,6 +82,11 @@ JMediaPlayer::~JMediaPlayer() mplayers.remove(mId); } +void JMediaPlayer::release() +{ + callMethod<void>("release"); +} + void JMediaPlayer::onError(qint32 what, qint32 extra) { Q_EMIT error(what, extra); diff --git a/src/plugins/android/src/wrappers/jmediaplayer.h b/src/plugins/android/src/wrappers/jmediaplayer.h index f5cb11773..710246b9a 100644 --- a/src/plugins/android/src/wrappers/jmediaplayer.h +++ b/src/plugins/android/src/wrappers/jmediaplayer.h @@ -89,6 +89,8 @@ public: MEDIA_PLAYER_FINISHED = 6 }; + void release(); + int getCurrentPosition(); int getDuration(); bool isPlaying(); diff --git a/src/plugins/audiocapture/audiocapture.json b/src/plugins/audiocapture/audiocapture.json index d963a2e3e..4c7673da2 100644 --- a/src/plugins/audiocapture/audiocapture.json +++ b/src/plugins/audiocapture/audiocapture.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.audiosource"] + "Keys": ["audiocapture"], + "Services": ["org.qt-project.qt.audiosource"] } diff --git a/src/plugins/avfoundation/camera/avfcamera.json b/src/plugins/avfoundation/camera/avfcamera.json index d3a58c758..e4310b62c 100644 --- a/src/plugins/avfoundation/camera/avfcamera.json +++ b/src/plugins/avfoundation/camera/avfcamera.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.camera"] + "Keys": ["avfoundationcamera"], + "Services": ["org.qt-project.qt.camera"] } diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayer.json b/src/plugins/avfoundation/mediaplayer/avfmediaplayer.json index c4a27ea01..5626edec0 100644 --- a/src/plugins/avfoundation/mediaplayer/avfmediaplayer.json +++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayer.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.mediaplayer"] + "Keys": ["avfoundationmediaplayer"], + "Services": ["org.qt-project.qt.mediaplayer"] } diff --git a/src/plugins/blackberry/blackberry_mediaservice.json b/src/plugins/blackberry/blackberry_mediaservice.json index 54c1c9f04..2a59cc770 100644 --- a/src/plugins/blackberry/blackberry_mediaservice.json +++ b/src/plugins/blackberry/blackberry_mediaservice.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.camera", "org.qt-project.qt.mediaplayer"] + "Keys": ["blackberrymultimedia"], + "Services": ["org.qt-project.qt.camera", "org.qt-project.qt.mediaplayer"] } diff --git a/src/plugins/blackberry/common/windowgrabber.cpp b/src/plugins/blackberry/common/windowgrabber.cpp index db070d8e5..144b5a693 100644 --- a/src/plugins/blackberry/common/windowgrabber.cpp +++ b/src/plugins/blackberry/common/windowgrabber.cpp @@ -55,6 +55,8 @@ QT_BEGIN_NAMESPACE WindowGrabber::WindowGrabber(QObject *parent) : QObject(parent), m_screenBuffer(0), + m_screenBufferWidth(-1), + m_screenBufferHeight(-1), m_active(false), m_screenContextInitialized(false), m_screenPixmapInitialized(false), @@ -145,7 +147,8 @@ void WindowGrabber::start() } int size[2] = { 0, 0 }; - result = screen_get_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, size); + + result = screen_get_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, size); if (result != 0) { cleanup(); qWarning() << "WindowGrabber: cannot get window size:" << strerror(errno); @@ -155,7 +158,18 @@ void WindowGrabber::start() m_screenBufferWidth = size[0]; m_screenBufferHeight = size[1]; - result = screen_set_pixmap_property_iv(m_screenPixmap, SCREEN_PROPERTY_BUFFER_SIZE, size); + updateFrameSize(); + + m_timer.start(); + + m_active = true; +} + +void WindowGrabber::updateFrameSize() +{ + int size[2] = { m_screenBufferWidth, m_screenBufferHeight }; + + int result = screen_set_pixmap_property_iv(m_screenPixmap, SCREEN_PROPERTY_BUFFER_SIZE, size); if (result != 0) { cleanup(); qWarning() << "WindowGrabber: cannot set pixmap size:" << strerror(errno); @@ -191,10 +205,6 @@ void WindowGrabber::start() qWarning() << "WindowGrabber: cannot get pixmap buffer stride:" << strerror(errno); return; } - - m_timer.start(); - - m_active = true; } void WindowGrabber::stop() @@ -284,7 +294,31 @@ QByteArray WindowGrabber::windowGroupId() const void WindowGrabber::grab() { - const int result = screen_read_window(m_window, m_screenPixmapBuffer, 0, 0, 0); + int size[2] = { 0, 0 }; + + int result = screen_get_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, size); + if (result != 0) { + cleanup(); + qWarning() << "WindowGrabber: cannot get window size:" << strerror(errno); + return; + } + + if (m_screenBufferWidth != size[0] || m_screenBufferHeight != size[1]) { + // The source viewport size changed, so we have to adapt our buffers + + if (m_screenPixmapBufferInitialized) { + screen_destroy_pixmap_buffer(m_screenPixmap); + m_screenPixmapBufferInitialized = false; + } + + m_screenBufferWidth = size[0]; + m_screenBufferHeight = size[1]; + + updateFrameSize(); + } + + const int rect[] = { 0, 0, m_screenBufferWidth, m_screenBufferHeight }; + result = screen_read_window(m_window, m_screenPixmapBuffer, 1, rect, 0); if (result != 0) return; diff --git a/src/plugins/blackberry/common/windowgrabber.h b/src/plugins/blackberry/common/windowgrabber.h index 547742da1..f8e3686a2 100644 --- a/src/plugins/blackberry/common/windowgrabber.h +++ b/src/plugins/blackberry/common/windowgrabber.h @@ -79,6 +79,7 @@ private slots: private: void cleanup(); + void updateFrameSize(); QTimer m_timer; diff --git a/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.cpp b/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.cpp index 096ae55ec..d9226d91f 100644 --- a/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.cpp +++ b/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.cpp @@ -142,8 +142,14 @@ void BbPlayerVideoRendererControl::resume() void BbPlayerVideoRendererControl::frameGrabbed(const QImage &frame) { if (m_surface) { - if (!m_surface->isActive()) + if (!m_surface->isActive()) { m_surface->start(QVideoSurfaceFormat(frame.size(), QVideoFrame::Format_ARGB32)); + } else { + if (m_surface->surfaceFormat().frameSize() != frame.size()) { + m_surface->stop(); + m_surface->start(QVideoSurfaceFormat(frame.size(), QVideoFrame::Format_ARGB32)); + } + } m_surface->present(frame.copy()); } diff --git a/src/plugins/directshow/camera/dscameraservice.cpp b/src/plugins/directshow/camera/dscameraservice.cpp index 2c6ea0e94..9d99c6dd6 100644 --- a/src/plugins/directshow/camera/dscameraservice.cpp +++ b/src/plugins/directshow/camera/dscameraservice.cpp @@ -62,6 +62,10 @@ QT_BEGIN_NAMESPACE DSCameraService::DSCameraService(QObject *parent): QMediaService(parent) +#if defined(HAVE_WIDGETS) + , m_viewFinderWidget(0) + #endif + , m_videoRenderer(0) { m_session = new DSCameraSession(this); @@ -69,14 +73,8 @@ DSCameraService::DSCameraService(QObject *parent): m_videoDevice = new DSVideoDeviceControl(m_session); - m_videoRenderer = new DSVideoRendererControl(m_session, this); - m_imageCapture = new DSImageCaptureControl(m_session); -#if defined(HAVE_WIDGETS) - m_viewFinderWidget = new DSVideoWidgetControl(m_session); -#endif - m_device = QByteArray("default"); } @@ -102,14 +100,23 @@ QMediaControl* DSCameraService::requestControl(const char *name) #if defined(HAVE_WIDGETS) if (qstrcmp(name, QVideoWidgetControl_iid) == 0) { - if (m_viewFinderWidget) { + if (!m_viewFinderWidget && !m_videoRenderer) { + m_viewFinderWidget = new DSVideoWidgetControl(m_session); return m_viewFinderWidget; } } #endif - if(qstrcmp(name,QVideoRendererControl_iid) == 0) - return m_videoRenderer; + if (qstrcmp(name,QVideoRendererControl_iid) == 0) { +#if defined(HAVE_WIDGETS) + if (!m_videoRenderer && !m_viewFinderWidget) { +#else + if (!m_videoRenderer) { +#endif + m_videoRenderer = new DSVideoRendererControl(m_session, this); + return m_videoRenderer; + } + } if (qstrcmp(name,QVideoDeviceSelectorControl_iid) == 0) return m_videoDevice; @@ -119,8 +126,19 @@ QMediaControl* DSCameraService::requestControl(const char *name) void DSCameraService::releaseControl(QMediaControl *control) { - Q_UNUSED(control) - // Implemented as a singleton, so we do nothing. + if (control == m_videoRenderer) { + delete m_videoRenderer; + m_videoRenderer = 0; + return; + } + +#if defined(HAVE_WIDGETS) + if (control == m_viewFinderWidget) { + delete m_viewFinderWidget; + m_viewFinderWidget = 0; + return; + } +#endif } QT_END_NAMESPACE diff --git a/src/plugins/directshow/camera/dscameraservice.h b/src/plugins/directshow/camera/dscameraservice.h index e39ea0adc..fb8b7886a 100644 --- a/src/plugins/directshow/camera/dscameraservice.h +++ b/src/plugins/directshow/camera/dscameraservice.h @@ -52,9 +52,7 @@ class DSCameraControl; class DSCameraSession; class DSVideoOutputControl; class DSVideoDeviceControl; -class DSVideoRendererControl; class DSImageCaptureControl; -class DSVideoWidgetControl; class DSCameraService : public QMediaService @@ -73,10 +71,10 @@ private: DSCameraSession *m_session; DSVideoOutputControl *m_videoOutput; #if defined(HAVE_WIDGETS) - DSVideoWidgetControl *m_viewFinderWidget; + QMediaControl *m_viewFinderWidget; #endif DSVideoDeviceControl *m_videoDevice; - DSVideoRendererControl *m_videoRenderer; + QMediaControl *m_videoRenderer; DSImageCaptureControl *m_imageCapture; QByteArray m_device; }; diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp index 353078f43..cc1594feb 100644 --- a/src/plugins/directshow/camera/dscamerasession.cpp +++ b/src/plugins/directshow/camera/dscamerasession.cpp @@ -595,7 +595,7 @@ void DSCameraSession::captureFrame() mutex.lock(); image = QImage(frames.at(0)->buffer,m_windowSize.width(),m_windowSize.height(), - QImage::Format_RGB32).rgbSwapped().mirrored(true); + QImage::Format_RGB32).mirrored(true); QVideoFrame frame(image); frame.setStartTime(frames.at(0)->time); diff --git a/src/plugins/directshow/directshow.json b/src/plugins/directshow/directshow.json index 54c1c9f04..b1783b5ed 100644 --- a/src/plugins/directshow/directshow.json +++ b/src/plugins/directshow/directshow.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.camera", "org.qt-project.qt.mediaplayer"] + "Keys": ["directshow"], + "Services": ["org.qt-project.qt.camera", "org.qt-project.qt.mediaplayer"] } diff --git a/src/plugins/directshow/directshow_camera.json b/src/plugins/directshow/directshow_camera.json index d3a58c758..c37ce2c9a 100644 --- a/src/plugins/directshow/directshow_camera.json +++ b/src/plugins/directshow/directshow_camera.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.camera"] + "Keys": ["directshow"], + "Services": ["org.qt-project.qt.camera"] } diff --git a/src/plugins/directshow/player/directshowplayerservice.cpp b/src/plugins/directshow/player/directshowplayerservice.cpp index d89ed7bdb..70049e245 100644 --- a/src/plugins/directshow/player/directshowplayerservice.cpp +++ b/src/plugins/directshow/player/directshowplayerservice.cpp @@ -578,6 +578,9 @@ void DirectShowPlayerService::doReleaseGraph(QMutexLocker *locker) control->Release(); } + //release m_headerInfo -> decrease ref counter of m_source + m_metaDataControl->updateGraph(0, 0); + if (m_source) { m_source->Release(); m_source = 0; @@ -627,6 +630,7 @@ int DirectShowPlayerService::findStreamTypes(IBaseFilter *source) const } } } + pins->Release(); } filter->Release(); } diff --git a/src/plugins/gstreamer/audiodecoder/audiodecoder.json b/src/plugins/gstreamer/audiodecoder/audiodecoder.json index 3cc81dc72..4314f2efa 100644 --- a/src/plugins/gstreamer/audiodecoder/audiodecoder.json +++ b/src/plugins/gstreamer/audiodecoder/audiodecoder.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.audiodecode"] + "Keys": ["gstreameraudiodecode"], + "Services": ["org.qt-project.qt.audiodecode"] } diff --git a/src/plugins/gstreamer/camerabin/camerabin.json b/src/plugins/gstreamer/camerabin/camerabin.json index d3a58c758..3246b4683 100644 --- a/src/plugins/gstreamer/camerabin/camerabin.json +++ b/src/plugins/gstreamer/camerabin/camerabin.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.camera"] + "Keys": ["gstreamercamerabin"], + "Services": ["org.qt-project.qt.camera"] } diff --git a/src/plugins/gstreamer/common.pri b/src/plugins/gstreamer/common.pri index 91086576f..4349a8aed 100644 --- a/src/plugins/gstreamer/common.pri +++ b/src/plugins/gstreamer/common.pri @@ -23,7 +23,7 @@ maemo*:PKGCONFIG +=gstreamer-plugins-bad-0.10 config_resourcepolicy { DEFINES += HAVE_RESOURCE_POLICY - PKGCONFIG += libresourceqt1 + PKGCONFIG += libresourceqt5 } config_xvideo:qtHaveModule(widgets) { diff --git a/src/plugins/gstreamer/gstreamer.json b/src/plugins/gstreamer/gstreamer.json index 3f6ccdafd..0656cce4f 100644 --- a/src/plugins/gstreamer/gstreamer.json +++ b/src/plugins/gstreamer/gstreamer.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.mediaplayer", "org.qt-project.qt.audiosource", "org.qt-project.qt.camera", "org.qt-project.qt.audiodecode"] + "Keys": ["gstreamer"], + "Services": ["org.qt-project.qt.mediaplayer", "org.qt-project.qt.audiosource", "org.qt-project.qt.camera", "org.qt-project.qt.audiodecode"] } diff --git a/src/plugins/gstreamer/mediacapture/mediacapture.json b/src/plugins/gstreamer/mediacapture/mediacapture.json index d963a2e3e..68ca3f55b 100644 --- a/src/plugins/gstreamer/mediacapture/mediacapture.json +++ b/src/plugins/gstreamer/mediacapture/mediacapture.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.audiosource"] + "Keys": ["gstreamermediacapture"], + "Services": ["org.qt-project.qt.audiosource"] } diff --git a/src/plugins/gstreamer/mediacapture/mediacapturecamera.json b/src/plugins/gstreamer/mediacapture/mediacapturecamera.json index b31238363..af9f3575f 100644 --- a/src/plugins/gstreamer/mediacapture/mediacapturecamera.json +++ b/src/plugins/gstreamer/mediacapture/mediacapturecamera.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.audiosource", "org.qt-project.qt.camera"] + "Keys": ["gstreamermediacapture"] + "Services": ["org.qt-project.qt.audiosource", "org.qt-project.qt.camera"] } diff --git a/src/plugins/gstreamer/mediaplayer/mediaplayer.json b/src/plugins/gstreamer/mediaplayer/mediaplayer.json index c4a27ea01..bd1a7e64d 100644 --- a/src/plugins/gstreamer/mediaplayer/mediaplayer.json +++ b/src/plugins/gstreamer/mediaplayer/mediaplayer.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.mediaplayer"] + "Keys": ["gstreamermediaplayer"], + "Services": ["org.qt-project.qt.mediaplayer"] } diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 56fb6539e..1e0ea4386 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -56,3 +56,8 @@ mac:!simulator { config_opensles { SUBDIRS += opensles } + +config_resourcepolicy { + SUBDIRS += resourcepolicy +} + diff --git a/src/plugins/qt7/qt7.json b/src/plugins/qt7/qt7.json index c4a27ea01..b4cebad99 100644 --- a/src/plugins/qt7/qt7.json +++ b/src/plugins/qt7/qt7.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.mediaplayer"] + "Keys": ["qt7"], + "Services": ["org.qt-project.qt.mediaplayer"] } diff --git a/src/plugins/resourcepolicy/resourcepolicy.json b/src/plugins/resourcepolicy/resourcepolicy.json new file mode 100644 index 000000000..d751b849c --- /dev/null +++ b/src/plugins/resourcepolicy/resourcepolicy.json @@ -0,0 +1,4 @@ +{ + "Keys": ["resourcepolicy"], + "Services": ["org.qt-project.qt.mediaplayerresourcesetfactory", "default"] +} diff --git a/src/plugins/resourcepolicy/resourcepolicy.pro b/src/plugins/resourcepolicy/resourcepolicy.pro new file mode 100644 index 000000000..7aa1ced9f --- /dev/null +++ b/src/plugins/resourcepolicy/resourcepolicy.pro @@ -0,0 +1,21 @@ +TARGET = resourceqt + +QT += multimedia-private +CONFIG += no_private_qt_headers_warning link_pkgconfig +PKGCONFIG += libresourceqt5 + +PLUGIN_TYPE = resourcepolicy +PLUGIN_CLASS_NAME = ResourceQtPolicyPlugin +load(qt_plugin) + +INCLUDEPATH += $$PWD \ + $${SOURCE_DIR}/src/multimedia + +HEADERS += \ + $$PWD/resourcepolicyplugin.h \ + $$PWD/resourcepolicyimpl.h + +SOURCES += \ + $$PWD/resourcepolicyplugin.cpp \ + $$PWD/resourcepolicyimpl.cpp + diff --git a/src/plugins/resourcepolicy/resourcepolicyimpl.cpp b/src/plugins/resourcepolicy/resourcepolicyimpl.cpp new file mode 100644 index 000000000..26f713560 --- /dev/null +++ b/src/plugins/resourcepolicy/resourcepolicyimpl.cpp @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd, author: <robin.burchell@jollamobile.com> +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <policy/resource.h> +#include <policy/resources.h> +#include <policy/resource-set.h> + +#include "resourcepolicyimpl.h" + +ResourcePolicyImpl::ResourcePolicyImpl(QObject *parent) + : QMediaPlayerResourceSetInterface(parent) +{ + 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())); +} + +bool ResourcePolicyImpl::isVideoEnabled() const +{ + return m_videoEnabled; +} + +void ResourcePolicyImpl::setVideoEnabled(bool videoEnabled) +{ + if (m_videoEnabled != videoEnabled) { + m_videoEnabled = videoEnabled; + + if (videoEnabled) + m_resourceSet->addResource(ResourcePolicy::VideoPlaybackType); + else + m_resourceSet->deleteResource(ResourcePolicy::VideoPlaybackType); + + m_resourceSet->update(); + } +} + +void ResourcePolicyImpl::acquire() +{ + m_status = RequestedResource; + m_resourceSet->acquire(); +} + +void ResourcePolicyImpl::release() +{ + m_resourceSet->release(); + m_status = Initial; +} + +bool ResourcePolicyImpl::isGranted() const +{ + return m_status == GrantedResource; +} + +bool ResourcePolicyImpl::isAvailable() const +{ + // TODO: is this used? what is it for? + qWarning() << Q_FUNC_INFO << "Stub"; + return true; +} + +void ResourcePolicyImpl::handleResourcesGranted() +{ + m_status = GrantedResource; + emit resourcesGranted(); +} + +void ResourcePolicyImpl::handleResourcesDenied() +{ + m_status = Initial; + emit resourcesDenied(); +} + +void ResourcePolicyImpl::handleResourcesLost() +{ + if (m_status != Initial) { + m_status = Initial; + emit resourcesLost(); + } + + m_resourceSet->release(); +} + diff --git a/src/plugins/resourcepolicy/resourcepolicyimpl.h b/src/plugins/resourcepolicy/resourcepolicyimpl.h new file mode 100644 index 000000000..8680df86a --- /dev/null +++ b/src/plugins/resourcepolicy/resourcepolicyimpl.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd, author: <robin.burchell@jollamobile.com> +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef RESOURCEPOLICYIMPL_H +#define RESOURCEPOLICYIMPL_H + +#include <QObject> + +#include <private/qmediaresourceset_p.h> + +namespace ResourcePolicy { + class ResourceSet; +}; + +class ResourcePolicyImpl : public QMediaPlayerResourceSetInterface +{ + Q_OBJECT +public: + ResourcePolicyImpl(QObject *parent = 0); + + bool isVideoEnabled() const; + void setVideoEnabled(bool videoEnabled); + void acquire(); + void release(); + bool isGranted() const; + bool isAvailable() const; + +private 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 // RESOURCEPOLICYIMPL_H diff --git a/src/plugins/resourcepolicy/resourcepolicyplugin.cpp b/src/plugins/resourcepolicy/resourcepolicyplugin.cpp new file mode 100644 index 000000000..7fc69d326 --- /dev/null +++ b/src/plugins/resourcepolicy/resourcepolicyplugin.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd, author: <robin.burchell@jollamobile.com> +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QDebug> + +#include "resourcepolicyplugin.h" +#include "resourcepolicyimpl.h" + +ResourcePolicyPlugin::ResourcePolicyPlugin(QObject *parent) + : QMediaResourcePolicyPlugin(parent) +{ +} + +QObject *ResourcePolicyPlugin::create(const QString &interfaceId) +{ + // TODO: what is interfaceId for? + return new ResourcePolicyImpl(this); +} + +void ResourcePolicyPlugin::destroy(QObject *resourceSet) +{ + // TODO: do we need to do anything more elaborate here? + delete resourceSet; +} + diff --git a/src/plugins/resourcepolicy/resourcepolicyplugin.h b/src/plugins/resourcepolicy/resourcepolicyplugin.h new file mode 100644 index 000000000..f23641a75 --- /dev/null +++ b/src/plugins/resourcepolicy/resourcepolicyplugin.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd, author: <robin.burchell@jollamobile.com> +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef RESOURCEPOLICYPLUGIN_H +#define RESOURCEPOLICYPLUGIN_H + +#include <private/qmediaresourcepolicyplugin_p.h> +#include <QObject> + +class ResourcePolicyPlugin : public QMediaResourcePolicyPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaresourcesetfactory/5.0" FILE "resourcepolicy.json") + Q_INTERFACES(QMediaResourceSetFactoryInterface) +public: + ResourcePolicyPlugin(QObject *parent = 0); + + QObject *create(const QString &interfaceId); + void destroy(QObject *resourceSet); +}; + +#endif // RESOURCEPOLICYPLUGIN_H diff --git a/src/plugins/v4l/v4l.json b/src/plugins/v4l/v4l.json index f87f329c1..467fd526f 100644 --- a/src/plugins/v4l/v4l.json +++ b/src/plugins/v4l/v4l.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.radio"] + "Keys": ["v4l"], + "Services": ["org.qt-project.qt.radio"] } diff --git a/src/plugins/wmf/player/mfplayersession.cpp b/src/plugins/wmf/player/mfplayersession.cpp index c52498f63..fb150c3e9 100644 --- a/src/plugins/wmf/player/mfplayersession.cpp +++ b/src/plugins/wmf/player/mfplayersession.cpp @@ -1326,8 +1326,6 @@ 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; } @@ -1911,10 +1909,12 @@ void MFPlayerSession::handleSessionEvent(IMFMediaEvent *sessionEvent) switch (meType) { case MEBufferingStarted: - changeStatus(QMediaPlayer::StalledMedia); + changeStatus(m_status == QMediaPlayer::LoadedMedia ? QMediaPlayer::BufferingMedia : QMediaPlayer::StalledMedia); emit bufferStatusChanged(bufferStatus()); break; case MEBufferingStopped: + if (m_status == QMediaPlayer::BufferingMedia) + stop(true); changeStatus(QMediaPlayer::BufferedMedia); emit bufferStatusChanged(bufferStatus()); break; @@ -1979,6 +1979,16 @@ void MFPlayerSession::handleSessionEvent(IMFMediaEvent *sessionEvent) } } MFGetService(m_session, MFNETSOURCE_STATISTICS_SERVICE, IID_PPV_ARGS(&m_netsourceStatistics)); + + if (!m_netsourceStatistics || bufferStatus() == 100) { + // If the source reader doesn't implement the statistics service, just set the status + // to buffered, since there is no way to query the buffering progress... + changeStatus(QMediaPlayer::BufferedMedia); + } else { + // Start to trigger buffering. Once enough buffering is done, the session will + // be automatically stopped unless the user has explicitly started playback. + start(); + } } } } diff --git a/src/plugins/wmf/player/mfvideorenderercontrol.cpp b/src/plugins/wmf/player/mfvideorenderercontrol.cpp index 6baa3716e..8f73244c0 100644 --- a/src/plugins/wmf/player/mfvideorenderercontrol.cpp +++ b/src/plugins/wmf/player/mfvideorenderercontrol.cpp @@ -1286,6 +1286,7 @@ namespace { HRESULT hr = S_OK; Q_ASSERT(pOp != NULL); + Q_UNUSED(pOp) hr = processSamplesFromQueue(WriteSamples); // We are in the middle of an asynchronous operation, so if something failed, send an error. if (FAILED(hr)) diff --git a/src/plugins/wmf/wmf.json b/src/plugins/wmf/wmf.json index b350cef41..e70736480 100644 --- a/src/plugins/wmf/wmf.json +++ b/src/plugins/wmf/wmf.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.mediaplayer", "org.qt-project.qt.audiodecode"] + "Keys": ["windowsmediafoundation"], + "Services": ["org.qt-project.qt.mediaplayer", "org.qt-project.qt.audiodecode"] } diff --git a/src/plugins/wmf/wmfserviceplugin.cpp b/src/plugins/wmf/wmfserviceplugin.cpp index 0978069c9..79354b4e1 100644 --- a/src/plugins/wmf/wmfserviceplugin.cpp +++ b/src/plugins/wmf/wmfserviceplugin.cpp @@ -105,12 +105,12 @@ QMediaServiceProviderHint::Features WMFServicePlugin::supportedFeatures( return QMediaServiceProviderHint::Features(); } -QList<QByteArray> WMFServicePlugin::devices(const QByteArray &service) const +QList<QByteArray> WMFServicePlugin::devices(const QByteArray &) const { return QList<QByteArray>(); } -QString WMFServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device) +QString WMFServicePlugin::deviceDescription(const QByteArray &, const QByteArray &) { return QString(); } diff --git a/sync.profile b/sync.profile index abccf5625..0d0eb51b7 100644 --- a/sync.profile +++ b/sync.profile @@ -18,10 +18,10 @@ # 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) +# - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch) # %dependencies = ( - "qtbase" => "refs/heads/dev", - "qtxmlpatterns" => "refs/heads/dev", - "qtdeclarative" => "refs/heads/dev", - "qtjsbackend" => "refs/heads/dev", + "qtbase" => "", + "qtxmlpatterns" => "", + "qtdeclarative" => "", ); diff --git a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin1/mockserviceplugin1.json b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin1/mockserviceplugin1.json index c4a27ea01..69ff56452 100644 --- a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin1/mockserviceplugin1.json +++ b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin1/mockserviceplugin1.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.mediaplayer"] + "Keys": ["mockserviceplugin1"], + "Services": ["org.qt-project.qt.mediaplayer"] } diff --git a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.json b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.json index ec05f3e52..15d8ed505 100644 --- a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.json +++ b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.mediaplayer", "org.qt-project.qt.radio"] + "Keys": ["mockserviceplugin2"], + "Services": ["org.qt-project.qt.mediaplayer", "org.qt-project.qt.radio"] } diff --git a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin3/mockserviceplugin3.json b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin3/mockserviceplugin3.json index 58bbc4d74..591a02e51 100644 --- a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin3/mockserviceplugin3.json +++ b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin3/mockserviceplugin3.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.mediaplayer", "org.qt-project.qt.audiosource"] + "Keys": ["mockserviceplugin3"], + "Services": ["org.qt-project.qt.mediaplayer", "org.qt-project.qt.audiosource"] } diff --git a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.json b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.json index c4a27ea01..d8b8bd7e9 100644 --- a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.json +++ b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.json @@ -1,3 +1,4 @@ { - "Keys": ["org.qt-project.qt.mediaplayer"] + "Keys": ["mockserviceplugin4"], + "Services": ["org.qt-project.qt.mediaplayer"] } |