summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2010-03-19 00:38:12 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2010-03-19 00:38:12 (GMT)
commit6d727e0f88b82173fd1837fade7cfcd25dbbef4f (patch)
treee4166ece16cd4a2942d69c52b3794fe5acd82db2
parent0fbbd8496e248aabbbdf11d9243b891f24f6b9f2 (diff)
parentde300d7a41b0e428ba11e6061c39580c54012dc9 (diff)
downloadQt-6d727e0f88b82173fd1837fade7cfcd25dbbef4f.zip
Qt-6d727e0f88b82173fd1837fade7cfcd25dbbef4f.tar.gz
Qt-6d727e0f88b82173fd1837fade7cfcd25dbbef4f.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
-rw-r--r--src/multimedia/base/qvideowidget.cpp87
-rw-r--r--src/multimedia/base/qvideowidget.h9
-rw-r--r--src/multimedia/base/qvideowidget_p.h34
-rw-r--r--src/multimedia/base/qvideowidgetcontrol.cpp2
-rw-r--r--src/multimedia/base/qvideowidgetcontrol.h4
-rw-r--r--src/multimedia/base/qvideowindowcontrol.cpp4
-rw-r--r--src/multimedia/base/qvideowindowcontrol.h4
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp12
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h4
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp10
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h6
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp6
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h6
-rw-r--r--src/plugins/mediaservices/qt7/qt7movievideowidget.h6
-rw-r--r--src/plugins/mediaservices/qt7/qt7movievideowidget.mm14
-rw-r--r--src/plugins/mediaservices/qt7/qt7movieviewoutput.h6
-rw-r--r--src/plugins/mediaservices/qt7/qt7movieviewoutput.mm8
-rw-r--r--tests/auto/qvideowidget/tst_qvideowidget.cpp84
18 files changed, 160 insertions, 146 deletions
diff --git a/src/multimedia/base/qvideowidget.cpp b/src/multimedia/base/qvideowidget.cpp
index aabfefc..3820af9 100644
--- a/src/multimedia/base/qvideowidget.cpp
+++ b/src/multimedia/base/qvideowidget.cpp
@@ -105,12 +105,12 @@ void QVideoWidgetControlBackend::setFullScreen(bool fullScreen)
}
-QVideoWidget::AspectRatioMode QVideoWidgetControlBackend::aspectRatioMode() const
+Qt::AspectRatioMode QVideoWidgetControlBackend::aspectRatioMode() const
{
return m_widgetControl->aspectRatioMode();
}
-void QVideoWidgetControlBackend::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QVideoWidgetControlBackend::setAspectRatioMode(Qt::AspectRatioMode mode)
{
m_widgetControl->setAspectRatioMode(mode);
}
@@ -120,16 +120,16 @@ QRendererVideoWidgetBackend::QRendererVideoWidgetBackend(
: m_rendererControl(control)
, m_widget(widget)
, m_surface(new QPainterVideoSurface)
- , m_aspectRatioMode(QVideoWidget::KeepAspectRatio)
+ , m_aspectRatioMode(Qt::KeepAspectRatio)
, m_updatePaintDevice(true)
{
connect(this, SIGNAL(brightnessChanged(int)), m_widget, SLOT(_q_brightnessChanged(int)));
connect(this, SIGNAL(contrastChanged(int)), m_widget, SLOT(_q_contrastChanged(int)));
connect(this, SIGNAL(hueChanged(int)), m_widget, SLOT(_q_hueChanged(int)));
connect(this, SIGNAL(saturationChanged(int)), m_widget, SLOT(_q_saturationChanged(int)));
- connect(m_surface, SIGNAL(frameChanged()), m_widget, SLOT(update()));
+ connect(m_surface, SIGNAL(frameChanged()), this, SLOT(frameChanged()));
connect(m_surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
- m_widget, SLOT(_q_dimensionsChanged()));
+ this, SLOT(formatChanged(QVideoSurfaceFormat)));
m_rendererControl->setSurface(m_surface);
}
@@ -172,12 +172,12 @@ void QRendererVideoWidgetBackend::setSaturation(int saturation)
emit saturationChanged(saturation);
}
-QVideoWidget::AspectRatioMode QRendererVideoWidgetBackend::aspectRatioMode() const
+Qt::AspectRatioMode QRendererVideoWidgetBackend::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QRendererVideoWidgetBackend::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QRendererVideoWidgetBackend::setAspectRatioMode(Qt::AspectRatioMode mode)
{
m_aspectRatioMode = mode;
@@ -207,6 +207,7 @@ void QRendererVideoWidgetBackend::hideEvent(QHideEvent *)
void QRendererVideoWidgetBackend::resizeEvent(QResizeEvent *)
{
+ updateRects();
}
void QRendererVideoWidgetBackend::moveEvent(QMoveEvent *)
@@ -217,8 +218,8 @@ void QRendererVideoWidgetBackend::paintEvent(QPaintEvent *event)
{
QPainter painter(m_widget);
- if (m_surface->isActive()) {
- m_surface->paint(&painter, displayRect());
+ if (m_surface->isActive() && m_boundingRect.intersects(event->rect())) {
+ m_surface->paint(&painter, m_boundingRect, m_sourceRect);
m_surface->setReady(true);
} else {
@@ -240,33 +241,53 @@ void QRendererVideoWidgetBackend::paintEvent(QPaintEvent *event)
}
}
-QRect QRendererVideoWidgetBackend::displayRect() const
+void QRendererVideoWidgetBackend::formatChanged(const QVideoSurfaceFormat &format)
{
- QRect displayRect = m_widget->rect();
+ m_nativeSize = format.sizeHint();
- if (m_aspectRatioMode != QVideoWidget::IgnoreAspectRatio) {
- QVideoSurfaceFormat format = m_surface->surfaceFormat();
+ updateRects();
- QSize aspectRatio = format.pixelAspectRatio();
+ m_widget->updateGeometry();
+}
+
+void QRendererVideoWidgetBackend::frameChanged()
+{
+ m_widget->update(m_boundingRect);
+}
+
+void QRendererVideoWidgetBackend::updateRects()
+{
+ QRect rect = m_widget->rect();
- QSize size = format.viewport().size();
- size.rwidth() *= aspectRatio.width();
- size.rheight() *= aspectRatio.height();
- size.scale(displayRect.size(), Qt::KeepAspectRatio);
+ if (m_nativeSize.isEmpty()) {
+ m_boundingRect = QRect();
+ } else if (m_aspectRatioMode == Qt::IgnoreAspectRatio) {
+ m_boundingRect = rect;
+ m_sourceRect = QRectF(0, 0, 1, 1);
+ } else if (m_aspectRatioMode == Qt::KeepAspectRatio) {
+ QSize size = m_nativeSize;
+ size.scale(rect.size(), Qt::KeepAspectRatio);
- QPoint center = displayRect.center();
+ m_boundingRect = QRect(0, 0, size.width(), size.height());
+ m_boundingRect.moveCenter(rect.center());
- displayRect = QRect(QPoint(0, 0), size);
- displayRect.moveCenter(center);
- }
+ m_sourceRect = QRectF(0, 0, 1, 1);
+ } else if (m_aspectRatioMode == Qt::KeepAspectRatioByExpanding) {
+ m_boundingRect = rect;
- return displayRect;
+ QSizeF size = rect.size();
+ size.scale(m_nativeSize, Qt::KeepAspectRatio);
+
+ m_sourceRect = QRectF(
+ 0, 0, size.width() / m_nativeSize.width(), size.height() / m_nativeSize.height());
+ m_sourceRect.moveCenter(QPointF(0.5, 0.5));
+ }
}
QWindowVideoWidgetBackend::QWindowVideoWidgetBackend(QVideoWindowControl *control, QWidget *widget)
: m_windowControl(control)
, m_widget(widget)
- , m_aspectRatioMode(QVideoWidget::KeepAspectRatio)
+ , m_aspectRatioMode(Qt::KeepAspectRatio)
{
connect(control, SIGNAL(brightnessChanged(int)), m_widget, SLOT(_q_brightnessChanged(int)));
connect(control, SIGNAL(contrastChanged(int)), m_widget, SLOT(_q_contrastChanged(int)));
@@ -305,12 +326,12 @@ void QWindowVideoWidgetBackend::setFullScreen(bool fullScreen)
m_windowControl->setFullScreen(fullScreen);
}
-QVideoWidget::AspectRatioMode QWindowVideoWidgetBackend::aspectRatioMode() const
+Qt::AspectRatioMode QWindowVideoWidgetBackend::aspectRatioMode() const
{
return m_windowControl->aspectRatioMode();
}
-void QWindowVideoWidgetBackend::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QWindowVideoWidgetBackend::setAspectRatioMode(Qt::AspectRatioMode mode)
{
m_windowControl->setAspectRatioMode(mode);
}
@@ -515,16 +536,6 @@ void QVideoWidgetPrivate::_q_dimensionsChanged()
*/
/*!
- \enum QVideoWidget::AspectRatioMode
-
- Specfies how video is scaled with respect to its aspect ratio.
-
- \value IgnoreAspectRatio The video is scaled to fill the widget ignoring its aspect ratio.
- \value KeepAspectRatio The video is scaled to the largest rectangle that will fit within the
- widget's dimensions while still retaining its original aspect ratio.
-*/
-
-/*!
Constructs a new video widget.
The \a parent is passed to QWidget.
@@ -617,12 +628,12 @@ void QVideoWidget::setMediaObject(QMediaObject *object)
\brief how video is scaled with respect to its aspect ratio.
*/
-QVideoWidget::AspectRatioMode QVideoWidget::aspectRatioMode() const
+Qt::AspectRatioMode QVideoWidget::aspectRatioMode() const
{
return d_func()->aspectRatioMode;
}
-void QVideoWidget::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QVideoWidget::setAspectRatioMode(Qt::AspectRatioMode mode)
{
Q_D(QVideoWidget);
diff --git a/src/multimedia/base/qvideowidget.h b/src/multimedia/base/qvideowidget.h
index 4e6cf2e..4b24bcb 100644
--- a/src/multimedia/base/qvideowidget.h
+++ b/src/multimedia/base/qvideowidget.h
@@ -60,16 +60,13 @@ class Q_MULTIMEDIA_EXPORT QVideoWidget : public QWidget
Q_OBJECT
Q_PROPERTY(QMediaObject* mediaObject READ mediaObject WRITE setMediaObject)
Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged)
- Q_PROPERTY(AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode NOTIFY aspectRatioModeChanged)
+ Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode NOTIFY aspectRatioModeChanged)
Q_PROPERTY(int brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
Q_PROPERTY(int contrast READ contrast WRITE setContrast NOTIFY contrastChanged)
Q_PROPERTY(int hue READ hue WRITE setHue NOTIFY hueChanged)
Q_PROPERTY(int saturation READ saturation WRITE setSaturation NOTIFY saturationChanged)
- Q_ENUMS(AspectRatio)
public:
- enum AspectRatioMode { IgnoreAspectRatio, KeepAspectRatio };
-
QVideoWidget(QWidget *parent = 0);
~QVideoWidget();
@@ -80,7 +77,7 @@ public:
bool isFullScreen() const;
#endif
- AspectRatioMode aspectRatioMode() const;
+ Qt::AspectRatioMode aspectRatioMode() const;
int brightness() const;
int contrast() const;
@@ -91,7 +88,7 @@ public:
public Q_SLOTS:
void setFullScreen(bool fullScreen);
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
void setBrightness(int brightness);
void setContrast(int contrast);
void setHue(int hue);
diff --git a/src/multimedia/base/qvideowidget_p.h b/src/multimedia/base/qvideowidget_p.h
index 4227afd..44fd1cd 100644
--- a/src/multimedia/base/qvideowidget_p.h
+++ b/src/multimedia/base/qvideowidget_p.h
@@ -78,8 +78,8 @@ public:
virtual void setFullScreen(bool fullScreen) = 0;
- virtual QVideoWidget::AspectRatioMode aspectRatioMode() const = 0;
- virtual void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) = 0;
+ virtual Qt::AspectRatioMode aspectRatioMode() const = 0;
+ virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0;
};
class QVideoWidgetBackend : public QObject, public QVideoWidgetControlInterface
@@ -111,8 +111,8 @@ public:
void setFullScreen(bool fullScreen);
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
private:
QVideoWidgetControl *m_widgetControl;
@@ -137,8 +137,8 @@ public:
void setFullScreen(bool fullScreen);
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
QSize sizeHint() const;
@@ -155,14 +155,20 @@ Q_SIGNALS:
void hueChanged(int hue);
void saturationChanged(int saturation);
+private Q_SLOTS:
+ void formatChanged(const QVideoSurfaceFormat &format);
+ void frameChanged();
+
private:
- QRect displayRect() const;
+ void updateRects();
QVideoRendererControl *m_rendererControl;
QWidget *m_widget;
QPainterVideoSurface *m_surface;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
- QSize m_aspectRatio;
+ Qt::AspectRatioMode m_aspectRatioMode;
+ QRect m_boundingRect;
+ QRectF m_sourceRect;
+ QSize m_nativeSize;
bool m_updatePaintDevice;
};
@@ -182,8 +188,8 @@ public:
void setFullScreen(bool fullScreen);
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
QSize sizeHint() const;
@@ -196,7 +202,7 @@ public:
private:
QVideoWindowControl *m_windowControl;
QWidget *m_widget;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
QSize m_pixelAspectRatio;
};
@@ -221,7 +227,7 @@ public:
, contrast(0)
, hue(0)
, saturation(0)
- , aspectRatioMode(QVideoWidget::KeepAspectRatio)
+ , aspectRatioMode(Qt::KeepAspectRatio)
, nonFullScreenFlags(0)
, wasFullScreen(false)
{
@@ -240,7 +246,7 @@ public:
int contrast;
int hue;
int saturation;
- QVideoWidget::AspectRatioMode aspectRatioMode;
+ Qt::AspectRatioMode aspectRatioMode;
Qt::WindowFlags nonFullScreenFlags;
bool wasFullScreen;
diff --git a/src/multimedia/base/qvideowidgetcontrol.cpp b/src/multimedia/base/qvideowidgetcontrol.cpp
index c53c77b..e8957dc 100644
--- a/src/multimedia/base/qvideowidgetcontrol.cpp
+++ b/src/multimedia/base/qvideowidgetcontrol.cpp
@@ -126,7 +126,7 @@ QVideoWidgetControl::~QVideoWidgetControl()
*/
/*!
- \fn QVideoWidgetControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+ \fn QVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode)
Sets the aspect ratio \a mode which determines how video is scaled to the fit the widget with
respect to its aspect ratio.
diff --git a/src/multimedia/base/qvideowidgetcontrol.h b/src/multimedia/base/qvideowidgetcontrol.h
index 6981e89..4c0a6c6 100644
--- a/src/multimedia/base/qvideowidgetcontrol.h
+++ b/src/multimedia/base/qvideowidgetcontrol.h
@@ -66,8 +66,8 @@ public:
virtual QWidget *videoWidget() = 0;
- virtual QVideoWidget::AspectRatioMode aspectRatioMode() const = 0;
- virtual void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) = 0;
+ virtual Qt::AspectRatioMode aspectRatioMode() const = 0;
+ virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0;
virtual bool isFullScreen() const = 0;
virtual void setFullScreen(bool fullScreen) = 0;
diff --git a/src/multimedia/base/qvideowindowcontrol.cpp b/src/multimedia/base/qvideowindowcontrol.cpp
index da46823..c74a0d5 100644
--- a/src/multimedia/base/qvideowindowcontrol.cpp
+++ b/src/multimedia/base/qvideowindowcontrol.cpp
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
QVideoWindowControl *windowControl = mediaService->control<QVideoWindowControl *>();
windowControl->setWinId(widget->winId());
windowControl->setDisplayRect(widget->rect());
- windowControl->setAspectRatioMode(QVideoWidget::KeepAspectRatio);
+ windowControl->setAspectRatioMode(Qt::KeepAspectRatio);
\endcode
QVideoWindowControl is one of number of possible video output controls,
@@ -176,7 +176,7 @@ QVideoWindowControl::~QVideoWindowControl()
*/
/*!
- \fn QVideoWindowControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+ \fn QVideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode)
Sets the aspect ratio \a mode which determines how video is scaled to the fit the display region
with respect to its aspect ratio.
diff --git a/src/multimedia/base/qvideowindowcontrol.h b/src/multimedia/base/qvideowindowcontrol.h
index 9ee96ab..53f7b0e 100644
--- a/src/multimedia/base/qvideowindowcontrol.h
+++ b/src/multimedia/base/qvideowindowcontrol.h
@@ -74,8 +74,8 @@ public:
virtual QSize nativeSize() const = 0;
- virtual QVideoWidget::AspectRatioMode aspectRatioMode() const = 0;
- virtual void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) = 0;
+ virtual Qt::AspectRatioMode aspectRatioMode() const = 0;
+ virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0;
virtual int brightness() const = 0;
virtual void setBrightness(int brightness) = 0;
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
index b1ddd98..4b9aeb8 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
@@ -162,30 +162,30 @@ QSize Vmr9VideoWindowControl::nativeSize() const
return size;
}
-QVideoWidget::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const
+Qt::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const
{
- QVideoWidget::AspectRatioMode mode = QVideoWidget::KeepAspectRatio;
+ Qt::AspectRatioMode mode = Qt::KeepAspectRatio;
if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
m_filter, IID_IVMRWindowlessControl9)) {
DWORD arMode;
if (control->GetAspectRatioMode(&arMode) == S_OK && arMode == VMR9ARMode_None)
- mode = QVideoWidget::IgnoreAspectRatio;
+ mode = Qt::IgnoreAspectRatio;
control->Release();
}
return mode;
}
-void Vmr9VideoWindowControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void Vmr9VideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode)
{
if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
m_filter, IID_IVMRWindowlessControl9)) {
switch (mode) {
- case QVideoWidget::IgnoreAspectRatio:
+ case Qt::IgnoreAspectRatio:
control->SetAspectRatioMode(VMR9ARMode_None);
break;
- case QVideoWidget::KeepAspectRatio:
+ case Qt::KeepAspectRatio:
control->SetAspectRatioMode(VMR9ARMode_LetterBox);
break;
default:
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h
index a0aca95..bf4fb42 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h
@@ -75,8 +75,8 @@ public:
QSize nativeSize() const;
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
int brightness() const;
void setBrightness(int brightness);
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp
index 846a24a..427d514 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp
@@ -52,7 +52,7 @@ QGstreamerVideoOverlay::QGstreamerVideoOverlay(QObject *parent)
: QVideoWindowControl(parent)
, m_surface(new QX11VideoSurface)
, m_videoSink(reinterpret_cast<GstElement*>(QVideoSurfaceGstSink::createSink(m_surface)))
- , m_aspectRatioMode(QVideoWidget::KeepAspectRatio)
+ , m_aspectRatioMode(Qt::KeepAspectRatio)
, m_fullScreen(false)
{
if (m_videoSink) {
@@ -94,12 +94,12 @@ void QGstreamerVideoOverlay::setDisplayRect(const QRect &rect)
setScaledDisplayRect();
}
-QVideoWidget::AspectRatioMode QGstreamerVideoOverlay::aspectRatioMode() const
+Qt::AspectRatioMode QGstreamerVideoOverlay::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QGstreamerVideoOverlay::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QGstreamerVideoOverlay::setAspectRatioMode(Qt::AspectRatioMode mode)
{
m_aspectRatioMode = mode;
@@ -193,7 +193,7 @@ void QGstreamerVideoOverlay::surfaceFormatChanged()
void QGstreamerVideoOverlay::setScaledDisplayRect()
{
switch (m_aspectRatioMode) {
- case QVideoWidget::KeepAspectRatio:
+ case Qt::KeepAspectRatio:
{
QSize size = m_surface->surfaceFormat().viewport().size();
@@ -205,7 +205,7 @@ void QGstreamerVideoOverlay::setScaledDisplayRect()
m_surface->setDisplayRect(rect);
}
break;
- case QVideoWidget::IgnoreAspectRatio:
+ case Qt::IgnoreAspectRatio:
m_surface->setDisplayRect(m_displayRect);
break;
};
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h
index 9566949..1188074 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h
@@ -73,8 +73,8 @@ public:
QSize nativeSize() const;
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
void repaint();
@@ -102,7 +102,7 @@ private:
QX11VideoSurface *m_surface;
GstElement *m_videoSink;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
QRect m_displayRect;
bool m_fullScreen;
};
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp
index 8307aa5..763f7f1 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp
@@ -233,17 +233,17 @@ QWidget *QGstreamerVideoWidgetControl::videoWidget()
return m_widget;
}
-QVideoWidget::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const
+Qt::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QGstreamerVideoWidgetControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QGstreamerVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode)
{
if (m_videoSink) {
g_object_set(G_OBJECT(m_videoSink),
"force-aspect-ratio",
- (mode == QVideoWidget::KeepAspectRatio),
+ (mode == Qt::KeepAspectRatio),
(const char*)NULL);
}
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h
index 6a4c0f3..28b48af 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h
@@ -67,8 +67,8 @@ public:
QWidget *videoWidget();
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
bool isFullScreen() const;
void setFullScreen(bool fullScreen);
@@ -99,7 +99,7 @@ private:
GstElement *m_videoSink;
QGstreamerVideoWidget *m_widget;
WId m_windowId;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
bool m_fullScreen;
};
diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.h b/src/plugins/mediaservices/qt7/qt7movievideowidget.h
index 558c3d7..7908efd 100644
--- a/src/plugins/mediaservices/qt7/qt7movievideowidget.h
+++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.h
@@ -83,8 +83,8 @@ public:
QSize nativeSize() const;
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
int brightness() const;
void setBrightness(int brightness);
@@ -118,7 +118,7 @@ private:
bool m_fullscreen;
QSize m_nativeSize;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
int m_brightness;
int m_contrast;
int m_hue;
diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
index 00ceffc..197c26e 100644
--- a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
+++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
@@ -66,7 +66,7 @@ public:
: QGLWidget(format, parent),
m_texRef(0),
m_nativeSize(640,480),
- m_aspectRatioMode(QVideoWidget::KeepAspectRatio)
+ m_aspectRatioMode(Qt::KeepAspectRatio)
{
setAutoFillBackground(false);
}
@@ -145,7 +145,7 @@ public:
m_nativeSize = size;
}
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+ void setAspectRatioMode(Qt::AspectRatioMode mode)
{
if (m_aspectRatioMode != mode) {
m_aspectRatioMode = mode;
@@ -158,7 +158,7 @@ private:
{
QRect displayRect = rect();
- if (m_aspectRatioMode == QVideoWidget::KeepAspectRatio) {
+ if (m_aspectRatioMode == Qt::KeepAspectRatio) {
QSize size = m_nativeSize;
size.scale(displayRect.size(), Qt::KeepAspectRatio);
@@ -170,7 +170,7 @@ private:
CVOpenGLTextureRef m_texRef;
QSize m_nativeSize;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
};
QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent)
@@ -178,7 +178,7 @@ QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent)
m_movie(0),
m_videoWidget(0),
m_fullscreen(false),
- m_aspectRatioMode(QVideoWidget::KeepAspectRatio),
+ m_aspectRatioMode(Qt::KeepAspectRatio),
m_brightness(0),
m_contrast(0),
m_hue(0),
@@ -324,12 +324,12 @@ QSize QT7MovieVideoWidget::nativeSize() const
return m_nativeSize;
}
-QVideoWidget::AspectRatioMode QT7MovieVideoWidget::aspectRatioMode() const
+Qt::AspectRatioMode QT7MovieVideoWidget::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QT7MovieVideoWidget::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QT7MovieVideoWidget::setAspectRatioMode(Qt::AspectRatioMode mode)
{
m_aspectRatioMode = mode;
m_videoWidget->setAspectRatioMode(mode);
diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h
index 30eefa7..31a0314 100644
--- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h
+++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h
@@ -80,8 +80,8 @@ public:
QSize nativeSize() const;
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
int brightness() const;
void setBrightness(int brightness);
@@ -105,7 +105,7 @@ private:
QRect m_displayRect;
bool m_fullscreen;
QSize m_nativeSize;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
int m_brightness;
int m_contrast;
int m_hue;
diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm
index 254af46..d8dbf9b 100644
--- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm
+++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm
@@ -156,7 +156,7 @@ QT7MovieViewOutput::QT7MovieViewOutput(QObject *parent)
m_movieView(0),
m_winId(0),
m_fullscreen(false),
- m_aspectRatioMode(QVideoWidget::KeepAspectRatio),
+ m_aspectRatioMode(Qt::KeepAspectRatio),
m_brightness(0),
m_contrast(0),
m_hue(0),
@@ -230,7 +230,7 @@ void QT7MovieViewOutput::setDisplayRect(const QRect &rect)
if (m_movieView) {
AutoReleasePool pool;
- [(QTMovieView*)m_movieView setPreservesAspectRatio:(m_aspectRatioMode == QVideoWidget::KeepAspectRatio ? YES : NO)];
+ [(QTMovieView*)m_movieView setPreservesAspectRatio:(m_aspectRatioMode == Qt::KeepAspectRatio ? YES : NO)];
[(QTMovieView*)m_movieView setFrame:NSMakeRect(m_displayRect.x(),
m_displayRect.y(),
m_displayRect.width(),
@@ -259,12 +259,12 @@ QSize QT7MovieViewOutput::nativeSize() const
return m_nativeSize;
}
-QVideoWidget::AspectRatioMode QT7MovieViewOutput::aspectRatioMode() const
+Qt::AspectRatioMode QT7MovieViewOutput::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QT7MovieViewOutput::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QT7MovieViewOutput::setAspectRatioMode(Qt::AspectRatioMode mode)
{
m_aspectRatioMode = mode;
setDisplayRect(m_displayRect);
diff --git a/tests/auto/qvideowidget/tst_qvideowidget.cpp b/tests/auto/qvideowidget/tst_qvideowidget.cpp
index f703055..f1eef50 100644
--- a/tests/auto/qvideowidget/tst_qvideowidget.cpp
+++ b/tests/auto/qvideowidget/tst_qvideowidget.cpp
@@ -120,7 +120,7 @@ private:
void color_data();
};
-Q_DECLARE_METATYPE(QVideoWidget::AspectRatioMode)
+Q_DECLARE_METATYPE(Qt::AspectRatioMode)
Q_DECLARE_METATYPE(const uchar *)
class QtTestOutputControl : public QVideoOutputControl
@@ -148,7 +148,7 @@ public:
, m_brightness(0)
, m_contrast(0)
, m_saturation(0)
- , m_aspectRatioMode(QVideoWidget::KeepAspectRatio)
+ , m_aspectRatioMode(Qt::KeepAspectRatio)
, m_fullScreen(0)
{
}
@@ -169,8 +169,8 @@ public:
QSize nativeSize() const { return m_nativeSize; }
void setNativeSize(const QSize &size) { m_nativeSize = size; emit nativeSizeChanged(); }
- QVideoWidget::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) { m_aspectRatioMode = mode; }
+ Qt::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
+ void setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; }
int brightness() const { return m_brightness; }
void setBrightness(int brightness) { emit brightnessChanged(m_brightness = brightness); }
@@ -191,7 +191,7 @@ private:
int m_contrast;
int m_hue;
int m_saturation;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
QRect m_displayRect;
QSize m_nativeSize;
bool m_fullScreen;
@@ -205,7 +205,7 @@ public:
, m_contrast(1.0)
, m_hue(1.0)
, m_saturation(1.0)
- , m_aspectRatioMode(QVideoWidget::KeepAspectRatio)
+ , m_aspectRatioMode(Qt::KeepAspectRatio)
, m_fullScreen(false)
{
}
@@ -213,8 +213,8 @@ public:
bool isFullScreen() const { return m_fullScreen; }
void setFullScreen(bool fullScreen) { emit fullScreenChanged(m_fullScreen = fullScreen); }
- QVideoWidget::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) { m_aspectRatioMode = mode; }
+ Qt::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
+ void setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; }
int brightness() const { return m_brightness; }
void setBrightness(int brightness) { emit brightnessChanged(m_brightness = brightness); }
@@ -245,7 +245,7 @@ private:
int m_contrast;
int m_hue;
int m_saturation;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
QSize m_sizeHint;
bool m_fullScreen;
};
@@ -358,8 +358,8 @@ void tst_QVideoWidget::nullObject()
QTest::qWaitForWindowShown(&widget);
QCOMPARE(widget.isFullScreen(), true);
- widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
+ widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
{
QSignalSpy spy(&widget, SIGNAL(brightnessChanged(int)));
@@ -443,8 +443,8 @@ void tst_QVideoWidget::nullService()
QTest::qWaitForWindowShown(&widget);
QCOMPARE(widget.isFullScreen(), true);
- widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
+ widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
widget.setBrightness(100);
QCOMPARE(widget.brightness(), 100);
@@ -711,65 +711,65 @@ void tst_QVideoWidget::showRendererControl()
void tst_QVideoWidget::aspectRatioWindowControl()
{
QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
+ object.testService->windowControl->setAspectRatioMode(Qt::IgnoreAspectRatio);
QVideoWidget widget;
widget.setMediaObject(&object);
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
// Test the aspect ratio defaults to keeping the aspect ratio.
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
// Test the control has been informed of the aspect ratio change, post show.
widget.show();
QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
- QCOMPARE(object.testService->windowControl->aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
+ QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::KeepAspectRatio);
// Test an aspect ratio change is enforced immediately while visible.
- widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
- QCOMPARE(object.testService->windowControl->aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
+ widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
+ QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::IgnoreAspectRatio);
// Test an aspect ratio set while not visible is respected.
widget.hide();
- widget.setAspectRatioMode(QVideoWidget::KeepAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+ widget.setAspectRatioMode(Qt::KeepAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
widget.show();
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
- QCOMPARE(object.testService->windowControl->aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
+ QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::KeepAspectRatio);
}
void tst_QVideoWidget::aspectRatioWidgetControl()
{
QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- object.testService->widgetControl->setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
+ object.testService->widgetControl->setAspectRatioMode(Qt::IgnoreAspectRatio);
QVideoWidget widget;
widget.setMediaObject(&object);
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
// Test the aspect ratio defaults to keeping the aspect ratio.
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
// Test the control has been informed of the aspect ratio change, post show.
widget.show();
QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
- QCOMPARE(object.testService->widgetControl->aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
+ QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::KeepAspectRatio);
// Test an aspect ratio change is enforced immediately while visible.
- widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
- QCOMPARE(object.testService->widgetControl->aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
+ widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
+ QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::IgnoreAspectRatio);
// Test an aspect ratio set while not visible is respected.
widget.hide();
- widget.setAspectRatioMode(QVideoWidget::KeepAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+ widget.setAspectRatioMode(Qt::KeepAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
widget.show();
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
- QCOMPARE(object.testService->widgetControl->aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
+ QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::KeepAspectRatio);
}
void tst_QVideoWidget::aspectRatioRendererControl()
@@ -781,23 +781,23 @@ void tst_QVideoWidget::aspectRatioRendererControl()
widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
// Test the aspect ratio defaults to keeping the aspect ratio.
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
// Test the control has been informed of the aspect ratio change, post show.
widget.show();
QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
// Test an aspect ratio change is enforced immediately while visible.
- widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio);
+ widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
// Test an aspect ratio set while not visible is respected.
widget.hide();
- widget.setAspectRatioMode(QVideoWidget::KeepAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+ widget.setAspectRatioMode(Qt::KeepAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
widget.show();
- QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio);
+ QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
}
void tst_QVideoWidget::sizeHint_data()