summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGareth Stockwell <gareth.stockwell@sosco.com>2009-08-26 11:57:47 (GMT)
committerGareth Stockwell <gareth.stockwell@sosco.com>2009-08-26 11:57:47 (GMT)
commit7104201d87b965a01c2983cd44ef2e0f465030bf (patch)
treef401a6a64b9b69a60b7e4cf2f2c75b05868f05b8 /src
parentc38752fb695b5b88f6b2404b415ffb4879999a89 (diff)
downloadQt-7104201d87b965a01c2983cd44ef2e0f465030bf.zip
Qt-7104201d87b965a01c2983cd44ef2e0f465030bf.tar.gz
Qt-7104201d87b965a01c2983cd44ef2e0f465030bf.tar.bz2
Added VideoOutputObserver, to propagate screen region updates back to VideoPlayer
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/phonon/mmf/defs.h2
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.cpp22
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.h6
-rw-r--r--src/3rdparty/phonon/mmf/videooutputobserver.h40
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer.cpp60
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer.h5
-rw-r--r--src/plugins/phonon/mmf/mmf.pro1
7 files changed, 112 insertions, 24 deletions
diff --git a/src/3rdparty/phonon/mmf/defs.h b/src/3rdparty/phonon/mmf/defs.h
index be8401d..90c647f 100644
--- a/src/3rdparty/phonon/mmf/defs.h
+++ b/src/3rdparty/phonon/mmf/defs.h
@@ -32,7 +32,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
// Use hard-coded rectangle coordinates, rather than using CCoeControl
// rect, i.e. QWidget::winId()->Rect()
-#define PHONON_MMF_HARD_CODE_VIDEO_RECT
+//#define PHONON_MMF_HARD_CODE_VIDEO_RECT
namespace Phonon
{
diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp
index 2652844..fd8a80b 100644
--- a/src/3rdparty/phonon/mmf/videooutput.cpp
+++ b/src/3rdparty/phonon/mmf/videooutput.cpp
@@ -18,6 +18,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "utils.h"
#include "videooutput.h"
+#include "videooutputobserver.h"
#include <QPaintEvent>
#include <QMoveEvent>
@@ -32,13 +33,14 @@ using namespace Phonon::MMF;
MMF::VideoOutput::VideoOutput(QWidget* parent)
: QWidget(parent)
+ , m_observer(NULL)
{
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_OpaquePaintEvent, true);
setAttribute(Qt::WA_NoSystemBackground, true);
setAutoFillBackground(false);
#endif // PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET
@@ -119,6 +121,14 @@ void MMF::VideoOutput::setFrameSize(const QSize& frameSize)
#endif // PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET
}
+void MMF::VideoOutput::setObserver(VideoOutputObserver* observer)
+{
+ TRACE_CONTEXT(VideoOutput::setObserver, EVideoInternal);
+ TRACE("observer 0x%08x", observer);
+
+ m_observer = observer;
+}
+
//-----------------------------------------------------------------------------
// QWidget
@@ -171,6 +181,11 @@ void MMF::VideoOutput::resizeEvent(QResizeEvent* event)
event->size().width(), event->size().height());
QWidget::resizeEvent(event);
+
+ if(m_observer)
+ {
+ m_observer->videoOutputRegionChanged();
+ }
}
void MMF::VideoOutput::moveEvent(QMoveEvent* event)
@@ -181,6 +196,11 @@ void MMF::VideoOutput::moveEvent(QMoveEvent* event)
event->pos().x(), event->pos().y());
QWidget::moveEvent(event);
+
+ 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 39ebe00..90709aa 100644
--- a/src/3rdparty/phonon/mmf/videooutput.h
+++ b/src/3rdparty/phonon/mmf/videooutput.h
@@ -26,6 +26,8 @@ namespace Phonon
{
namespace MMF
{
+ class VideoOutputObserver;
+
class VideoOutput : public QWidget
{
Q_OBJECT
@@ -36,6 +38,8 @@ namespace Phonon
void setFrameSize(const QSize& size);
+ void setObserver(VideoOutputObserver* observer);
+
protected:
#ifndef PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET
// Override QWidget functions
@@ -53,6 +57,8 @@ namespace Phonon
private:
QSize m_frameSize;
+ // Not owned
+ VideoOutputObserver* m_observer;
};
}
}
diff --git a/src/3rdparty/phonon/mmf/videooutputobserver.h b/src/3rdparty/phonon/mmf/videooutputobserver.h
new file mode 100644
index 0000000..30fb3e0
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/videooutputobserver.h
@@ -0,0 +1,40 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_VIDEOOUTPUTOBSERVER_H
+#define PHONON_MMF_VIDEOOUTPUTOBSERVER_H
+
+#include <QtGlobal>
+
+namespace Phonon
+{
+ namespace MMF
+ {
+ /**
+ * Interface via which VideoOutput notifies VideoPlayer of changes to the
+ * video output screen region.
+ */
+ class VideoOutputObserver
+ {
+ public:
+ virtual void videoOutputRegionChanged() = 0;
+ };
+ }
+}
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/videoplayer.cpp b/src/3rdparty/phonon/mmf/videoplayer.cpp
index 75db551..fd8425d 100644
--- a/src/3rdparty/phonon/mmf/videoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/videoplayer.cpp
@@ -62,6 +62,8 @@ void MMF::VideoPlayer::construct()
m_dummyVideoOutput.reset(new VideoOutput(NULL));
}
+ videoOutput().setObserver(this);
+
const TInt priority = 0;
const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone;
@@ -227,12 +229,7 @@ void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError)
{
maxVolumeChanged(m_player->MaxVolume());
- videoOutput().setFrameSize(m_frameSize);
-
- // Debugging video visibility
- videoOutput().dump();
-
- videoOutputChanged();
+ videoOutput().setFrameSize(m_frameSize);
emit totalTimeChanged(totalTime());
changeState(StoppedState);
@@ -296,6 +293,38 @@ void MMF::VideoPlayer::MvpuoEvent(const TMMFEvent &aEvent)
//-----------------------------------------------------------------------------
+// VideoOutputObserver
+//-----------------------------------------------------------------------------
+
+void MMF::VideoPlayer::videoOutputRegionChanged()
+{
+ TRACE_CONTEXT(VideoPlayer::videoOutputRegionChanged, EVideoInternal);
+ TRACE_ENTRY_0();
+
+ videoOutput().dump();
+
+ getNativeWindowSystemHandles();
+
+ TRAPD(err,
+ m_player->SetDisplayWindowL
+ (
+ *m_wsSession, *m_screenDevice,
+ *m_window,
+ m_windowRect, m_clipRect
+ )
+ );
+
+ if(KErrNone != err)
+ {
+ TRACE("SetDisplayWindowL error %d", err);
+ setError(NormalError);
+ }
+
+ TRACE_EXIT_0();
+}
+
+
+//-----------------------------------------------------------------------------
// Private functions
//-----------------------------------------------------------------------------
@@ -318,24 +347,11 @@ void MMF::VideoPlayer::videoOutputChanged()
m_dummyVideoOutput.reset(new VideoOutput(NULL));
}
- videoOutput().setFrameSize(m_frameSize);
-
- getNativeWindowSystemHandles();
+ videoOutput().setObserver(this);
- TRAPD(err,
- m_player->SetDisplayWindowL
- (
- *m_wsSession, *m_screenDevice,
- *m_window,
- m_windowRect, m_clipRect
- )
- );
+ videoOutput().setFrameSize(m_frameSize);
- if(KErrNone != err)
- {
- TRACE("SetDisplayWindowL error %d", err);
- setError(NormalError);
- }
+ videoOutputRegionChanged();
TRACE_EXIT_0();
}
diff --git a/src/3rdparty/phonon/mmf/videoplayer.h b/src/3rdparty/phonon/mmf/videoplayer.h
index 5d6baa4..a6f069f 100644
--- a/src/3rdparty/phonon/mmf/videoplayer.h
+++ b/src/3rdparty/phonon/mmf/videoplayer.h
@@ -23,6 +23,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "abstractmediaplayer.h"
#include "videooutput.h"
+#include "videooutputobserver.h"
namespace Phonon
@@ -38,6 +39,7 @@ namespace Phonon
*/
class VideoPlayer : public AbstractMediaPlayer
, public MVideoPlayerUtilityObserver
+ , public VideoOutputObserver
{
Q_OBJECT
@@ -67,6 +69,9 @@ namespace Phonon
virtual void MvpuoPlayComplete(TInt aError);
virtual void MvpuoEvent(const TMMFEvent &aEvent);
+ // VideoOutputObserver
+ virtual void videoOutputRegionChanged();
+
Q_SIGNALS:
void totalTimeChanged(qint64 length);
void finished();
diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro
index cc46894..1d9910b 100644
--- a/src/plugins/phonon/mmf/mmf.pro
+++ b/src/plugins/phonon/mmf/mmf.pro
@@ -32,6 +32,7 @@ HEADERS += \
$$PHONON_MMF_DIR/mediaobject.h \
$$PHONON_MMF_DIR/utils.h \
$$PHONON_MMF_DIR/videooutput.h \
+ $$PHONON_MMF_DIR/videooutputobserver.h \
$$PHONON_MMF_DIR/videoplayer.h \
$$PHONON_MMF_DIR/videowidget.h \
$$PHONON_MMF_DIR/volumeobserver.h