summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArtem Dyomin <artem.dyomin@qt.io>2024-01-11 12:30:45 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-01-15 14:15:26 +0000
commit56b1e8d36f51b716a363a8f220cc5c90b5a980c8 (patch)
treef25abf77bfa275da381f2fb64471a1a3bbe758b5 /src
parent1b942d605f4f1d75eb94084e06ebb3ffc601ad2e (diff)
Apply API review comments: rename QVideo::RotationAngle
API review: codereview.qt-project.org/c/qt/qtmultimedia/+/528314 We make the naming consisten with what we already have in another module: doc.qt.io/qt-6/qpdfdocumentrenderoptions.html#Rotation-enum Renamings: namespace QVideo -> namespace QtVideo RotationAngle -> Rotation Rotation::Rotation** -> Rotation::Clockwise** Change-Id: Ie59c30e788478dc4bc21b68a18102aece046960e Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 6aa3fa59fb845b20c19a6b043144072bf2c7363e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/multimedia/camera/qcameradevice.cpp6
-rw-r--r--src/multimedia/camera/qcameradevice.h4
-rw-r--r--src/multimedia/video/qvideo.cpp12
-rw-r--r--src/multimedia/video/qvideo.h6
-rw-r--r--src/multimedia/video/qvideoframe.cpp27
-rw-r--r--src/multimedia/video/qvideoframe.h27
-rw-r--r--src/multimedia/video/qvideoframeconverter.cpp12
-rw-r--r--src/multimedia/video/qvideoframeconverter_p.h2
-rw-r--r--src/multimedia/video/qvideowindow.cpp2
-rw-r--r--src/multimediaquick/qquickvideooutput.cpp2
-rw-r--r--src/multimediaquick/qsgvideonode_p.cpp9
-rw-r--r--src/plugins/multimedia/darwin/common/avfmetadata.mm2
-rw-r--r--src/plugins/multimedia/darwin/mediaplayer/avfmediaplayer.mm16
-rw-r--r--src/plugins/multimedia/darwin/mediaplayer/avfmediaplayer_p.h4
-rw-r--r--src/plugins/multimedia/darwin/mediaplayer/avfvideorenderercontrol.mm4
-rw-r--r--src/plugins/multimedia/darwin/mediaplayer/avfvideorenderercontrol_p.h4
-rw-r--r--src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder.cpp4
-rw-r--r--src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder_p.h2
-rw-r--r--src/plugins/multimedia/ffmpeg/playbackengine/qffmpegvideorenderer.cpp6
-rw-r--r--src/plugins/multimedia/ffmpeg/playbackengine/qffmpegvideorenderer_p.h4
-rw-r--r--src/plugins/multimedia/ffmpeg/qandroidcamera.cpp6
-rw-r--r--src/plugins/multimedia/ffmpeg/qandroidcamera_p.h2
-rw-r--r--src/plugins/multimedia/ffmpeg/qffmpegplaybackengine.cpp2
-rw-r--r--src/plugins/multimedia/gstreamer/common/qgstvideorenderersink.cpp14
-rw-r--r--src/plugins/multimedia/gstreamer/common/qgstvideorenderersink_p.h2
-rw-r--r--src/plugins/multimedia/windows/evr/evrcustompresenter.cpp10
26 files changed, 101 insertions, 90 deletions
diff --git a/src/multimedia/camera/qcameradevice.cpp b/src/multimedia/camera/qcameradevice.cpp
index eb280b94a..8e8c8c5c9 100644
--- a/src/multimedia/camera/qcameradevice.cpp
+++ b/src/multimedia/camera/qcameradevice.cpp
@@ -322,7 +322,7 @@ bool QCameraDevice::isDefault() const
/*!
\since 6.7
- \qmlproperty QVideo::RotationAngle QtMultimedia::cameraDevice::correctionAngle
+ \qmlproperty QtVideo::Rotation QtMultimedia::cameraDevice::correctionAngle
Returns the rotation angle needed to compensate for the physical camera rotation of the camera
compared to its native orientation. In other words, the property represents the clockwise angle
@@ -347,9 +347,9 @@ bool QCameraDevice::isDefault() const
\image camera_correctionAngle_90.png Example with 90 degrees \a correctionAngle
*/
-QVideo::RotationAngle QCameraDevice::correctionAngle() const
+QtVideo::Rotation QCameraDevice::correctionAngle() const
{
- return d ? QVideo::RotationAngle(d->orientation) : QVideo::Rotation0;
+ return d ? QtVideo::Rotation(d->orientation) : QtVideo::Rotation::None;
}
/*!
diff --git a/src/multimedia/camera/qcameradevice.h b/src/multimedia/camera/qcameradevice.h
index 190e9b9f2..402097f42 100644
--- a/src/multimedia/camera/qcameradevice.h
+++ b/src/multimedia/camera/qcameradevice.h
@@ -50,7 +50,7 @@ class Q_MULTIMEDIA_EXPORT QCameraDevice
Q_PROPERTY(bool isDefault READ isDefault CONSTANT)
Q_PROPERTY(Position position READ position CONSTANT)
Q_PROPERTY(QList<QCameraFormat> videoFormats READ videoFormats CONSTANT)
- Q_PROPERTY(QVideo::RotationAngle correctionAngle READ correctionAngle CONSTANT)
+ Q_PROPERTY(QtVideo::Rotation correctionAngle READ correctionAngle CONSTANT)
public:
QCameraDevice();
QCameraDevice(const QCameraDevice& other);
@@ -84,7 +84,7 @@ public:
QList<QSize> photoResolutions() const;
QList<QCameraFormat> videoFormats() const;
- QVideo::RotationAngle correctionAngle() const;
+ QtVideo::Rotation correctionAngle() const;
// ### Add zoom and other camera information
private:
diff --git a/src/multimedia/video/qvideo.cpp b/src/multimedia/video/qvideo.cpp
index 9d5af1d8f..3424b56d0 100644
--- a/src/multimedia/video/qvideo.cpp
+++ b/src/multimedia/video/qvideo.cpp
@@ -6,23 +6,23 @@
QT_BEGIN_NAMESPACE
/*!
- \namespace QVideo
+ \namespace QtVideo
\since 6.7
\inmodule QtMultimedia
\brief Enumerations for camera and video functionality.
*/
/*!
- \enum QVideo::RotationAngle
+ \enum QtVideo::Rotation
\since 6.7
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
+ \value None No rotation required, the frame has correct orientation
+ \value Clockwise90 The frame should be rotated clockwise by 90 degrees
+ \value Clockwise180 The frame should be rotated clockwise by 180 degrees
+ \value Clockwise270 The frame should be rotated clockwise by 270 degrees
*/
QT_END_NAMESPACE
diff --git a/src/multimedia/video/qvideo.h b/src/multimedia/video/qvideo.h
index cae6ee01c..1163d37c3 100644
--- a/src/multimedia/video/qvideo.h
+++ b/src/multimedia/video/qvideo.h
@@ -9,12 +9,12 @@
QT_BEGIN_NAMESPACE
-namespace QVideo
+namespace QtVideo
{
Q_NAMESPACE_EXPORT(Q_MULTIMEDIA_EXPORT)
-enum RotationAngle { Rotation0 = 0, Rotation90 = 90, Rotation180 = 180, Rotation270 = 270 };
-Q_ENUM_NS(RotationAngle)
+enum class Rotation { None = 0, Clockwise90 = 90, Clockwise180 = 180, Clockwise270 = 270 };
+Q_ENUM_NS(Rotation)
}
QT_END_NAMESPACE
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index 62d2f0fb8..d2ffc0140 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -45,7 +45,7 @@ public:
int mappedCount = 0;
QMutex mapMutex;
QString subtitleText;
- QVideo::RotationAngle rotationAngle = QVideo::Rotation0;
+ QtVideo::Rotation rotation = QtVideo::Rotation::None;
bool mirrored = false;
QImage image;
std::once_flag imageOnceFlag;
@@ -629,7 +629,7 @@ void QVideoFrame::setEndTime(qint64 time)
#if QT_DEPRECATED_SINCE(6, 7)
/*!
\enum QVideoFrame::RotationAngle
- \deprecated [6.7] Use QVideo::RotationAngle instead.
+ \deprecated [6.7] Use QtVideo::Rotation instead.
The angle of the clockwise rotation that should be applied to a video
frame before displaying.
@@ -641,30 +641,37 @@ void QVideoFrame::setEndTime(qint64 time)
*/
/*!
- \fn void QVideoFrame::setRotationAngle(QVideoFrame::RotationAngle)
- \deprecated [6.7] Use QVideoFrame::setRotationAngle(QVideo::RotationAngle) instead.
+ \fn void QVideoFrame::setRotationAngle(RotationAngle)
+ \deprecated [6.7] Use \c QVideoFrame::setRotation instead.
Sets the \a angle the frame should be rotated clockwise before displaying.
*/
+/*!
+ \fn RotationAngle QVideoFrame::rotationAngle()
+ \deprecated [6.7] Use \c QVideoFrame::rotation instead.
+
+ Returns the angle the frame should be rotated clockwise before displaying.
+*/
+
#endif
/*!
Sets the \a angle the frame should be rotated clockwise before displaying.
*/
-void QVideoFrame::setRotationAngle(QVideo::RotationAngle angle)
+void QVideoFrame::setRotation(QtVideo::Rotation angle)
{
if (d)
- d->rotationAngle = angle;
+ d->rotation = angle;
}
/*!
Returns the angle the frame should be rotated clockwise before displaying.
*/
-QVideoFrame::RotationAngle QVideoFrame::rotationAngle() const
+QtVideo::Rotation QVideoFrame::rotation() const
{
- return QVideoFrame::RotationAngle(d ? d->rotationAngle : QVideo::Rotation0);
+ return QtVideo::Rotation(d ? d->rotation : QtVideo::Rotation::None);
}
/*!
@@ -695,7 +702,7 @@ QImage QVideoFrame::toImage() const
std::call_once(d->imageOnceFlag, [this]() {
const bool mirrorY = surfaceFormat().scanLineDirection() != QVideoFrameFormat::TopToBottom;
- d->image = qImageFromVideoFrame(*this, QVideo::RotationAngle(rotationAngle()), mirrored(), mirrorY);
+ d->image = qImageFromVideoFrame(*this, rotation(), mirrored(), mirrorY);
});
return d->image;
@@ -736,7 +743,7 @@ void QVideoFrame::paint(QPainter *painter, const QRectF &rect, const PaintOption
QRectF targetRect = rect;
QSizeF size = this->size();
- if (rotationAngle() % 180)
+ if (qToUnderlying(rotation()) % 180)
size.transpose();
size.scale(targetRect.size(), options.aspectRatioMode);
diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h
index 04e3ad790..6d1a3dde0 100644
--- a/src/multimedia/video/qvideoframe.h
+++ b/src/multimedia/video/qvideoframe.h
@@ -41,6 +41,16 @@ public:
ReadWrite = ReadOnly | WriteOnly
};
+#if QT_DEPRECATED_SINCE(6, 7)
+ enum RotationAngle
+ {
+ Rotation0 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::Rotation::None instead") = 0,
+ Rotation90 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::Rotation::Clockwise90 instead") = 90,
+ Rotation180 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::Rotation::Clockwise180 instead") = 180,
+ Rotation270 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtVideo::Rotation::Clockwise270 instead") = 270
+ };
+#endif
+
QVideoFrame();
QVideoFrame(const QVideoFrameFormat &format);
QVideoFrame(const QVideoFrame &other);
@@ -90,20 +100,15 @@ public:
void setEndTime(qint64 time);
#if QT_DEPRECATED_SINCE(6, 7)
- enum RotationAngle
- {
- Rotation0 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QVideo::Rotation0 instead") = QVideo::Rotation0,
- Rotation90 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QVideo::Rotation90 instead") = QVideo::Rotation90,
- Rotation180 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QVideo::Rotation180 instead") = QVideo::Rotation180,
- Rotation270 Q_DECL_ENUMERATOR_DEPRECATED_X("Use QVideo::Rotation270 instead") = QVideo::Rotation270
- };
+ QT_DEPRECATED_VERSION_X_6_7("Use QVideoFrame::setRotation(QtVideo::Rotation) instead")
+ void setRotationAngle(RotationAngle angle) { setRotation(QtVideo::Rotation(angle)); }
- QT_DEPRECATED_VERSION_X_6_7("Use QVideoFrame::setRotationAngle(QVideo::RotationAngle) instead")
- void setRotationAngle(RotationAngle angle) { setRotationAngle(QVideo::RotationAngle(angle)); }
+ QT_DEPRECATED_VERSION_X_6_7("Use QVideoFrame::rotation() instead")
+ RotationAngle rotationAngle() const { return RotationAngle(rotation()); }
#endif
- void setRotationAngle(QVideo::RotationAngle);
- RotationAngle rotationAngle() const;
+ void setRotation(QtVideo::Rotation angle);
+ QtVideo::Rotation rotation() const;
void setMirrored(bool);
bool mirrored() const;
diff --git a/src/multimedia/video/qvideoframeconverter.cpp b/src/multimedia/video/qvideoframeconverter.cpp
index 2b4945c55..ca4a6ad92 100644
--- a/src/multimedia/video/qvideoframeconverter.cpp
+++ b/src/multimedia/video/qvideoframeconverter.cpp
@@ -114,13 +114,13 @@ static QShader vfcGetShader(const QString &name)
return shader;
}
-static void rasterTransform(QImage &image, QVideo::RotationAngle rotation,
+static void rasterTransform(QImage &image, QtVideo::Rotation rotation,
bool mirrorX, bool mirrorY)
{
QTransform t;
if (mirrorX)
t.scale(-1.f, 1.f);
- if (rotation != QVideo::Rotation0)
+ if (rotation != QtVideo::Rotation::None)
t.rotate(float(rotation));
if (mirrorY)
t.scale(1.f, -1.f);
@@ -249,7 +249,7 @@ static bool updateTextures(QRhi *rhi,
return true;
}
-static QImage convertJPEG(const QVideoFrame &frame, QVideo::RotationAngle rotation, bool mirrorX, bool mirrorY)
+static QImage convertJPEG(const QVideoFrame &frame, QtVideo::Rotation rotation, bool mirrorX, bool mirrorY)
{
QVideoFrame varFrame = frame;
if (!varFrame.map(QVideoFrame::ReadOnly)) {
@@ -263,7 +263,7 @@ static QImage convertJPEG(const QVideoFrame &frame, QVideo::RotationAngle rotati
return image;
}
-static QImage convertCPU(const QVideoFrame &frame, QVideo::RotationAngle rotation, bool mirrorX, bool mirrorY)
+static QImage convertCPU(const QVideoFrame &frame, QtVideo::Rotation rotation, bool mirrorX, bool mirrorY)
{
VideoFrameConvertFunc convert = qConverterForFormat(frame.pixelFormat());
if (!convert) {
@@ -284,7 +284,7 @@ static QImage convertCPU(const QVideoFrame &frame, QVideo::RotationAngle rotatio
}
}
-QImage qImageFromVideoFrame(const QVideoFrame &frame, QVideo::RotationAngle rotation, bool mirrorX, bool mirrorY)
+QImage qImageFromVideoFrame(const QVideoFrame &frame, QtVideo::Rotation rotation, bool mirrorX, bool mirrorY)
{
#ifdef Q_OS_DARWIN
QMacAutoReleasePool releasePool;
@@ -321,7 +321,7 @@ QImage qImageFromVideoFrame(const QVideoFrame &frame, QVideo::RotationAngle rota
// Do conversion using shaders
- const int rotationIndex = (rotation / 90) % 4;
+ const int rotationIndex = (qToUnderlying(rotation) / 90) % 4;
QSize frameSize = frame.size();
if (rotationIndex % 2)
diff --git a/src/multimedia/video/qvideoframeconverter_p.h b/src/multimedia/video/qvideoframeconverter_p.h
index a4eb4e764..73579ddd9 100644
--- a/src/multimedia/video/qvideoframeconverter_p.h
+++ b/src/multimedia/video/qvideoframeconverter_p.h
@@ -19,7 +19,7 @@
QT_BEGIN_NAMESPACE
-Q_MULTIMEDIA_EXPORT QImage qImageFromVideoFrame(const QVideoFrame &frame, QVideo::RotationAngle rotation = QVideo::Rotation0, bool mirrorX = false, bool mirrorY = false);
+Q_MULTIMEDIA_EXPORT QImage qImageFromVideoFrame(const QVideoFrame &frame, QtVideo::Rotation rotation = QtVideo::Rotation::None, bool mirrorX = false, bool mirrorY = false);
QT_END_NAMESPACE
diff --git a/src/multimedia/video/qvideowindow.cpp b/src/multimedia/video/qvideowindow.cpp
index b3b13945c..8ae6eb7ca 100644
--- a/src/multimedia/video/qvideowindow.cpp
+++ b/src/multimedia/video/qvideowindow.cpp
@@ -332,7 +332,7 @@ void QVideoWindowPrivate::render()
return;
}
- int frameRotationIndex = (m_currentFrame.rotationAngle() / 90) % 4;
+ const int frameRotationIndex = (static_cast<int>(m_currentFrame.rotation()) / 90) % 4;
QSize frameSize = m_currentFrame.size();
if (frameRotationIndex % 2)
frameSize.transpose();
diff --git a/src/multimediaquick/qquickvideooutput.cpp b/src/multimediaquick/qquickvideooutput.cpp
index a43a51a99..a009f6d01 100644
--- a/src/multimediaquick/qquickvideooutput.cpp
+++ b/src/multimediaquick/qquickvideooutput.cpp
@@ -534,7 +534,7 @@ void QQuickVideoOutput::setFrame(const QVideoFrame &frame)
m_videoFormat = frame.surfaceFormat();
m_frame = frame;
- m_frameOrientation = frame.rotationAngle();
+ m_frameOrientation = static_cast<int>(frame.rotation());
m_frameChanged = true;
}
diff --git a/src/multimediaquick/qsgvideonode_p.cpp b/src/multimediaquick/qsgvideonode_p.cpp
index fc8c19825..e4588ab7c 100644
--- a/src/multimediaquick/qsgvideonode_p.cpp
+++ b/src/multimediaquick/qsgvideonode_p.cpp
@@ -290,9 +290,10 @@ void QSGVideoNode::setSubtitleGeometry()
/* Update the vertices and texture coordinates. Orientation must be in {0,90,180,270} */
void QSGVideoNode::setTexturedRectGeometry(const QRectF &rect, const QRectF &textureRect, int orientation)
{
+ const auto currentFrameOrientation = m_material ? static_cast<int>(m_material->m_currentFrame.rotation()) : 0;
bool frameChanged = false;
if (m_material) {
- if (m_material->m_currentFrame.rotationAngle() != m_frameOrientation
+ if (currentFrameOrientation != m_frameOrientation
|| m_material->m_currentFrame.mirrored() != m_frameMirrored) {
frameChanged = true;
}
@@ -305,12 +306,10 @@ void QSGVideoNode::setTexturedRectGeometry(const QRectF &rect, const QRectF &tex
m_textureRect = textureRect;
m_orientation = orientation;
if (m_material) {
- m_frameOrientation = m_material->m_currentFrame.rotationAngle();
+ m_frameOrientation = currentFrameOrientation;
m_frameMirrored = m_material->m_currentFrame.mirrored();
}
- int videoRotation = orientation;
- videoRotation += m_material ? m_material->m_currentFrame.rotationAngle() : 0;
- videoRotation %= 360;
+ const int videoRotation = (orientation + currentFrameOrientation) % 360;
QSGGeometry *g = geometry();
diff --git a/src/plugins/multimedia/darwin/common/avfmetadata.mm b/src/plugins/multimedia/darwin/common/avfmetadata.mm
index 42eea975f..da07f69c6 100644
--- a/src/plugins/multimedia/darwin/common/avfmetadata.mm
+++ b/src/plugins/multimedia/darwin/common/avfmetadata.mm
@@ -261,7 +261,7 @@ QMediaMetaData AVFMetaData::fromAssetTrack(AVAssetTrack *asset)
if ([asset.mediaType isEqualToString:AVMediaTypeVideo]) {
// add orientation
if (metadata.value(QMediaMetaData::Orientation).isNull()) {
- QVideo::RotationAngle angle = QVideo::Rotation0;
+ QtVideo::Rotation angle = QtVideo::Rotation::None;
bool mirrored;
AVFMediaPlayer::videoOrientationForAssetTrack(asset, angle, mirrored);
Q_UNUSED(mirrored);
diff --git a/src/plugins/multimedia/darwin/mediaplayer/avfmediaplayer.mm b/src/plugins/multimedia/darwin/mediaplayer/avfmediaplayer.mm
index 02ef6b30f..b6d9622ac 100644
--- a/src/plugins/multimedia/darwin/mediaplayer/avfmediaplayer.mm
+++ b/src/plugins/multimedia/darwin/mediaplayer/avfmediaplayer.mm
@@ -559,7 +559,7 @@ void AVFMediaPlayer::setMedia(const QUrl &content, QIODevice *stream)
setVideoAvailable(false);
setSeekable(false);
m_requestedPosition = -1;
- orientationChanged(QVideo::Rotation0, false);
+ orientationChanged(QtVideo::Rotation::None, false);
Q_EMIT positionChanged(position());
if (m_duration != 0) {
m_duration = 0;
@@ -1096,7 +1096,7 @@ void AVFMediaPlayer::updateTracks()
if (m_observer.videoTrack != track) {
m_observer.videoTrack = track;
bool isMirrored = false;
- QVideo::RotationAngle orientation = QVideo::Rotation0;
+ QtVideo::Rotation orientation = QtVideo::Rotation::None;
videoOrientationForAssetTrack(assetTrack, orientation, isMirrored);
orientationChanged(orientation, isMirrored);
}
@@ -1186,7 +1186,7 @@ void AVFMediaPlayer::nativeSizeChanged(QSize size)
m_videoSink->setNativeSize(size);
}
-void AVFMediaPlayer::orientationChanged(QVideo::RotationAngle rotation, bool mirrored)
+void AVFMediaPlayer::orientationChanged(QtVideo::Rotation rotation, bool mirrored)
{
if (!m_videoOutput)
return;
@@ -1196,10 +1196,10 @@ void AVFMediaPlayer::orientationChanged(QVideo::RotationAngle rotation, bool mir
}
void AVFMediaPlayer::videoOrientationForAssetTrack(AVAssetTrack *videoTrack,
- QVideo::RotationAngle &angle,
+ QtVideo::Rotation &angle,
bool &mirrored)
{
- angle = QVideo::Rotation0;
+ angle = QtVideo::Rotation::None;
if (videoTrack) {
CGAffineTransform transform = videoTrack.preferredTransform;
if (CGAffineTransformIsIdentity(transform))
@@ -1222,11 +1222,11 @@ void AVFMediaPlayer::videoOrientationForAssetTrack(AVAssetTrack *videoTrack,
}
if (qFuzzyCompare(degrees, qreal(90)) || qFuzzyCompare(degrees, qreal(-270))) {
- angle = QVideo::Rotation90;
+ angle = QtVideo::Rotation::Clockwise90;
} else if (qFuzzyCompare(degrees, qreal(-90)) || qFuzzyCompare(degrees, qreal(270))) {
- angle = QVideo::Rotation270;
+ angle = QtVideo::Rotation::Clockwise270;
} else if (qFuzzyCompare(degrees, qreal(180)) || qFuzzyCompare(degrees, qreal(-180))) {
- angle = QVideo::Rotation180;
+ angle = QtVideo::Rotation::Clockwise180;
}
}
}
diff --git a/src/plugins/multimedia/darwin/mediaplayer/avfmediaplayer_p.h b/src/plugins/multimedia/darwin/mediaplayer/avfmediaplayer_p.h
index a82ea4a78..d04ab0818 100644
--- a/src/plugins/multimedia/darwin/mediaplayer/avfmediaplayer_p.h
+++ b/src/plugins/multimedia/darwin/mediaplayer/avfmediaplayer_p.h
@@ -74,7 +74,7 @@ public:
QMediaMetaData metaData() const override;
static void videoOrientationForAssetTrack(AVAssetTrack *track,
- QVideo::RotationAngle &angle,
+ QtVideo::Rotation &angle,
bool &mirrored);
public Q_SLOTS:
@@ -121,7 +121,7 @@ private:
void setSeekable(bool seekable);
void resetStream(QIODevice *stream = nullptr);
- void orientationChanged(QVideo::RotationAngle rotation, bool mirrored);
+ void orientationChanged(QtVideo::Rotation rotation, bool mirrored);
AVFVideoRendererControl *m_videoOutput = nullptr;
AVFVideoSink *m_videoSink = nullptr;
diff --git a/src/plugins/multimedia/darwin/mediaplayer/avfvideorenderercontrol.mm b/src/plugins/multimedia/darwin/mediaplayer/avfvideorenderercontrol.mm
index d8e7b5dd1..002d688eb 100644
--- a/src/plugins/multimedia/darwin/mediaplayer/avfvideorenderercontrol.mm
+++ b/src/plugins/multimedia/darwin/mediaplayer/avfvideorenderercontrol.mm
@@ -118,7 +118,7 @@ void AVFVideoRendererControl::setLayer(CALayer *layer)
AVFVideoSinkInterface::setLayer(layer);
}
-void AVFVideoRendererControl::setVideoRotation(QVideo::RotationAngle rotation)
+void AVFVideoRendererControl::setVideoRotation(QtVideo::Rotation rotation)
{
m_rotation = rotation;
}
@@ -153,7 +153,7 @@ void AVFVideoRendererControl::updateVideoFrame(const CVTimeStamp &ts)
CVPixelBufferRelease(pixelBuffer);
frame = QVideoFrame(buffer, buffer->videoFormat());
- frame.setRotationAngle(m_rotation);
+ frame.setRotation(m_rotation);
frame.setMirrored(m_mirrored);
m_sink->setVideoFrame(frame);
}
diff --git a/src/plugins/multimedia/darwin/mediaplayer/avfvideorenderercontrol_p.h b/src/plugins/multimedia/darwin/mediaplayer/avfvideorenderercontrol_p.h
index b06e8d354..177114127 100644
--- a/src/plugins/multimedia/darwin/mediaplayer/avfvideorenderercontrol_p.h
+++ b/src/plugins/multimedia/darwin/mediaplayer/avfvideorenderercontrol_p.h
@@ -44,7 +44,7 @@ public:
void reconfigure() override;
void setLayer(CALayer *layer) override;
- void setVideoRotation(QVideo::RotationAngle);
+ void setVideoRotation(QtVideo::Rotation);
void setVideoMirrored(bool mirrored);
void setSubtitleText(const QString &subtitle)
@@ -63,7 +63,7 @@ private:
AVPlayerItemVideoOutput *m_videoOutput = nullptr;
AVPlayerItemLegibleOutput *m_subtitleOutput = nullptr;
SubtitleDelegate *m_subtitleDelegate = nullptr;
- QVideo::RotationAngle m_rotation = QVideo::Rotation0;
+ QtVideo::Rotation m_rotation = QtVideo::Rotation::None;
bool m_mirrored = false;
};
diff --git a/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder.cpp b/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder.cpp
index b48396f16..2871b2448 100644
--- a/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder.cpp
+++ b/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder.cpp
@@ -64,10 +64,10 @@ static int streamOrientation(const AVStream *stream)
return rotation < 0 ? -rotation % 360 : -rotation % 360 + 360;
}
-QVideo::RotationAngle MediaDataHolder::getRotationAngle() const
+QtVideo::Rotation MediaDataHolder::rotation() const
{
int orientation = m_metaData.value(QMediaMetaData::Orientation).toInt();
- return static_cast<QVideo::RotationAngle>(orientation);
+ return static_cast<QtVideo::Rotation>(orientation);
}
AVFormatContext *MediaDataHolder::avContext()
diff --git a/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder_p.h b/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder_p.h
index 34d5cced2..a55b0766a 100644
--- a/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder_p.h
+++ b/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegmediadataholder_p.h
@@ -70,7 +70,7 @@ public:
bool isSeekable() const { return m_isSeekable; }
- QVideo::RotationAngle getRotationAngle() const;
+ QtVideo::Rotation rotation() const;
AVFormatContext *avContext();
diff --git a/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegvideorenderer.cpp b/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegvideorenderer.cpp
index 8b7defc31..7c8e90552 100644
--- a/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegvideorenderer.cpp
+++ b/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegvideorenderer.cpp
@@ -9,8 +9,8 @@ QT_BEGIN_NAMESPACE
namespace QFFmpeg {
-VideoRenderer::VideoRenderer(const TimeController &tc, QVideoSink *sink, QVideo::RotationAngle rotationAngle)
- : Renderer(tc), m_sink(sink), m_rotationAngle(rotationAngle)
+VideoRenderer::VideoRenderer(const TimeController &tc, QVideoSink *sink, QtVideo::Rotation rotation)
+ : Renderer(tc), m_sink(sink), m_rotation(rotation)
{
}
@@ -65,7 +65,7 @@ VideoRenderer::RenderingResult VideoRenderer::renderInternal(Frame frame)
QVideoFrame videoFrame(buffer.release(), format);
videoFrame.setStartTime(frame.pts());
videoFrame.setEndTime(frame.end());
- videoFrame.setRotationAngle(m_rotationAngle);
+ videoFrame.setRotation(m_rotation);
m_sink->setVideoFrame(videoFrame);
return {};
diff --git a/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegvideorenderer_p.h b/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegvideorenderer_p.h
index 6c130f91d..4866420e8 100644
--- a/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegvideorenderer_p.h
+++ b/src/plugins/multimedia/ffmpeg/playbackengine/qffmpegvideorenderer_p.h
@@ -28,7 +28,7 @@ class VideoRenderer : public Renderer
{
Q_OBJECT
public:
- VideoRenderer(const TimeController &tc, QVideoSink *sink, QVideo::RotationAngle rotationAngle);
+ VideoRenderer(const TimeController &tc, QVideoSink *sink, QtVideo::Rotation rotation);
void setOutput(QVideoSink *sink, bool cleanPrevSink = false);
@@ -37,7 +37,7 @@ protected:
private:
QPointer<QVideoSink> m_sink;
- QVideo::RotationAngle m_rotationAngle;
+ QtVideo::Rotation m_rotation;
};
} // namespace QFFmpeg
diff --git a/src/plugins/multimedia/ffmpeg/qandroidcamera.cpp b/src/plugins/multimedia/ffmpeg/qandroidcamera.cpp
index 0c7c65aba..d2bfe9969 100644
--- a/src/plugins/multimedia/ffmpeg/qandroidcamera.cpp
+++ b/src/plugins/multimedia/ffmpeg/qandroidcamera.cpp
@@ -201,7 +201,7 @@ void QAndroidCamera::frameAvailable(QJniObject image, bool takePhoto)
if (lastTimestamp == 0)
lastTimestamp = timestamp;
- videoFrame.setRotationAngle(rotation());
+ videoFrame.setRotation(rotation());
videoFrame.setMirrored(m_cameraDevice.position() == QCameraDevice::Position::FrontFace);
videoFrame.setStartTime(lastTimestamp);
@@ -215,7 +215,7 @@ void QAndroidCamera::frameAvailable(QJniObject image, bool takePhoto)
lastTimestamp = timestamp;
}
-QVideo::RotationAngle QAndroidCamera::rotation()
+QtVideo::Rotation QAndroidCamera::rotation()
{
auto screen = QGuiApplication::primaryScreen();
auto screenOrientation = screen->orientation();
@@ -243,7 +243,7 @@ QVideo::RotationAngle QAndroidCamera::rotation()
int sign = (m_cameraDevice.position() == QCameraDevice::Position::FrontFace) ? 1 : -1;
int rotation = (sensorOrientation(m_cameraDevice.id()) - deviceOrientation * sign + 360) % 360;
- return QVideo::RotationAngle(rotation);
+ return QtVideo::Rotation(rotation);
}
void QAndroidCamera::setActive(bool active)
diff --git a/src/plugins/multimedia/ffmpeg/qandroidcamera_p.h b/src/plugins/multimedia/ffmpeg/qandroidcamera_p.h
index 71099d2cf..26606a7e0 100644
--- a/src/plugins/multimedia/ffmpeg/qandroidcamera_p.h
+++ b/src/plugins/multimedia/ffmpeg/qandroidcamera_p.h
@@ -68,7 +68,7 @@ private:
bool isActivating() const { return m_state != State::Closed; }
void setState(State newState);
- QVideo::RotationAngle rotation();
+ QtVideo::Rotation rotation();
void updateCameraCharacteristics();
void cleanCameraCharacteristics();
diff --git a/src/plugins/multimedia/ffmpeg/qffmpegplaybackengine.cpp b/src/plugins/multimedia/ffmpeg/qffmpegplaybackengine.cpp
index ce4b49f96..2dc5fcd28 100644
--- a/src/plugins/multimedia/ffmpeg/qffmpegplaybackengine.cpp
+++ b/src/plugins/multimedia/ffmpeg/qffmpegplaybackengine.cpp
@@ -197,7 +197,7 @@ PlaybackEngine::createRenderer(QPlatformMediaPlayer::TrackType trackType)
switch (trackType) {
case QPlatformMediaPlayer::VideoStream:
return m_videoSink
- ? createPlaybackEngineObject<VideoRenderer>(m_timeController, m_videoSink, m_media.getRotationAngle())
+ ? createPlaybackEngineObject<VideoRenderer>(m_timeController, m_videoSink, m_media.rotation())
: RendererPtr{ {}, {} };
case QPlatformMediaPlayer::AudioStream:
return m_audioOutput
diff --git a/src/plugins/multimedia/gstreamer/common/qgstvideorenderersink.cpp b/src/plugins/multimedia/gstreamer/common/qgstvideorenderersink.cpp
index c855f33cb..8d2c9abe9 100644
--- a/src/plugins/multimedia/gstreamer/common/qgstvideorenderersink.cpp
+++ b/src/plugins/multimedia/gstreamer/common/qgstvideorenderersink.cpp
@@ -122,7 +122,7 @@ bool QGstVideoRenderer::start(const QGstCaps& caps)
QMutexLocker locker(&m_mutex);
m_frameMirrored = false;
- m_frameRotationAngle = QVideo::Rotation0;
+ m_frameRotationAngle = QtVideo::Rotation::None;
if (m_active) {
m_flush = true;
@@ -264,11 +264,11 @@ void QGstVideoRenderer::gstEvent(GstEvent *event)
QMutexLocker locker(&m_mutex);
m_frameMirrored = mirrored;
switch (rotationAngle) {
- case 0: m_frameRotationAngle = QVideo::Rotation0; break;
- case 90: m_frameRotationAngle = QVideo::Rotation90; break;
- case 180: m_frameRotationAngle = QVideo::Rotation180; break;
- case 270: m_frameRotationAngle = QVideo::Rotation270; break;
- default: m_frameRotationAngle = QVideo::Rotation0;
+ case 0: m_frameRotationAngle = QtVideo::Rotation::None; break;
+ case 90: m_frameRotationAngle = QtVideo::Rotation::Clockwise90; break;
+ case 180: m_frameRotationAngle = QtVideo::Rotation::Clockwise180; break;
+ case 270: m_frameRotationAngle = QtVideo::Rotation::Clockwise270; break;
+ default: m_frameRotationAngle = QtVideo::Rotation::None;
}
}
@@ -357,7 +357,7 @@ bool QGstVideoRenderer::handleEvent(QMutexLocker<QMutex> *locker)
QVideoFrame frame(videoBuffer, m_format);
QGstUtils::setFrameTimeStamps(&frame, buffer);
frame.setMirrored(m_frameMirrored);
- frame.setRotationAngle(m_frameRotationAngle);
+ frame.setRotation(m_frameRotationAngle);
qCDebug(qLcGstVideoRenderer) << " sending video frame";
m_sink->setVideoFrame(frame);
diff --git a/src/plugins/multimedia/gstreamer/common/qgstvideorenderersink_p.h b/src/plugins/multimedia/gstreamer/common/qgstvideorenderersink_p.h
index 08895e3ee..5dd7de4b8 100644
--- a/src/plugins/multimedia/gstreamer/common/qgstvideorenderersink_p.h
+++ b/src/plugins/multimedia/gstreamer/common/qgstvideorenderersink_p.h
@@ -81,7 +81,7 @@ private:
bool m_stop = false;
bool m_flush = false;
bool m_frameMirrored = false;
- QVideo::RotationAngle m_frameRotationAngle = QVideo::Rotation0;
+ QtVideo::Rotation m_frameRotationAngle = QtVideo::Rotation::None;
// --- only accessed from one thread
QVideoFrameFormat m_format;
diff --git a/src/plugins/multimedia/windows/evr/evrcustompresenter.cpp b/src/plugins/multimedia/windows/evr/evrcustompresenter.cpp
index a98ca703b..423f47779 100644
--- a/src/plugins/multimedia/windows/evr/evrcustompresenter.cpp
+++ b/src/plugins/multimedia/windows/evr/evrcustompresenter.cpp
@@ -1795,11 +1795,11 @@ void EVRCustomPresenter::presentSample(const ComPtr<IMFSample> &sample)
if (SUCCEEDED(m_mixer->GetInputCurrentType(0, inputStreamType.GetAddressOf()))) {
auto rotation = static_cast<MFVideoRotationFormat>(MFGetAttributeUINT32(inputStreamType.Get(), MF_MT_VIDEO_ROTATION, 0));
switch (rotation) {
- case MFVideoRotationFormat_0: frame.setRotationAngle(QVideo::Rotation0); break;
- case MFVideoRotationFormat_90: frame.setRotationAngle(QVideo::Rotation90); break;
- case MFVideoRotationFormat_180: frame.setRotationAngle(QVideo::Rotation180); break;
- case MFVideoRotationFormat_270: frame.setRotationAngle(QVideo::Rotation270); break;
- default: frame.setRotationAngle(QVideo::Rotation0);
+ case MFVideoRotationFormat_0: frame.setRotation(QtVideo::Rotation::None); break;
+ case MFVideoRotationFormat_90: frame.setRotation(QtVideo::Rotation::Clockwise90); break;
+ case MFVideoRotationFormat_180: frame.setRotation(QtVideo::Rotation::Clockwise180); break;
+ case MFVideoRotationFormat_270: frame.setRotation(QtVideo::Rotation::Clockwise270); break;
+ default: frame.setRotation(QtVideo::Rotation::None);
}
}