From 4603dc768d8c98770311a9136f956f3cefa90362 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 8 Feb 2010 17:53:56 +1000 Subject: Don't clear the video output when the video widget is hidden. Changing the video output is a heavy task and is likely to interrupt playback. Not really worth the cost for knowing the video isn't being decoded while it cant be seen. This also applies to the QGraphicsVideoItem. --- src/multimedia/base/qgraphicsvideoitem.cpp | 16 +--------------- src/multimedia/base/qvideowidget.cpp | 3 --- tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp | 2 +- tests/auto/qvideowidget/tst_qvideowidget.cpp | 6 +++--- 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/multimedia/base/qgraphicsvideoitem.cpp b/src/multimedia/base/qgraphicsvideoitem.cpp index 3cd0449..8aba269 100644 --- a/src/multimedia/base/qgraphicsvideoitem.cpp +++ b/src/multimedia/base/qgraphicsvideoitem.cpp @@ -408,21 +408,7 @@ void QGraphicsVideoItem::paint( */ QVariant QGraphicsVideoItem::itemChange(GraphicsItemChange change, const QVariant &value) { - Q_D(QGraphicsVideoItem); - - if (change == ItemVisibleChange && d->outputControl != 0 && d->rendererControl != 0) { - if (value.toBool()) { - d->outputControl->setOutput(QVideoOutputControl::RendererOutput); - - return d->outputControl->output() == QVideoOutputControl::RendererOutput; - } else { - d->outputControl->setOutput(QVideoOutputControl::NoOutput); - - return value; - } - } else { - return QGraphicsItem::itemChange(change, value); - } + return QGraphicsItem::itemChange(change, value); } QT_END_NAMESPACE diff --git a/src/multimedia/base/qvideowidget.cpp b/src/multimedia/base/qvideowidget.cpp index 31cfd8d..5df245e 100644 --- a/src/multimedia/base/qvideowidget.cpp +++ b/src/multimedia/base/qvideowidget.cpp @@ -868,9 +868,6 @@ void QVideoWidget::hideEvent(QHideEvent *event) if (d->currentBackend) d->currentBackend->hideEvent(event); - if (d->outputControl) - d->outputControl->setOutput(QVideoOutputControl::NoOutput); - QWidget::hideEvent(event); } diff --git a/tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp b/tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp index 2427d64..7fb6005 100644 --- a/tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp +++ b/tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp @@ -357,7 +357,7 @@ void tst_QGraphicsVideoItem::show() QVERIFY(object.testService->rendererControl->surface() != 0); item->hide(); - QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput); + QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::RendererOutput); item->show(); QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::RendererOutput); diff --git a/tests/auto/qvideowidget/tst_qvideowidget.cpp b/tests/auto/qvideowidget/tst_qvideowidget.cpp index 37676cf..e30d16b 100644 --- a/tests/auto/qvideowidget/tst_qvideowidget.cpp +++ b/tests/auto/qvideowidget/tst_qvideowidget.cpp @@ -653,7 +653,7 @@ void tst_QVideoWidget::showWindowControl() widget.hide(); - QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput); + QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::WindowOutput); } void tst_QVideoWidget::showWidgetControl() @@ -677,7 +677,7 @@ void tst_QVideoWidget::showWidgetControl() widget.hide(); - QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput); + QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::WidgetOutput); QCOMPARE(object.testService->widgetControl->videoWidget()->isVisible(), false); } @@ -702,7 +702,7 @@ void tst_QVideoWidget::showRendererControl() widget.hide(); - QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput); + QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::RendererOutput); } void tst_QVideoWidget::aspectRatioWindowControl() -- cgit v0.12