summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGareth Stockwell <gareth.stockwell@sosco.com>2009-08-25 13:18:57 (GMT)
committerGareth Stockwell <gareth.stockwell@sosco.com>2009-08-25 13:18:57 (GMT)
commit9bcdcc33e1abd202a5b0ec156ff22624bd21740c (patch)
tree1dc9ed420b6f470efb9b98d1ba42085213aa147b /src
parent4135d048eb7999927dc39a73df138922d4ba6278 (diff)
downloadQt-9bcdcc33e1abd202a5b0ec156ff22624bd21740c.zip
Qt-9bcdcc33e1abd202a5b0ec156ff22624bd21740c.tar.gz
Qt-9bcdcc33e1abd202a5b0ec156ff22624bd21740c.tar.bz2
Modified video player to call updateGeometry on video display widget; having no effect at present
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.cpp77
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.h11
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer.cpp69
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer.h5
4 files changed, 132 insertions, 30 deletions
diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp
index 3079668..828697c 100644
--- a/src/3rdparty/phonon/mmf/videooutput.cpp
+++ b/src/3rdparty/phonon/mmf/videooutput.cpp
@@ -19,10 +19,13 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "utils.h"
#include "videooutput.h"
+#include <QPaintEvent>
+#include <QMoveEvent>
+#include <QResizeEvent>
+
using namespace Phonon;
using namespace Phonon::MMF;
-
//-----------------------------------------------------------------------------
// Constructor / destructor
//-----------------------------------------------------------------------------
@@ -33,6 +36,11 @@ MMF::VideoOutput::VideoOutput(QWidget* parent)
TRACE_CONTEXT(VideoOutput::VideoOutput, EVideoInternal);
TRACE_ENTRY("parent 0x%08x", parent);
+ setPalette(QPalette(Qt::black));
+ setAttribute(Qt::WA_OpaquePaintEvent, true);
+ setAttribute(Qt::WA_NoSystemBackground, true);
+ setAutoFillBackground(false);
+
TRACE_EXIT_0();
}
@@ -44,8 +52,73 @@ MMF::VideoOutput::~VideoOutput()
TRACE_EXIT_0();
}
+void MMF::VideoOutput::setFrameSize(const QSize& frameSize)
+{
+ TRACE_CONTEXT(VideoOutput::setFrameSize, EVideoInternal);
+ TRACE("oldSize %d %d newSize %d %d",
+ m_frameSize.width(), m_frameSize.height(),
+ frameSize.width(), frameSize.height());
+
+ if(frameSize != m_frameSize)
+ {
+ m_frameSize = frameSize;
+ updateGeometry();
+ }
+}
+
//-----------------------------------------------------------------------------
-// Public API
+// QWidget
//-----------------------------------------------------------------------------
+QSize MMF::VideoOutput::sizeHint() const
+{
+ if(m_frameSize.isNull())
+ {
+ // TODO: replace this with a more sensible default
+ return QSize(320, 240);
+ }
+ else
+ {
+ return m_frameSize;
+ }
+}
+
+void MMF::VideoOutput::paintEvent(QPaintEvent* event)
+{
+ TRACE_CONTEXT(VideoOutput::paintEvent, EVideoInternal);
+ TRACE("rect %d %d - %d %d",
+ event->rect().left(), event->rect().top(),
+ event->rect().right(), event->rect().bottom());
+ TRACE("regions %d", event->region().numRects());
+ TRACE("type %d", event->type());
+}
+
+QPaintEngine* MMF::VideoOutput::paintEngine() const
+{
+ return NULL;
+}
+
+void MMF::VideoOutput::resizeEvent(QResizeEvent* event)
+{
+ TRACE_CONTEXT(VideoOutput::resizeEvent, EVideoInternal);
+ TRACE("%d %d -> %d %d",
+ event->oldSize().width(), event->oldSize().height(),
+ event->size().width(), event->size().height());
+}
+
+void MMF::VideoOutput::moveEvent(QMoveEvent* event)
+{
+ TRACE_CONTEXT(VideoOutput::moveEvent, EVideoInternal);
+ TRACE("%d %d -> %d %d",
+ event->oldPos().x(), event->oldPos().y(),
+ event->pos().x(), event->pos().y());
+}
+
+
+//-----------------------------------------------------------------------------
+// Private functions
+//-----------------------------------------------------------------------------
+
+
+
diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h
index 8b08402..d6cfc6f 100644
--- a/src/3rdparty/phonon/mmf/videooutput.h
+++ b/src/3rdparty/phonon/mmf/videooutput.h
@@ -33,7 +33,18 @@ namespace Phonon
VideoOutput(QWidget* parent);
~VideoOutput();
+ void setFrameSize(const QSize& size);
+
+ protected:
+ // QWidget
+ QSize sizeHint() const;
+ void paintEvent(QPaintEvent* event);
+ void resizeEvent(QResizeEvent* event);
+ void moveEvent(QMoveEvent* event);
+ QPaintEngine* paintEngine() const;
+
private:
+ QSize m_frameSize;
};
}
diff --git a/src/3rdparty/phonon/mmf/videoplayer.cpp b/src/3rdparty/phonon/mmf/videoplayer.cpp
index 4bffce3..1e9522c 100644
--- a/src/3rdparty/phonon/mmf/videoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/videoplayer.cpp
@@ -37,6 +37,7 @@ MMF::VideoPlayer::VideoPlayer()
: m_wsSession(NULL)
, m_screenDevice(NULL)
, m_window(NULL)
+ , m_totalTime(0)
{
construct();
}
@@ -46,6 +47,7 @@ MMF::VideoPlayer::VideoPlayer(const AbstractPlayer& player)
, m_wsSession(NULL)
, m_screenDevice(NULL)
, m_window(NULL)
+ , m_totalTime(0)
{
construct();
}
@@ -187,21 +189,7 @@ qint64 MMF::VideoPlayer::currentTime() const
qint64 MMF::VideoPlayer::totalTime() const
{
- TRACE_CONTEXT(VideoPlayer::totalTime, EVideoApi);
-
- qint64 result = 0;
- TRAPD(err, result = toMilliSeconds(m_player->DurationL()));
-
- if(KErrNone != err)
- {
- TRACE("DurationL error %d", err);
-
- // If we don't cast away constness here, we simply have to ignore
- // the error.
- const_cast<VideoPlayer*>(this)->setError(NormalError);
- }
-
- return result;
+ return m_totalTime;
}
@@ -235,23 +223,41 @@ void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError)
TRACE_ENTRY("state %d error %d", state(), aError);
__ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic));
-
- if(KErrNone == aError)
+
+ TRAPD(err, doPrepareCompleteL(aError));
+
+ if(KErrNone == err)
{
maxVolumeChanged(m_player->MaxVolume());
+
+ videoOutput().setFrameSize(m_frameSize);
- emit totalTimeChanged();
- changeState(StoppedState);
+ emit totalTimeChanged();
+ changeState(StoppedState);
}
- else
+ else
{
- // TODO: set different error states according to value of aError?
- setError(NormalError);
+ // TODO: set different error states according to value of aError?
+ setError(NormalError);
}
TRACE_EXIT_0();
}
+void MMF::VideoPlayer::doPrepareCompleteL(TInt aError)
+{
+ User::LeaveIfError(aError);
+
+ // Get frame size
+ TSize size;
+ m_player->VideoFrameSizeL(size);
+ m_frameSize = QSize(size.iWidth, size.iHeight);
+
+ // Get duration
+ m_totalTime = toMilliSeconds(m_player->DurationL());
+}
+
+
void MMF::VideoPlayer::MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError)
{
TRACE_CONTEXT(VideoPlayer::MvpuoFrameReady, EVideoApi);
@@ -310,6 +316,8 @@ void MMF::VideoPlayer::videoOutputChanged()
m_dummyVideoOutput.reset(new VideoOutput(NULL));
}
+ videoOutput().setFrameSize(m_frameSize);
+
getNativeWindowSystemHandles();
TRAPD(err,
@@ -334,7 +342,8 @@ void MMF::VideoPlayer::getNativeWindowSystemHandles()
{
TRACE_CONTEXT(VideoPlayer::getNativeWindowSystemHandles, EVideoInternal);
- CCoeControl* const control = videoOutput().winId();
+ VideoOutput& output = videoOutput();
+ CCoeControl* const control = output.winId();
TRACE("control 0x%08x", control);
TRACE("control isVisible %d", control->IsVisible());
@@ -350,20 +359,24 @@ void MMF::VideoPlayer::getNativeWindowSystemHandles()
m_wsSession = &(coeEnv->WsSession());
- TRACE("session handle %d", m_wsSession->Handle());
+ TRACE("session handle 0x%08x", m_wsSession->Handle());
m_screenDevice = coeEnv->ScreenDevice();
- TRACE("device srv handle %d", m_screenDevice->WsHandle());
+ TRACE("device srv handle 0x%08x", m_screenDevice->WsHandle());
m_window = control->DrawableWindow();
- TRACE("window cli handle %d", m_window->ClientHandle());
- TRACE("window srv handle %d", m_window->WsHandle());
+ TRACE("window cli handle 0x%08x", m_window->ClientHandle());
+ TRACE("window srv handle 0x%08x", m_window->WsHandle());
TRACE("window group %d", m_window->WindowGroupId());
TRACE("window position %d %d",
m_window->Position().iX, m_window->Position().iY);
+ TRACE("window abs_pos %d %d",
+ m_window->AbsPosition().iX, m_window->AbsPosition().iY);
+ TRACE("window size %d %d",
+ m_window->Size().iWidth, m_window->Size().iHeight);
m_windowRect = control->Rect();
- m_clipRect = control->Rect();
+ m_clipRect = m_windowRect;
}
diff --git a/src/3rdparty/phonon/mmf/videoplayer.h b/src/3rdparty/phonon/mmf/videoplayer.h
index e784812..8b5c467 100644
--- a/src/3rdparty/phonon/mmf/videoplayer.h
+++ b/src/3rdparty/phonon/mmf/videoplayer.h
@@ -77,6 +77,8 @@ namespace Phonon
void construct();
VideoOutput& videoOutput();
+ void doPrepareCompleteL(TInt aError);
+
// AbstractPlayer
virtual void videoOutputChanged();
@@ -93,6 +95,9 @@ namespace Phonon
TRect m_windowRect;
TRect m_clipRect;
+ QSize m_frameSize;
+ qint64 m_totalTime;
+
};
}
}