diff options
author | Gareth Stockwell <gareth.stockwell@sosco.com> | 2009-08-25 17:10:58 (GMT) |
---|---|---|
committer | Gareth Stockwell <gareth.stockwell@sosco.com> | 2009-08-25 17:10:58 (GMT) |
commit | 55dcdac49aeaf9a7af9d420140e7629682fa4573 (patch) | |
tree | 71ac31355439a48825654055a112faebbee21c5f /src/3rdparty/phonon | |
parent | f3defb60f21cfe2456ace1148afcce43112f9c51 (diff) | |
download | Qt-55dcdac49aeaf9a7af9d420140e7629682fa4573.zip Qt-55dcdac49aeaf9a7af9d420140e7629682fa4573.tar.gz Qt-55dcdac49aeaf9a7af9d420140e7629682fa4573.tar.bz2 |
Made video playback visible using a couple of hacks
These hacks, which are enabled using macros in defs.h, are:
PHONON_MMF_HARD_CODE_VIDEO_RECT
VideoPlayer should obtain the screen rectangle into which video rendering will occur, using the CoeControl associated with the video widget (i.e. the VideoOutput object). However, this control always has co-ordinates (relative to its parent) of (0,0)-(100,30), regardless of whether updateGeometry() and show() are called on the widget. So, this macro just hard-codes the screen rectangle to a value which works when the breakfast.mp4 clip is used for testing.
PHONON_MMF_EXPLICITLY_SHOW_VIDEO_WIDGET
In order that the video region does not overwrite the slider and buttons below it, the parent widget of the VideoObject instance must be appropriately re-sized. Debugging showed that both the parent and grandparent of VideoObject are in fact invisible at the time playback begins, so for now we just manually call show() on the grandparent.
Clearly both of these are only temporary measures, for use until the underlying cause of the problem has been determined.
Diffstat (limited to 'src/3rdparty/phonon')
-rw-r--r-- | src/3rdparty/phonon/mmf/defs.h | 15 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/mediaobject.h | 2 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/videooutput.cpp | 69 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/videooutput.h | 9 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/videoplayer.cpp | 23 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/videowidget.h | 4 |
6 files changed, 115 insertions, 7 deletions
diff --git a/src/3rdparty/phonon/mmf/defs.h b/src/3rdparty/phonon/mmf/defs.h index b377ee5..adf2882 100644 --- a/src/3rdparty/phonon/mmf/defs.h +++ b/src/3rdparty/phonon/mmf/defs.h @@ -21,6 +21,21 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QtGlobal> +// The following macros are for switching on / off various bits of code, +// in order to debug the current problems with video visibility. + +// If this is defined, then VideoOutput is essentially just a typedef for +// QWidget +#define PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET + +// Use hard-coded rectangle coordinates, rather than using CCoeControl +// rect, i.e. QWidget::winId()->Rect() +#define PHONON_MMF_HARD_CODE_VIDEO_RECT + +// If this is defined, show() is called on the grandparent of the widget +// on which video will be rendered. +#define PHONON_MMF_EXPLICITLY_SHOW_VIDEO_WIDGET + namespace Phonon { namespace MMF diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h index f62f4f5..5bbca96 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.h +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -81,7 +81,7 @@ namespace Phonon Q_SIGNALS: void totalTimeChanged(qint64 length); void hasVideoChanged(bool hasVideo); - void seekableChanged(bool seekable); + void seekableChanged(bool seekable); // TODO: emit bufferStatus from MediaObject void bufferStatus(int); // TODO: emit aboutToFinish from MediaObject diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index 30bf531..482d944 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -35,15 +35,63 @@ MMF::VideoOutput::VideoOutput(QWidget* parent) { TRACE_CONTEXT(VideoOutput::VideoOutput, EVideoInternal); TRACE_ENTRY("parent 0x%08x", parent); - + +#ifndef PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET setPalette(QPalette(Qt::black)); setAttribute(Qt::WA_OpaquePaintEvent, true); setAttribute(Qt::WA_NoSystemBackground, true); setAutoFillBackground(false); +#endif // PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET + + dump(); TRACE_EXIT_0(); } +// Debugging video visibility +void VideoOutput::dump() +{ + TRACE_CONTEXT(VideoOutput::dump, EVideoInternal); + TRACE_ENTRY_0(); + + TRACE("dumpObjectInfo this 0x%08x", this); + this->dumpObjectInfo(); + + TRACE_0("Traversing up object tree ..."); + QObject* node = this; + QObject* root = this; + while(node) + { + QWidget* widget = qobject_cast<QWidget*>(node); + const bool visible = widget ? widget->isVisible() : false; + TRACE("node 0x%08x widget 0x%08x visible %d", node, widget, visible); + + root = node; + node = node->parent(); + } + + TRACE("dumpObjectInfo root 0x%08x", root); + root->dumpObjectInfo(); + TRACE_0("+ dumpObjectTree"); + root->dumpObjectTree(); + TRACE_0("- dumpObjectTree"); + + TRACE("isVisible %d", isVisible()); + TRACE("pos %d %d", x(), y()); + TRACE("size %d %d", size().width(), size().height()); + TRACE("maxSize %d %d", maximumWidth(), maximumHeight()); + TRACE("sizeHint %d %d", sizeHint().width(), sizeHint().height()); + + QWidget& parentWidget = *qobject_cast<QWidget*>(parent()); + TRACE("parent.isVisible %d", parentWidget.isVisible()); + TRACE("parent.pos %d %d", parentWidget.x(), parentWidget.y()); + TRACE("parent.size %d %d", parentWidget.size().width(), parentWidget.size().height()); + TRACE("parent.maxSize %d %d", parentWidget.maximumWidth(), parentWidget.maximumHeight()); + TRACE("parent.sizeHint %d %d", parentWidget.sizeHint().width(), parentWidget.sizeHint().height()); + + TRACE_EXIT_0(); +} + MMF::VideoOutput::~VideoOutput() { TRACE_CONTEXT(VideoOutput::~VideoOutput, EVideoInternal); @@ -54,6 +102,9 @@ MMF::VideoOutput::~VideoOutput() void MMF::VideoOutput::setFrameSize(const QSize& frameSize) { +#ifdef PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET + Q_UNUSED(frameSize); +#else TRACE_CONTEXT(VideoOutput::setFrameSize, EVideoInternal); TRACE("oldSize %d %d newSize %d %d", m_frameSize.width(), m_frameSize.height(), @@ -64,6 +115,7 @@ void MMF::VideoOutput::setFrameSize(const QSize& frameSize) m_frameSize = frameSize; updateGeometry(); } +#endif // PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET } @@ -71,6 +123,8 @@ void MMF::VideoOutput::setFrameSize(const QSize& frameSize) // QWidget //----------------------------------------------------------------------------- +#ifndef PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET + QSize MMF::VideoOutput::sizeHint() const { TRACE_CONTEXT(VideoOutput::sizeHint, EVideoApi); @@ -95,12 +149,17 @@ void MMF::VideoOutput::paintEvent(QPaintEvent* event) event->rect().right(), event->rect().bottom()); TRACE("regions %d", event->region().numRects()); TRACE("type %d", event->type()); + + QWidget::paintEvent(event); } QPaintEngine* MMF::VideoOutput::paintEngine() const { TRACE_CONTEXT(VideoOutput::sizeHint, EVideoApi); - TRACE_RETURN("0x%08x", NULL); + + QPaintEngine* const engine = QWidget::paintEngine(); + + TRACE_RETURN("0x%08x", engine); } void MMF::VideoOutput::resizeEvent(QResizeEvent* event) @@ -109,6 +168,8 @@ void MMF::VideoOutput::resizeEvent(QResizeEvent* event) TRACE("%d %d -> %d %d", event->oldSize().width(), event->oldSize().height(), event->size().width(), event->size().height()); + + QWidget::resizeEvent(event); } void MMF::VideoOutput::moveEvent(QMoveEvent* event) @@ -117,8 +178,12 @@ void MMF::VideoOutput::moveEvent(QMoveEvent* event) TRACE("%d %d -> %d %d", event->oldPos().x(), event->oldPos().y(), event->pos().x(), event->pos().y()); + + QWidget::moveEvent(event); } +#endif // PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET + //----------------------------------------------------------------------------- // Private functions diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h index d6cfc6f..39ebe00 100644 --- a/src/3rdparty/phonon/mmf/videooutput.h +++ b/src/3rdparty/phonon/mmf/videooutput.h @@ -20,6 +20,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #define PHONON_MMF_VIDEOOUTPUT_H #include <QtGui/QWidget> +#include "defs.h" namespace Phonon { @@ -36,12 +37,18 @@ namespace Phonon void setFrameSize(const QSize& size); protected: - // QWidget + #ifndef PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET + // Override QWidget functions QSize sizeHint() const; void paintEvent(QPaintEvent* event); void resizeEvent(QResizeEvent* event); void moveEvent(QMoveEvent* event); QPaintEngine* paintEngine() const; + #endif // PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET + + // Debugging video visibility + public: + void dump(); private: QSize m_frameSize; diff --git a/src/3rdparty/phonon/mmf/videoplayer.cpp b/src/3rdparty/phonon/mmf/videoplayer.cpp index 002c6f6..584a4f0 100644 --- a/src/3rdparty/phonon/mmf/videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer.cpp @@ -103,7 +103,7 @@ MMF::VideoPlayer::~VideoPlayer() //----------------------------------------------------------------------------- void MMF::VideoPlayer::doPlay() -{ +{ m_player->Play(); } @@ -228,6 +228,20 @@ void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError) maxVolumeChanged(m_player->MaxVolume()); videoOutput().setFrameSize(m_frameSize); + + // Debugging video visibility + videoOutput().dump(); + +#ifdef PHONON_MMF_EXPLICITLY_SHOW_VIDEO_WIDGET + // HACK: why do we need to explicitly show() the grandparent...? + static_cast<QWidget*>(videoOutput().parent()->parent())->show(); + videoOutput().updateGeometry(); + videoOutput().update(); +#endif + + videoOutput().dump(); + + videoOutputChanged(); emit totalTimeChanged(totalTime()); changeState(StoppedState); @@ -374,6 +388,13 @@ void MMF::VideoPlayer::getNativeWindowSystemHandles() TRACE("window size %d %d", m_window->Size().iWidth, m_window->Size().iHeight); +#ifdef PHONON_MMF_HARD_CODE_VIDEO_RECT + // HACK: why isn't control->Rect updated following a call to + // updateGeometry on the parent widget? + m_windowRect = TRect(0,100,320,250); +#else m_windowRect = control->Rect(); +#endif + m_clipRect = m_windowRect; } diff --git a/src/3rdparty/phonon/mmf/videowidget.h b/src/3rdparty/phonon/mmf/videowidget.h index 5c27c7f..e8fc603 100644 --- a/src/3rdparty/phonon/mmf/videowidget.h +++ b/src/3rdparty/phonon/mmf/videowidget.h @@ -57,8 +57,8 @@ namespace Phonon VideoOutput& videoOutput(); private: - QScopedPointer<VideoOutput> m_videoOutput; - + QScopedPointer<QWidget> m_widget; + Phonon::VideoWidget::AspectRatio m_aspectRatio; qreal m_brightness; Phonon::VideoWidget::ScaleMode m_scaleMode; |