summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/multimedia/platform/darwin/common/avfmetadata.mm18
-rw-r--r--src/multimedia/platform/darwin/mediaplayer/avfmediaplayer.mm4
-rw-r--r--src/multimedia/video/qvideoframe.cpp19
-rw-r--r--src/multimedia/video/qvideowindow.cpp19
-rw-r--r--src/multimediaquick/qsgvideonode_p.cpp20
5 files changed, 38 insertions, 42 deletions
diff --git a/src/multimedia/platform/darwin/common/avfmetadata.mm b/src/multimedia/platform/darwin/common/avfmetadata.mm
index 834b5ec1f..6c0e50147 100644
--- a/src/multimedia/platform/darwin/common/avfmetadata.mm
+++ b/src/multimedia/platform/darwin/common/avfmetadata.mm
@@ -297,27 +297,11 @@ QMediaMetaData AVFMetaData::fromAssetTrack(AVAssetTrack *asset)
if ([asset.mediaType isEqualToString:AVMediaTypeVideo]) {
// add orientation
if (metadata.value(QMediaMetaData::Orientation).isNull()) {
- int rotation = 0;
QVideoFrame::RotationAngle angle = QVideoFrame::Rotation0;
bool mirrored;
AVFMediaPlayer::videoOrientationForAssetTrack(asset, angle, mirrored);
Q_UNUSED(mirrored);
- switch (angle) {
- // metadata orientation angle is in clockwise direction
- case QVideoFrame::Rotation90:
- rotation = 270;
- break;
- case QVideoFrame::Rotation180:
- rotation = 180;
- break;
- case QVideoFrame::Rotation270:
- rotation = 90;
- break;
- default:
- rotation = 0;
- break;
- }
- metadata.insert(QMediaMetaData::Orientation, rotation);
+ metadata.insert(QMediaMetaData::Orientation, int(angle));
}
}
return metadata;
diff --git a/src/multimedia/platform/darwin/mediaplayer/avfmediaplayer.mm b/src/multimedia/platform/darwin/mediaplayer/avfmediaplayer.mm
index 311a87a31..c4c661464 100644
--- a/src/multimedia/platform/darwin/mediaplayer/avfmediaplayer.mm
+++ b/src/multimedia/platform/darwin/mediaplayer/avfmediaplayer.mm
@@ -1246,9 +1246,9 @@ void AVFMediaPlayer::videoOrientationForAssetTrack(AVAssetTrack *videoTrack,
}
if (qFuzzyCompare(degrees, qreal(90)) || qFuzzyCompare(degrees, qreal(-270))) {
- angle = QVideoFrame::Rotation270;
- } else if (qFuzzyCompare(degrees, qreal(-90)) || qFuzzyCompare(degrees, qreal(270))) {
angle = QVideoFrame::Rotation90;
+ } else if (qFuzzyCompare(degrees, qreal(-90)) || qFuzzyCompare(degrees, qreal(270))) {
+ angle = QVideoFrame::Rotation270;
} else if (qFuzzyCompare(degrees, qreal(180)) || qFuzzyCompare(degrees, qreal(-180))) {
angle = QVideoFrame::Rotation180;
}
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index ea48afc7e..acf549c55 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -702,7 +702,19 @@ void QVideoFrame::setEndTime(qint64 time)
}
/*!
- Sets the counterclockwise rotation \a angle for the frame.
+ \enum QVideoFrame::RotationAngle
+
+ The angle of the clockwise rotation that should be applied to a video
+ frame before displaying.
+
+ \value Rotation0 No rotation required, the frame has correct orientation
+ \value Rotation90 The frame should be rotated by 90 degrees
+ \value Rotation180 The frame should be rotated by 180 degrees
+ \value Rotation270 The frame should be rotated by 270 degrees
+*/
+
+/*!
+ Sets the \a angle the frame should be rotated clockwise before displaying.
*/
void QVideoFrame::setRotationAngle(QVideoFrame::RotationAngle angle)
{
@@ -711,8 +723,7 @@ void QVideoFrame::setRotationAngle(QVideoFrame::RotationAngle angle)
}
/*!
- Returns the angle the frame should be rotated counterclockwise before
- displaying.
+ Returns the angle the frame should be rotated clockwise before displaying.
*/
QVideoFrame::RotationAngle QVideoFrame::rotationAngle() const
{
@@ -771,7 +782,7 @@ QImage QVideoFrame::toImage() const
if (mirrored())
t.scale(-1.f, 1.f);
if (rotationAngle() != Rotation0)
- t.rotate(-1.f * float(rotationAngle()));
+ t.rotate(float(rotationAngle()));
if (surfaceFormat().scanLineDirection() != QVideoFrameFormat::TopToBottom)
t.scale(1.f, -1.f);
diff --git a/src/multimedia/video/qvideowindow.cpp b/src/multimedia/video/qvideowindow.cpp
index f2a6d7037..9055b4167 100644
--- a/src/multimedia/video/qvideowindow.cpp
+++ b/src/multimedia/video/qvideowindow.cpp
@@ -103,27 +103,28 @@ QVideoWindowPrivate::~QVideoWindowPrivate()
}
static const float g_quad[] = {
- // 4 counterclockwise rotation of texture vertexes (the second pair)
+ // 4 clockwise rotation of texture vertexes (the second pair)
// Rotation 0
-1.f, -1.f, 0.f, 0.f,
-1.f, 1.f, 0.f, 1.f,
1.f, -1.f, 1.f, 0.f,
1.f, 1.f, 1.f, 1.f,
// Rotation 90
- -1.f, -1.f, 1.f, 0.f,
- -1.f, 1.f, 0.f, 0.f,
- 1.f, -1.f, 1.f, 1.f,
- 1.f, 1.f, 0.f, 1.f,
+ -1.f, -1.f, 0.f, 1.f,
+ -1.f, 1.f, 1.f, 1.f,
+ 1.f, -1.f, 0.f, 0.f,
+ 1.f, 1.f, 1.f, 0.f,
+
// Rotation 180
-1.f, -1.f, 1.f, 1.f,
-1.f, 1.f, 1.f, 0.f,
1.f, -1.f, 0.f, 1.f,
1.f, 1.f, 0.f, 0.f,
// Rotation 270
- -1.f, -1.f, 0.f, 1.f,
- -1.f, 1.f, 1.f, 1.f,
- 1.f, -1.f, 0.f, 0.f,
- 1.f, 1.f, 1.f, 0.f
+ -1.f, -1.f, 1.f, 0.f,
+ -1.f, 1.f, 0.f, 0.f,
+ 1.f, -1.f, 1.f, 1.f,
+ 1.f, 1.f, 0.f, 1.f
};
static QShader getShader(const QString &name)
diff --git a/src/multimediaquick/qsgvideonode_p.cpp b/src/multimediaquick/qsgvideonode_p.cpp
index 2327bcc54..000bda7b9 100644
--- a/src/multimediaquick/qsgvideonode_p.cpp
+++ b/src/multimediaquick/qsgvideonode_p.cpp
@@ -337,11 +337,11 @@ void QSGVideoNode::setTexturedRectGeometry(const QRectF &rect, const QRectF &tex
break;
case 90:
- // tr, tl, br, bl
- qSetTex(v + 0, textureRect.topRight());
- qSetTex(v + 1, textureRect.topLeft());
- qSetTex(v + 2, textureRect.bottomRight());
- qSetTex(v + 3, textureRect.bottomLeft());
+ // bl, br, tl, tr
+ qSetTex(v + 0, textureRect.bottomLeft());
+ qSetTex(v + 1, textureRect.bottomRight());
+ qSetTex(v + 2, textureRect.topLeft());
+ qSetTex(v + 3, textureRect.topRight());
break;
case 180:
@@ -353,11 +353,11 @@ void QSGVideoNode::setTexturedRectGeometry(const QRectF &rect, const QRectF &tex
break;
case 270:
- // bl, br, tl, tr
- qSetTex(v + 0, textureRect.bottomLeft());
- qSetTex(v + 1, textureRect.bottomRight());
- qSetTex(v + 2, textureRect.topLeft());
- qSetTex(v + 3, textureRect.topRight());
+ // tr, tl, br, bl
+ qSetTex(v + 0, textureRect.topRight());
+ qSetTex(v + 1, textureRect.topLeft());
+ qSetTex(v + 2, textureRect.bottomRight());
+ qSetTex(v + 3, textureRect.bottomLeft());
break;
}