VideoOutput: fix autoOrientation with a camera source.

Don't assume the camera frames are always in the same orientation as the
display in its primary orientation. We now take into account the camera
sensor position and orientation to calculate the viewport orientation.

Change-Id: Ib333c87f1804d1010ada42cb757e4fab78d75a04
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
Yoann Lopes
2014-02-03 21:38:56 +01:00
committed by The Qt Project
parent b28ee24628
commit f783c48a17
3 changed files with 28 additions and 2 deletions

View File

@@ -47,6 +47,7 @@
#include <QtCore/qsharedpointer.h>
#include <QtQuick/qquickitem.h>
#include <QtCore/qpointer.h>
#include <QtMultimedia/qcamerainfo.h>
#include <private/qtmultimediaquickdefs_p.h>
@@ -138,6 +139,7 @@ private:
QPointer<QObject> m_source;
QPointer<QMediaObject> m_mediaObject;
QPointer<QMediaService> m_service;
QCameraInfo m_cameraInfo;
FillMode m_fillMode;
QSize m_nativeSize;

View File

@@ -73,7 +73,7 @@ void QVideoOutputOrientationHandler::screenOrientationChanged(Qt::ScreenOrientat
const QScreen *screen = QGuiApplication::primaryScreen();
const QPlatformScreen *platformScreen = screen->handle();
const int angle = (360 - screen->angleBetween(platformScreen->nativeOrientation(), orientation));
const int angle = (360 - screen->angleBetween(platformScreen->nativeOrientation(), orientation)) % 360;
if (angle == m_currentOrientation)
return;