summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/multimedia/video/qmlvideo/qml/qmlvideo/CameraItem.qml9
-rw-r--r--src/multimediaquick/qquickvideooutput.cpp185
-rw-r--r--src/multimediaquick/qquickvideooutput_p.h16
3 files changed, 7 insertions, 203 deletions
diff --git a/examples/multimedia/video/qmlvideo/qml/qmlvideo/CameraItem.qml b/examples/multimedia/video/qmlvideo/qml/qmlvideo/CameraItem.qml
index 105d0cca1..3ee257ffa 100644
--- a/examples/multimedia/video/qmlvideo/qml/qmlvideo/CameraItem.qml
+++ b/examples/multimedia/video/qmlvideo/qml/qmlvideo/CameraItem.qml
@@ -51,7 +51,7 @@
import QtQuick
import QtMultimedia
-VideoOutput {
+Item {
id: root
height: width
@@ -80,7 +80,12 @@ VideoOutput {
// resolution: "640x480"
// frameRate: 30
}
- videoOutput: root
+ videoOutput: videoOutput
+ }
+
+ VideoOutput {
+ id: videoOutput
+ anchors.fill: parent
}
diff --git a/src/multimediaquick/qquickvideooutput.cpp b/src/multimediaquick/qquickvideooutput.cpp
index e22e30478..50ed50fe8 100644
--- a/src/multimediaquick/qquickvideooutput.cpp
+++ b/src/multimediaquick/qquickvideooutput.cpp
@@ -426,191 +426,6 @@ QRectF QQuickVideoOutput::sourceRect() const
return QRectF(viewport.topLeft(), size);
}
-/*!
- \qmlmethod QPointF QtMultimedia::VideoOutput::mapNormalizedPointToItem (const QPointF &point) const
-
- Given normalized coordinates \a point (that is, each
- component in the range of 0 to 1.0), return the mapped point
- that it corresponds to (in item coordinates).
- This mapping is affected by the orientation.
-
- Depending on the fill mode, this point may lie outside the rendered
- rectangle.
- */
-QPointF QQuickVideoOutput::mapNormalizedPointToItem(const QPointF &point) const
-{
- qreal dx = point.x();
- qreal dy = point.y();
-
- if (qIsDefaultAspect(m_orientation)) {
- dx *= m_contentRect.width();
- dy *= m_contentRect.height();
- } else {
- dx *= m_contentRect.height();
- dy *= m_contentRect.width();
- }
-
- switch (qNormalizedOrientation(m_orientation)) {
- case 0:
- default:
- return m_contentRect.topLeft() + QPointF(dx, dy);
- case 90:
- return m_contentRect.bottomLeft() + QPointF(dy, -dx);
- case 180:
- return m_contentRect.bottomRight() + QPointF(-dx, -dy);
- case 270:
- return m_contentRect.topRight() + QPointF(-dy, dx);
- }
-}
-
-/*!
- \qmlmethod QRectF QtMultimedia::VideoOutput::mapNormalizedRectToItem(const QRectF &rectangle) const
-
- Given a rectangle \a rectangle in normalized
- coordinates (that is, each component in the range of 0 to 1.0),
- return the mapped rectangle that it corresponds to (in item coordinates).
- This mapping is affected by the orientation.
-
- Depending on the fill mode, this rectangle may extend outside the rendered
- rectangle.
- */
-QRectF QQuickVideoOutput::mapNormalizedRectToItem(const QRectF &rectangle) const
-{
- return QRectF(mapNormalizedPointToItem(rectangle.topLeft()),
- mapNormalizedPointToItem(rectangle.bottomRight())).normalized();
-}
-
-/*!
- \qmlmethod QPointF QtMultimedia::VideoOutput::mapPointToSource(const QPointF &point) const
-
- Given a point \a point in item coordinates, return the
- corresponding point in source coordinates. This mapping is
- affected by the orientation.
-
- If the supplied point lies outside the rendered area, the returned
- point will be outside the source rectangle.
- */
-QPointF QQuickVideoOutput::mapPointToSource(const QPointF &point) const
-{
- QPointF norm = mapPointToSourceNormalized(point);
-
- if (qIsDefaultAspect(m_orientation))
- return QPointF(norm.x() * m_nativeSize.width(), norm.y() * m_nativeSize.height());
-
- return QPointF(norm.x() * m_nativeSize.height(), norm.y() * m_nativeSize.width());
-}
-
-/*!
- \qmlmethod QRectF QtMultimedia::VideoOutput::mapRectToSource(const QRectF &rectangle) const
-
- Given a rectangle \a rectangle in item coordinates, return the
- corresponding rectangle in source coordinates. This mapping is
- affected by the orientation.
-
- This mapping is affected by the orientation.
-
- If the supplied point lies outside the rendered area, the returned
- point will be outside the source rectangle.
- */
-QRectF QQuickVideoOutput::mapRectToSource(const QRectF &rectangle) const
-{
- return QRectF(mapPointToSource(rectangle.topLeft()),
- mapPointToSource(rectangle.bottomRight())).normalized();
-}
-
-/*!
- \qmlmethod QPointF QtMultimedia::VideoOutput::mapPointToSourceNormalized(const QPointF &point) const
-
- Given a point \a point in item coordinates, return the
- corresponding point in normalized source coordinates. This mapping is
- affected by the orientation.
-
- If the supplied point lies outside the rendered area, the returned
- point will be outside the source rectangle. No clamping is performed.
- */
-QPointF QQuickVideoOutput::mapPointToSourceNormalized(const QPointF &point) const
-{
- if (m_contentRect.isEmpty())
- return QPointF();
-
- // Normalize the item source point
- qreal nx = (point.x() - m_contentRect.left()) / m_contentRect.width();
- qreal ny = (point.y() - m_contentRect.top()) / m_contentRect.height();
-
- const qreal one(1.0f);
-
- // For now, the origin of the source rectangle is 0,0
- switch (qNormalizedOrientation(m_orientation)) {
- case 0:
- default:
- return QPointF(nx, ny);
- case 90:
- return QPointF(one - ny, nx);
- case 180:
- return QPointF(one - nx, one - ny);
- case 270:
- return QPointF(ny, one - nx);
- }
-}
-
-/*!
- \qmlmethod QRectF QtMultimedia::VideoOutput::mapRectToSourceNormalized(const QRectF &rectangle) const
-
- Given a rectangle \a rectangle in item coordinates, return the
- corresponding rectangle in normalized source coordinates. This mapping is
- affected by the orientation.
-
- This mapping is affected by the orientation.
-
- If the supplied point lies outside the rendered area, the returned
- point will be outside the source rectangle. No clamping is performed.
- */
-QRectF QQuickVideoOutput::mapRectToSourceNormalized(const QRectF &rectangle) const
-{
- return QRectF(mapPointToSourceNormalized(rectangle.topLeft()),
- mapPointToSourceNormalized(rectangle.bottomRight())).normalized();
-}
-
-/*!
- \qmlmethod QPointF QtMultimedia::VideoOutput::mapPointToItem(const QPointF &point) const
-
- Given a point \a point in source coordinates, return the
- corresponding point in item coordinates. This mapping is
- affected by the orientation.
-
- Depending on the fill mode, this point may lie outside the rendered
- rectangle.
- */
-QPointF QQuickVideoOutput::mapPointToItem(const QPointF &point) const
-{
- if (m_nativeSize.isEmpty())
- return QPointF();
-
- // Just normalize and use that function
- // m_nativeSize is transposed in some orientations
- if (qIsDefaultAspect(m_orientation))
- return mapNormalizedPointToItem(QPointF(point.x() / m_nativeSize.width(), point.y() / m_nativeSize.height()));
-
- return mapNormalizedPointToItem(QPointF(point.x() / m_nativeSize.height(), point.y() / m_nativeSize.width()));
-}
-
-/*!
- \qmlmethod QRectF QtMultimedia::VideoOutput::mapRectToItem(const QRectF &rectangle) const
-
- Given a rectangle \a rectangle in source coordinates, return the
- corresponding rectangle in item coordinates. This mapping is
- affected by the orientation.
-
- Depending on the fill mode, this rectangle may extend outside the rendered
- rectangle.
-
- */
-QRectF QQuickVideoOutput::mapRectToItem(const QRectF &rectangle) const
-{
- return QRectF(mapPointToItem(rectangle.topLeft()),
- mapPointToItem(rectangle.bottomRight())).normalized();
-}
-
QSGNode *QQuickVideoOutput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
{
_q_updateGeometry();
diff --git a/src/multimediaquick/qquickvideooutput_p.h b/src/multimediaquick/qquickvideooutput_p.h
index a1c4f7fe3..453ef9b63 100644
--- a/src/multimediaquick/qquickvideooutput_p.h
+++ b/src/multimediaquick/qquickvideooutput_p.h
@@ -116,22 +116,6 @@ public:
QRectF sourceRect() const;
QRectF contentRect() const;
- Q_INVOKABLE QPointF mapPointToItem(const QPointF &point) const;
- Q_INVOKABLE QRectF mapRectToItem(const QRectF &rectangle) const;
- Q_INVOKABLE QPointF mapNormalizedPointToItem(const QPointF &point) const;
- Q_INVOKABLE QRectF mapNormalizedRectToItem(const QRectF &rectangle) const;
- Q_INVOKABLE QPointF mapPointToSource(const QPointF &point) const;
- Q_INVOKABLE QRectF mapRectToSource(const QRectF &rectangle) const;
- Q_INVOKABLE QPointF mapPointToSourceNormalized(const QPointF &point) const;
- Q_INVOKABLE QRectF mapRectToSourceNormalized(const QRectF &rectangle) const;
-
- enum SourceType {
- NoSource,
- MediaSourceSource,
- VideoSurfaceSource
- };
- SourceType sourceType() const;
-
FlushMode flushMode() const { return m_flushMode; }
void setFlushMode(FlushMode mode);