summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGareth Stockwell <gareth.stockwell@sosco.com>2009-08-28 17:52:59 (GMT)
committerGareth Stockwell <gareth.stockwell@sosco.com>2009-08-28 17:52:59 (GMT)
commit764aebf14e5f8f72c91a4370803dfa4521aafbbc (patch)
treeae03b7c88e4758925b28152a9205c5a2c5315368 /src
parent8b9d50a2d83fb05e1b32814c341936daf6628452 (diff)
downloadQt-764aebf14e5f8f72c91a4370803dfa4521aafbbc.zip
Qt-764aebf14e5f8f72c91a4370803dfa4521aafbbc.tar.gz
Qt-764aebf14e5f8f72c91a4370803dfa4521aafbbc.tar.bz2
Video playback now visible; flickering problems now observed
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.cpp30
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.h1
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer.cpp42
3 files changed, 45 insertions, 28 deletions
diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp
index 6810f10..ef5b154 100644
--- a/src/3rdparty/phonon/mmf/videooutput.cpp
+++ b/src/3rdparty/phonon/mmf/videooutput.cpp
@@ -42,10 +42,14 @@ MMF::VideoOutput::VideoOutput(QWidget* parent)
TRACE_ENTRY("parent 0x%08x", parent);
#ifndef PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET
- //QPalette palette(Qt::black);
+ QPalette palette(Qt::black);
//palette.setColor(QPalette::Window, Qt::transparent);
- //setPalette(palette);
- //setAttribute(Qt::WA_OpaquePaintEvent, true);
+ setPalette(palette);
+
+ // Widget redraws all of its pixels when it receives a paint event, so Qt
+ // does not need to erase it before generating paint events.
+ setAttribute(Qt::WA_OpaquePaintEvent, true);
+
//setAttribute(Qt::WA_NoSystemBackground, true);
//setAutoFillBackground(false);
#endif // PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET
@@ -168,23 +172,11 @@ void MMF::VideoOutput::paintEvent(QPaintEvent* event)
TRACE("regions %d", event->region().numRects());
TRACE("type %d", event->type());
-/*
QPainter painter;
painter.begin(this);
- painter.setBrush(QColor(255, 0, 0, 255)); // opaque red
- //painter.setBrush(QColor(0, 0, 0, 0)); // transparent black
+ painter.setBrush(QColor(0, 0, 0, 255)); // opaque black
painter.drawRects(event->region().rects());
painter.end();
-*/
-}
-
-QPaintEngine* MMF::VideoOutput::paintEngine() const
-{
- TRACE_CONTEXT(VideoOutput::sizeHint, EVideoApi);
-
- QPaintEngine* const engine = QWidget::paintEngine();
-
- TRACE_RETURN("0x%08x", engine);
}
void MMF::VideoOutput::resizeEvent(QResizeEvent* event)
@@ -196,9 +188,8 @@ void MMF::VideoOutput::resizeEvent(QResizeEvent* event)
QWidget::resizeEvent(event);
- if (m_observer) {
+ if (m_observer)
m_observer->videoOutputRegionChanged();
- }
}
void MMF::VideoOutput::moveEvent(QMoveEvent* event)
@@ -210,9 +201,8 @@ void MMF::VideoOutput::moveEvent(QMoveEvent* event)
QWidget::moveEvent(event);
- if (m_observer) {
+ if (m_observer)
m_observer->videoOutputRegionChanged();
- }
}
#endif // PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET
diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h
index 0da6ea0..bcd9cb4 100644
--- a/src/3rdparty/phonon/mmf/videooutput.h
+++ b/src/3rdparty/phonon/mmf/videooutput.h
@@ -48,7 +48,6 @@ protected:
void paintEvent(QPaintEvent* event);
void resizeEvent(QResizeEvent* event);
void moveEvent(QMoveEvent* event);
- QPaintEngine* paintEngine() const;
#endif // PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET
#ifdef PHONON_MMF_DEBUG_VIDEO_OUTPUT
diff --git a/src/3rdparty/phonon/mmf/videoplayer.cpp b/src/3rdparty/phonon/mmf/videoplayer.cpp
index 7f08405..f2f93fa 100644
--- a/src/3rdparty/phonon/mmf/videoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/videoplayer.cpp
@@ -74,6 +74,13 @@ void MMF::VideoPlayer::construct()
// TODO: is this the correct way to handle errors which occur when
// creating a Symbian object in the constructor of a Qt object?
+
+ // TODO: check whether videoOutput is visible? If not, then the
+ // corresponding window will not be active, meaning that the
+ // clipping region will be set to empty and the video will not be
+ // visible. If this is the case, we should set m_mmfOutputChangePending
+ // and respond to future showEvents from the videoOutput widget.
+
TRAPD(err,
m_player = CVideoPlayerUtility::NewL
(
@@ -108,6 +115,14 @@ MMF::VideoPlayer::~VideoPlayer()
void MMF::VideoPlayer::doPlay()
{
+ TRACE_CONTEXT(VideoPlayer::doPlay, EVideoApi);
+
+ // See comment in updateMmfOutput
+ if(m_mmfOutputChangePending) {
+ TRACE_0("MMF output change pending - pushing now");
+ updateMmfOutput();
+ }
+
m_player->Play();
}
@@ -298,10 +313,6 @@ void MMF::VideoPlayer::videoOutputRegionChanged()
TRACE_CONTEXT(VideoPlayer::videoOutputRegionChanged, EVideoInternal);
TRACE_ENTRY("state %d", state());
-#ifdef PHONON_MMF_DEBUG_VIDEO_OUTPUT
- videoOutput().dump();
-#endif
-
getNativeWindowSystemHandles();
// See comment in updateMmfOutput
@@ -325,6 +336,12 @@ void MMF::VideoPlayer::updateMmfOutput()
// MvpuoPrepareComplete, at which point the MMF controller has been
// loaded.
+ // TODO: check whether videoOutput is visible? If not, then the
+ // corresponding window will not be active, meaning that the
+ // clipping region will be set to empty and the video will not be
+ // visible. If this is the case, we should set m_mmfOutputChangePending
+ // and respond to future showEvents from the videoOutput widget.
+
TRAPD(err,
m_player->SetDisplayWindowL
(
@@ -420,11 +437,22 @@ void MMF::VideoPlayer::getNativeWindowSystemHandles()
// HACK: why isn't control->Rect updated following a call to
// updateGeometry on the parent widget?
m_windowRect = TRect(0, 100, 320, 250);
+ m_clipRect = m_windowRect;
#else
- m_windowRect = control->Rect();
-#endif
-
+ m_windowRect = TRect(
+ control->DrawableWindow()->AbsPosition(),
+ control->DrawableWindow()->Size());
+
+ //m_clipRect = control->Rect();
m_clipRect = m_windowRect;
+#endif
+
+ TRACE("windowRect %d %d - %d %d",
+ m_windowRect.iTl.iX, m_windowRect.iTl.iY,
+ m_windowRect.iBr.iX, m_windowRect.iBr.iY);
+ TRACE("clipRect %d %d - %d %d",
+ m_clipRect.iTl.iX, m_clipRect.iTl.iY,
+ m_clipRect.iBr.iX, m_clipRect.iBr.iY);
}