diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-05-23 13:15:45 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-05-23 13:15:45 +0200 |
commit | 0ef52f01029176a8fb8fbef2c22ae9350635ebe1 (patch) | |
tree | fad805097d0e40ba57dcfb61ac3067737c7a2ae3 /src/imports | |
parent | cb324a50c920b275ef6c04162712b1a6f19bbe8d (diff) | |
parent | 5c087bb6153b951e1c5709ee7f998819d08a6122 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: I24ffb71c4cc2e262394797deb8a22b2cf9a80c3c
Diffstat (limited to 'src/imports')
10 files changed, 147 insertions, 73 deletions
diff --git a/src/imports/audioengine/plugins.qmltypes b/src/imports/audioengine/plugins.qmltypes index 6a7dae1a4..8c6267bda 100644 --- a/src/imports/audioengine/plugins.qmltypes +++ b/src/imports/audioengine/plugins.qmltypes @@ -2,6 +2,8 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. +// +// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtAudioEngine 1.0'. Module { Component { @@ -12,27 +14,30 @@ Module { Component { name: "QDeclarativeAttenuationModelInverse" prototype: "QDeclarativeAttenuationModel" - exports: ["AttenuationModelInverse 1.0"] - Property { name: "start"; type: "qreal" } - Property { name: "end"; type: "qreal" } - Property { name: "rolloff"; type: "qreal" } + exports: ["QtAudioEngine/AttenuationModelInverse 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "start"; type: "double" } + Property { name: "end"; type: "double" } + Property { name: "rolloff"; type: "double" } } Component { name: "QDeclarativeAttenuationModelLinear" prototype: "QDeclarativeAttenuationModel" - exports: ["AttenuationModelLinear 1.0"] - Property { name: "start"; type: "qreal" } - Property { name: "end"; type: "qreal" } + exports: ["QtAudioEngine/AttenuationModelLinear 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "start"; type: "double" } + Property { name: "end"; type: "double" } } Component { name: "QDeclarativeAudioCategory" prototype: "QObject" - exports: ["AudioCategory 1.0"] - Property { name: "volume"; type: "qreal" } + exports: ["QtAudioEngine/AudioCategory 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "volume"; type: "double" } Property { name: "name"; type: "string" } Signal { name: "volumeChanged" - Parameter { name: "newVolume"; type: "qreal" } + Parameter { name: "newVolume"; type: "double" } } Signal { name: "stopped" } Signal { name: "paused" } @@ -45,7 +50,8 @@ Module { name: "QDeclarativeAudioEngine" defaultProperty: "bank" prototype: "QObject" - exports: ["AudioEngine 1.0"] + exports: ["QtAudioEngine/AudioEngine 1.0"] + exportMetaObjectRevisions: [0] Property { name: "bank"; type: "QObject"; isList: true; isReadonly: true } Property { name: "categories"; type: "QObject"; isReadonly: true; isPointer: true } Property { name: "samples"; type: "QObject"; isReadonly: true; isPointer: true } @@ -58,8 +64,8 @@ Module { isReadonly: true isPointer: true } - Property { name: "dopplerFactor"; type: "qreal" } - Property { name: "speedOfSound"; type: "qreal" } + Property { name: "dopplerFactor"; type: "double" } + Property { name: "speedOfSound"; type: "double" } Signal { name: "ready" } Signal { name: "liveInstanceCountChanged" } Signal { name: "isLoadingChanged" } @@ -68,18 +74,20 @@ Module { Component { name: "QDeclarativeAudioListener" prototype: "QObject" - exports: ["AudioListener 1.0"] + exports: ["QtAudioEngine/AudioListener 1.0"] + exportMetaObjectRevisions: [0] Property { name: "engine"; type: "QDeclarativeAudioEngine"; isPointer: true } Property { name: "position"; type: "QVector3D" } Property { name: "direction"; type: "QVector3D" } Property { name: "velocity"; type: "QVector3D" } Property { name: "up"; type: "QVector3D" } - Property { name: "gain"; type: "qreal" } + Property { name: "gain"; type: "double" } } Component { name: "QDeclarativeAudioSample" prototype: "QObject" - exports: ["AudioSample 1.0"] + exports: ["QtAudioEngine/AudioSample 1.0"] + exportMetaObjectRevisions: [0] Property { name: "name"; type: "string" } Property { name: "source"; type: "QUrl" } Property { name: "preloaded"; type: "bool" } @@ -90,19 +98,21 @@ Module { Component { name: "QDeclarativePlayVariation" prototype: "QObject" - exports: ["PlayVariation 1.0"] + exports: ["QtAudioEngine/PlayVariation 1.0"] + exportMetaObjectRevisions: [0] Property { name: "sample"; type: "string" } Property { name: "looping"; type: "bool" } - Property { name: "maxGain"; type: "qreal" } - Property { name: "minGain"; type: "qreal" } - Property { name: "maxPitch"; type: "qreal" } - Property { name: "minPitch"; type: "qreal" } + Property { name: "maxGain"; type: "double" } + Property { name: "minGain"; type: "double" } + Property { name: "maxPitch"; type: "double" } + Property { name: "minPitch"; type: "double" } } Component { name: "QDeclarativeSound" defaultProperty: "playVariationlist" prototype: "QObject" - exports: ["Sound 1.0"] + exports: ["QtAudioEngine/Sound 1.0"] + exportMetaObjectRevisions: [0] Enum { name: "PlayType" values: { @@ -124,12 +134,12 @@ Module { Method { name: "play" } Method { name: "play" - Parameter { name: "gain"; type: "qreal" } + Parameter { name: "gain"; type: "double" } } Method { name: "play" - Parameter { name: "gain"; type: "qreal" } - Parameter { name: "pitch"; type: "qreal" } + Parameter { name: "gain"; type: "double" } + Parameter { name: "pitch"; type: "double" } } Method { name: "play" @@ -149,60 +159,60 @@ Module { Method { name: "play" Parameter { name: "position"; type: "QVector3D" } - Parameter { name: "gain"; type: "qreal" } + Parameter { name: "gain"; type: "double" } } Method { name: "play" Parameter { name: "position"; type: "QVector3D" } Parameter { name: "velocity"; type: "QVector3D" } - Parameter { name: "gain"; type: "qreal" } + Parameter { name: "gain"; type: "double" } } Method { name: "play" Parameter { name: "position"; type: "QVector3D" } Parameter { name: "velocity"; type: "QVector3D" } Parameter { name: "direction"; type: "QVector3D" } - Parameter { name: "gain"; type: "qreal" } + Parameter { name: "gain"; type: "double" } } Method { name: "play" Parameter { name: "position"; type: "QVector3D" } - Parameter { name: "gain"; type: "qreal" } - Parameter { name: "pitch"; type: "qreal" } + Parameter { name: "gain"; type: "double" } + Parameter { name: "pitch"; type: "double" } } Method { name: "play" Parameter { name: "position"; type: "QVector3D" } Parameter { name: "velocity"; type: "QVector3D" } - Parameter { name: "gain"; type: "qreal" } - Parameter { name: "pitch"; type: "qreal" } + Parameter { name: "gain"; type: "double" } + Parameter { name: "pitch"; type: "double" } } Method { name: "play" Parameter { name: "position"; type: "QVector3D" } Parameter { name: "velocity"; type: "QVector3D" } Parameter { name: "direction"; type: "QVector3D" } - Parameter { name: "gain"; type: "qreal" } - Parameter { name: "pitch"; type: "qreal" } + Parameter { name: "gain"; type: "double" } + Parameter { name: "pitch"; type: "double" } } Method { name: "newInstance"; type: "QDeclarativeSoundInstance*" } } Component { name: "QDeclarativeSoundCone" prototype: "QObject" - exports: [" 1.0"] - Property { name: "innerAngle"; type: "qreal" } - Property { name: "outerAngle"; type: "qreal" } - Property { name: "outerGain"; type: "qreal" } + Property { name: "innerAngle"; type: "double" } + Property { name: "outerAngle"; type: "double" } + Property { name: "outerGain"; type: "double" } } Component { name: "QDeclarativeSoundInstance" prototype: "QObject" - exports: ["SoundInstance 1.0"] + exports: ["QtAudioEngine/SoundInstance 1.0"] + exportMetaObjectRevisions: [0] Enum { name: "State" values: { - "StopppedState": 0, + "StoppedState": 0, "PlayingState": 1, "PausedState": 2 } @@ -213,14 +223,14 @@ Module { Property { name: "position"; type: "QVector3D" } Property { name: "direction"; type: "QVector3D" } Property { name: "velocity"; type: "QVector3D" } - Property { name: "gain"; type: "qreal" } - Property { name: "pitch"; type: "qreal" } + Property { name: "gain"; type: "double" } + Property { name: "pitch"; type: "double" } Method { name: "play" } Method { name: "stop" } Method { name: "pause" } Method { name: "updatePosition" - Parameter { name: "deltaTime"; type: "qreal" } + Parameter { name: "deltaTime"; type: "double" } } } Component { diff --git a/src/imports/multimedia/Video.qml b/src/imports/multimedia/Video.qml index f65054cda..bf53d5ff5 100644 --- a/src/imports/multimedia/Video.qml +++ b/src/imports/multimedia/Video.qml @@ -186,14 +186,14 @@ Item { This property holds the error state of the video. It can be one of: \list - \li NoError - there is no current error. - \li ResourceError - the video cannot be played due to a problem + \li MediaPlayer.NoError - there is no current error. + \li MediaPlayer.ResourceError - the video cannot be played due to a problem allocating resources. - \li FormatError - the video format is not supported. - \li NetworkError - the video cannot be played due to network issues. - \li AccessDenied - the video cannot be played due to insufficient + \li MediaPlayer.FormatError - the video format is not supported. + \li MediaPlayer.NetworkError - the video cannot be played due to network issues. + \li MediaPlayer.AccessDenied - the video cannot be played due to insufficient permissions. - \li ServiceMissing - the video cannot be played because the media + \li MediaPlayer.ServiceMissing - the video cannot be played because the media service could not be instantiated. \endlist @@ -295,15 +295,15 @@ Item { This property holds the status of media loading. It can be one of: \list - \li NoMedia - no media has been set. - \li Loading - the media is currently being loaded. - \li Loaded - the media has been loaded. - \li Buffering - the media is buffering data. - \li Stalled - playback has been interrupted while the media is buffering data. - \li Buffered - the media has buffered data. - \li EndOfMedia - the media has played to the end. - \li InvalidMedia - the media cannot be played. - \li UnknownStatus - the status of the media cannot be determined. + \li MediaPlayer.NoMedia - no media has been set. + \li MediaPlayer.Loading - the media is currently being loaded. + \li MediaPlayer.Loaded - the media has been loaded. + \li MediaPlayer.Buffering - the media is buffering data. + \li MediaPlayer.Stalled - playback has been interrupted while the media is buffering data. + \li MediaPlayer.Buffered - the media has buffered data. + \li MediaPlayer.EndOfMedia - the media has played to the end. + \li MediaPlayer.InvalidMedia - the media cannot be played. + \li MediaPlayer.UnknownStatus - the status of the media cannot be determined. \endlist */ property alias status: player.status diff --git a/src/imports/multimedia/qdeclarativecamerafocus.cpp b/src/imports/multimedia/qdeclarativecamerafocus.cpp index 19d8ca81e..4b5544d2a 100644 --- a/src/imports/multimedia/qdeclarativecamerafocus.cpp +++ b/src/imports/multimedia/qdeclarativecamerafocus.cpp @@ -179,7 +179,10 @@ bool QDeclarativeCameraFocus::isFocusModeSupported(QDeclarativeCamera::FocusMode void QDeclarativeCameraFocus::setFocusMode(QDeclarativeCamera::FocusMode mode) { - m_focus->setFocusMode(QCameraFocus::FocusModes(int(mode))); + if (mode != focusMode()) { + m_focus->setFocusMode(QCameraFocus::FocusModes(int(mode))); + emit focusModeChanged(focusMode()); + } } /*! \property QDeclarativeCameraFocus::focusPointMode diff --git a/src/imports/multimedia/qdeclarativemediametadata_p.h b/src/imports/multimedia/qdeclarativemediametadata_p.h index 5b7c46993..1983effa0 100644 --- a/src/imports/multimedia/qdeclarativemediametadata_p.h +++ b/src/imports/multimedia/qdeclarativemediametadata_p.h @@ -54,6 +54,7 @@ // #include <QtQml/qqml.h> +#include <QtMultimedia/qmediametadata.h> #include "qmediaobject.h" QT_BEGIN_NAMESPACE diff --git a/src/imports/multimedia/qdeclarativevideooutput.cpp b/src/imports/multimedia/qdeclarativevideooutput.cpp index fc17a20fa..53c810403 100644 --- a/src/imports/multimedia/qdeclarativevideooutput.cpp +++ b/src/imports/multimedia/qdeclarativevideooutput.cpp @@ -484,13 +484,18 @@ QRectF QDeclarativeVideoOutput::contentRect() const This property holds the area of the source video content that is considered for rendering. The - values are in source pixel coordinates. + values are in source pixel coordinates, adjusted for + the source's pixel aspect ratio. Note that typically the top left corner of this rectangle will be \c {0,0} while the width and height will be the - width and height of the input content. + width and height of the input content. Only when the video + source has a viewport set, these values will differ. The orientation setting does not affect this rectangle. + + \sa QVideoSurfaceFormat::pixelAspectRatio() + \sa QVideoSurfaceFormat::viewport() */ QRectF QDeclarativeVideoOutput::sourceRect() const { @@ -499,7 +504,19 @@ QRectF QDeclarativeVideoOutput::sourceRect() const if (!qIsDefaultAspect(m_orientation)) { size.transpose(); } - return QRectF(QPointF(), size); // XXX ignores viewport + + // No backend? Just assume no viewport. + if (!m_nativeSize.isValid() || !m_backend) { + return QRectF(QPointF(), size); + } + + // Take the viewport into account for the top left position. + // m_nativeSize is already adjusted to the viewport, as it originats + // from QVideoSurfaceFormat::sizeHint(), which includes pixel aspect + // ratio and viewport. + const QRectF viewport = m_backend->adjustedViewport(); + Q_ASSERT(viewport.size() == size); + return QRectF(viewport.topLeft(), size); } /*! diff --git a/src/imports/multimedia/qdeclarativevideooutput_backend_p.h b/src/imports/multimedia/qdeclarativevideooutput_backend_p.h index 7f2284bb4..f731b77f1 100644 --- a/src/imports/multimedia/qdeclarativevideooutput_backend_p.h +++ b/src/imports/multimedia/qdeclarativevideooutput_backend_p.h @@ -74,6 +74,9 @@ public: virtual QSGNode *updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *data) = 0; virtual QAbstractVideoSurface *videoSurface() const = 0; + // The viewport, adjusted for the pixel aspect ratio + virtual QRectF adjustedViewport() const = 0; + protected: QDeclarativeVideoOutput *q; QPointer<QMediaService> m_service; diff --git a/src/imports/multimedia/qdeclarativevideooutput_render.cpp b/src/imports/multimedia/qdeclarativevideooutput_render.cpp index e9bcf4b26..96b979bc5 100644 --- a/src/imports/multimedia/qdeclarativevideooutput_render.cpp +++ b/src/imports/multimedia/qdeclarativevideooutput_render.cpp @@ -133,30 +133,45 @@ QSize QDeclarativeVideoRendererBackend::nativeSize() const void QDeclarativeVideoRendererBackend::updateGeometry() { + const QRectF viewport = videoSurface()->surfaceFormat().viewport(); + const QSizeF frameSize = videoSurface()->surfaceFormat().frameSize(); + const QRectF normalizedViewport(viewport.x() / frameSize.width(), + viewport.y() / frameSize.height(), + viewport.width() / frameSize.width(), + viewport.height() / frameSize.height()); const QRectF rect(0, 0, q->width(), q->height()); if (nativeSize().isEmpty()) { m_renderedRect = rect; - m_sourceTextureRect = QRectF(0, 0, 1, 1); + m_sourceTextureRect = normalizedViewport; } else if (q->fillMode() == QDeclarativeVideoOutput::Stretch) { m_renderedRect = rect; - m_sourceTextureRect = QRectF(0, 0, 1, 1); + m_sourceTextureRect = normalizedViewport; } else if (q->fillMode() == QDeclarativeVideoOutput::PreserveAspectFit) { - m_sourceTextureRect = QRectF(0, 0, 1, 1); + m_sourceTextureRect = normalizedViewport; m_renderedRect = q->contentRect(); } else if (q->fillMode() == QDeclarativeVideoOutput::PreserveAspectCrop) { m_renderedRect = rect; const qreal contentHeight = q->contentRect().height(); const qreal contentWidth = q->contentRect().width(); + + // Calculate the size of the source rectangle without taking the viewport into account + const qreal relativeOffsetLeft = -q->contentRect().left() / contentWidth; + const qreal relativeOffsetTop = -q->contentRect().top() / contentHeight; + const qreal relativeWidth = rect.width() / contentWidth; + const qreal relativeHeight = rect.height() / contentHeight; + + // Now take the viewport size into account + const qreal totalOffsetLeft = normalizedViewport.x() + relativeOffsetLeft * normalizedViewport.width(); + const qreal totalOffsetTop = normalizedViewport.y() + relativeOffsetTop * normalizedViewport.height(); + const qreal totalWidth = normalizedViewport.width() * relativeWidth; + const qreal totalHeight = normalizedViewport.height() * relativeHeight; + if (qIsDefaultAspect(q->orientation())) { - m_sourceTextureRect = QRectF(-q->contentRect().left() / contentWidth, - -q->contentRect().top() / contentHeight, - rect.width() / contentWidth, - rect.height() / contentHeight); + m_sourceTextureRect = QRectF(totalOffsetLeft, totalOffsetTop, + totalWidth, totalHeight); } else { - m_sourceTextureRect = QRectF(-q->contentRect().top() / contentHeight, - -q->contentRect().left() / contentWidth, - rect.height() / contentHeight, - rect.width() / contentWidth); + m_sourceTextureRect = QRectF(totalOffsetTop, totalOffsetLeft, + totalHeight, totalWidth); } } } @@ -223,6 +238,22 @@ QAbstractVideoSurface *QDeclarativeVideoRendererBackend::videoSurface() const return m_surface; } +QRectF QDeclarativeVideoRendererBackend::adjustedViewport() const +{ + const QRectF viewport = m_surface->surfaceFormat().viewport(); + const QSize pixelAspectRatio = m_surface->surfaceFormat().pixelAspectRatio(); + + if (pixelAspectRatio.height() != 0) { + const qreal ratio = pixelAspectRatio.width() / pixelAspectRatio.height(); + QRectF result = viewport; + result.setX(result.x() * ratio); + result.setWidth(result.width() * ratio); + return result; + } + + return viewport; +} + QOpenGLContext *QDeclarativeVideoRendererBackend::glContext() const { return m_glContext; diff --git a/src/imports/multimedia/qdeclarativevideooutput_render_p.h b/src/imports/multimedia/qdeclarativevideooutput_render_p.h index 2a706b339..3682c15a6 100644 --- a/src/imports/multimedia/qdeclarativevideooutput_render_p.h +++ b/src/imports/multimedia/qdeclarativevideooutput_render_p.h @@ -71,6 +71,7 @@ public: void updateGeometry(); QSGNode *updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *data); QAbstractVideoSurface *videoSurface() const; + QRectF adjustedViewport() const Q_DECL_OVERRIDE; QOpenGLContext *glContext() const; friend class QSGVideoItemSurface; diff --git a/src/imports/multimedia/qdeclarativevideooutput_window.cpp b/src/imports/multimedia/qdeclarativevideooutput_window.cpp index 527c08908..2da63c107 100644 --- a/src/imports/multimedia/qdeclarativevideooutput_window.cpp +++ b/src/imports/multimedia/qdeclarativevideooutput_window.cpp @@ -143,4 +143,11 @@ QAbstractVideoSurface *QDeclarativeVideoWindowBackend::videoSurface() const return 0; } +QRectF QDeclarativeVideoWindowBackend::adjustedViewport() const +{ + // No viewport supported by QVideoWindowControl, so make the viewport the same size + // as the source + return QRectF(QPointF(0, 0), nativeSize()); +} + QT_END_NAMESPACE diff --git a/src/imports/multimedia/qdeclarativevideooutput_window_p.h b/src/imports/multimedia/qdeclarativevideooutput_window_p.h index f09b08c42..eb7b35b85 100644 --- a/src/imports/multimedia/qdeclarativevideooutput_window_p.h +++ b/src/imports/multimedia/qdeclarativevideooutput_window_p.h @@ -62,6 +62,7 @@ public: void updateGeometry(); QSGNode *updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *data); QAbstractVideoSurface *videoSurface() const; + QRectF adjustedViewport() const Q_DECL_OVERRIDE; private: QPointer<QVideoWindowControl> m_videoWindowControl; |