diff options
-rw-r--r-- | src/3rdparty/phonon/mmf/TODO.txt | 3 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 20 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/abstractmediaplayer.h | 5 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/audioplayer.cpp | 17 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/audioplayer.h | 4 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/defs.h | 2 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/mediaobject.cpp | 22 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/mediaobject.h | 13 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/videooutput.cpp | 20 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/videoplayer.cpp | 31 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/videoplayer.h | 4 |
11 files changed, 94 insertions, 47 deletions
diff --git a/src/3rdparty/phonon/mmf/TODO.txt b/src/3rdparty/phonon/mmf/TODO.txt index a9707e0..84dd52d 100644 --- a/src/3rdparty/phonon/mmf/TODO.txt +++ b/src/3rdparty/phonon/mmf/TODO.txt @@ -14,9 +14,6 @@ The following items are in rough order of priority. * Trace for on-target testing Do we need to connect up the TRACE_* macros to another logging output (e.g. file / Flogger / UTrace etc)? -* Fix position slider in audio test app (musicplayer.exe) -The slider is enabled when playing, but does not move and cannot be dragged. This means that we can't easily test seeking. - * Implement audio effects * Support for network streaming playback diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index ccb94c4..114ba13 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -169,6 +169,26 @@ void MMF::AbstractMediaPlayer::stop() TRACE_EXIT("state %d", m_state); } +void MMF::AbstractMediaPlayer::seek(qint64 ms) +{ + TRACE_CONTEXT(AbstractMediaPlayer::seek, EAudioApi); + TRACE_ENTRY("state %d pos %Ld", state(), ms); + + // TODO: put a state guard in here + + const bool tickTimerWasRunning = m_tickTimer->isActive(); + stopTickTimer(); + + doSeek(ms); + + if(tickTimerWasRunning) + { + startTickTimer(); + } + + TRACE_EXIT_0(); +} + bool MMF::AbstractMediaPlayer::isSeekable() const { return true; diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index 58aca84..7f53a2d 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -50,6 +50,7 @@ namespace Phonon virtual void play(); virtual void pause(); virtual void stop(); + virtual void seek(qint64 milliseconds); virtual bool isSeekable() const; virtual Phonon::ErrorType errorType() const; virtual QString errorString() const; @@ -69,12 +70,14 @@ namespace Phonon virtual void doPlay() = 0; virtual void doPause() = 0; virtual void doStop() = 0; + virtual void doSeek(qint64 pos) = 0; virtual int setDeviceVolume(int mmfVolume) = 0; virtual int openFile(RFile& file) = 0; virtual void close() = 0; protected: - void startTickTimer(); + bool tickTimerRunning() const; + void startTickTimer(); void stopTickTimer(); void maxVolumeChanged(int maxVolume); diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp index d4ae1a8..41fedb4 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.cpp +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp @@ -85,6 +85,11 @@ void MMF::AudioPlayer::doStop() m_player->Stop(); } +void MMF::AudioPlayer::doSeek(qint64 ms) +{ + m_player->SetPosition(TTimeIntervalMicroSeconds(ms * 1000)); +} + int MMF::AudioPlayer::setDeviceVolume(int mmfVolume) { return m_player->SetVolume(mmfVolume); @@ -113,16 +118,6 @@ void MMF::AudioPlayer::close() m_player->Close(); } -void MMF::AudioPlayer::seek(qint64 ms) -{ - TRACE_CONTEXT(AudioPlayer::seek, EAudioApi); - TRACE_ENTRY("state %d pos %Ld", state(), ms); - - m_player->SetPosition(TTimeIntervalMicroSeconds(ms)); - - TRACE_EXIT_0(); -} - bool MMF::AudioPlayer::hasVideo() const { return false; @@ -180,7 +175,7 @@ void MMF::AudioPlayer::MapcInitComplete(TInt aError, { maxVolumeChanged(m_player->MaxVolume()); - emit totalTimeChanged(); + emit totalTimeChanged(totalTime()); changeState(StoppedState); } else diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h index 29ed12e..8d29547 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.h +++ b/src/3rdparty/phonon/mmf/audioplayer.h @@ -58,12 +58,12 @@ namespace Phonon virtual void doPlay(); virtual void doPause(); virtual void doStop(); + virtual void doSeek(qint64 milliseconds); virtual int setDeviceVolume(int mmfVolume); virtual int openFile(RFile& file); virtual void close(); // MediaObjectInterface - virtual void seek(qint64 milliseconds); virtual bool hasVideo() const; virtual qint64 currentTime() const; virtual qint64 totalTime() const; @@ -85,7 +85,7 @@ namespace Phonon #endif Q_SIGNALS: - void totalTimeChanged(); + void totalTimeChanged(qint64 length); void finished(); private: diff --git a/src/3rdparty/phonon/mmf/defs.h b/src/3rdparty/phonon/mmf/defs.h index 0f2f31f..b377ee5 100644 --- a/src/3rdparty/phonon/mmf/defs.h +++ b/src/3rdparty/phonon/mmf/defs.h @@ -25,7 +25,7 @@ namespace Phonon { namespace MMF { - static const qint32 DefaultTickInterval = 20; + static const qint32 DefaultTickInterval = 10; static const qreal InitialVolume = 0.5; enum MediaType diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index fec5441..396f658 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -156,6 +156,11 @@ void MMF::MediaObject::stop() void MMF::MediaObject::seek(qint64 ms) { m_player->seek(ms); + + if(state() == PausedState or state() == PlayingState) + { + emit tick(currentTime()); + } } qint32 MMF::MediaObject::tickInterval() const @@ -215,6 +220,8 @@ void MMF::MediaObject::setSource(const MediaSource &source) // This is a hack to work around KErrInUse from MMF client utility // OpenFileL calls m_player->setFileSource(source, m_file); + + emit currentSourceChanged(source); } void MMF::MediaObject::createPlayer(const MediaSource &source) @@ -227,6 +234,9 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) AbstractPlayer* oldPlayer = m_player.data(); + const bool oldPlayerHasVideo = oldPlayer->hasVideo(); + const bool oldPlayerSeekable = oldPlayer->isSeekable(); + // Determine media type switch(source.type()) { @@ -313,11 +323,21 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) m_player.reset(newPlayer); - connect(m_player.data(), SIGNAL(totalTimeChanged()), SIGNAL(totalTimeChanged())); + connect(m_player.data(), SIGNAL(totalTimeChanged(qint64)), SIGNAL(totalTimeChanged(qint64))); connect(m_player.data(), SIGNAL(stateChanged(Phonon::State, Phonon::State)), SIGNAL(stateChanged(Phonon::State, Phonon::State))); connect(m_player.data(), SIGNAL(finished()), SIGNAL(finished())); connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64))); + if(oldPlayerHasVideo != hasVideo()) + { + emit hasVideoChanged(hasVideo()); + } + + if(oldPlayerSeekable != isSeekable()) + { + emit seekableChanged(isSeekable()); + } + TRACE_EXIT_0(); } diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h index 99223c3..f62f4f5 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.h +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -79,7 +79,18 @@ namespace Phonon void setVideoOutput(VideoOutput* videoOutput); Q_SIGNALS: - void totalTimeChanged(); + void totalTimeChanged(qint64 length); + void hasVideoChanged(bool hasVideo); + void seekableChanged(bool seekable); + // TODO: emit bufferStatus from MediaObject + void bufferStatus(int); + // TODO: emit aboutToFinish from MediaObject + void aboutToFinish(); + // TODO: emit prefinishMarkReached from MediaObject + void prefinishMarkReached(qint32); + // TODO: emit metaDataChanged from MediaObject + void metaDataChanged(const QMultiMap<QString, QString>& metaData); + void currentSourceChanged(const MediaSource& source); void stateChanged(Phonon::State oldState, Phonon::State newState); void finished(); diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index 828697c..30bf531 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -73,15 +73,18 @@ void MMF::VideoOutput::setFrameSize(const QSize& frameSize) QSize MMF::VideoOutput::sizeHint() const { - if(m_frameSize.isNull()) - { - // TODO: replace this with a more sensible default - return QSize(320, 240); - } - else + TRACE_CONTEXT(VideoOutput::sizeHint, EVideoApi); + + // TODO: replace this with a more sensible default + QSize result(320, 240); + + if(!m_frameSize.isNull()) { - return m_frameSize; + result = m_frameSize; } + + TRACE(" result %d %d", result.width(), result.height()); + return result; } void MMF::VideoOutput::paintEvent(QPaintEvent* event) @@ -96,7 +99,8 @@ void MMF::VideoOutput::paintEvent(QPaintEvent* event) QPaintEngine* MMF::VideoOutput::paintEngine() const { - return NULL; + TRACE_CONTEXT(VideoOutput::sizeHint, EVideoApi); + TRACE_RETURN("0x%08x", NULL); } void MMF::VideoOutput::resizeEvent(QResizeEvent* event) diff --git a/src/3rdparty/phonon/mmf/videoplayer.cpp b/src/3rdparty/phonon/mmf/videoplayer.cpp index 1e9522c..002c6f6 100644 --- a/src/3rdparty/phonon/mmf/videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer.cpp @@ -124,6 +124,19 @@ void MMF::VideoPlayer::doStop() m_player->Stop(); } +void MMF::VideoPlayer::doSeek(qint64 ms) +{ + TRACE_CONTEXT(VideoPlayer::doSeek, EVideoApi); + + TRAPD(err, m_player->SetPositionL(TTimeIntervalMicroSeconds(ms * 1000))); + + if(KErrNone != err) + { + TRACE("SetPositionL error %d", err); + setError(NormalError); + } +} + int MMF::VideoPlayer::setDeviceVolume(int mmfVolume) { TRAPD(err, m_player->SetVolumeL(mmfVolume)); @@ -141,22 +154,6 @@ void MMF::VideoPlayer::close() m_player->Close(); } -void MMF::VideoPlayer::seek(qint64 ms) -{ - TRACE_CONTEXT(VideoPlayer::seek, EVideoApi); - TRACE_ENTRY("state %d pos %Ld", state(), ms); - - TRAPD(err, m_player->SetPositionL(TTimeIntervalMicroSeconds(ms))); - - if(KErrNone != err) - { - TRACE("SetPositionL error %d", err); - setError(NormalError); - } - - TRACE_EXIT_0(); -} - bool MMF::VideoPlayer::hasVideo() const { return true; @@ -232,7 +229,7 @@ void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError) videoOutput().setFrameSize(m_frameSize); - emit totalTimeChanged(); + emit totalTimeChanged(totalTime()); changeState(StoppedState); } else diff --git a/src/3rdparty/phonon/mmf/videoplayer.h b/src/3rdparty/phonon/mmf/videoplayer.h index 8b5c467..bacec0b 100644 --- a/src/3rdparty/phonon/mmf/videoplayer.h +++ b/src/3rdparty/phonon/mmf/videoplayer.h @@ -50,12 +50,12 @@ namespace Phonon virtual void doPlay(); virtual void doPause(); virtual void doStop(); + virtual void doSeek(qint64 milliseconds); virtual int setDeviceVolume(int mmfVolume); virtual int openFile(RFile& file); virtual void close(); // MediaObjectInterface - virtual void seek(qint64 milliseconds); virtual bool hasVideo() const; virtual qint64 currentTime() const; virtual qint64 totalTime() const; @@ -68,7 +68,7 @@ namespace Phonon virtual void MvpuoEvent(const TMMFEvent &aEvent); Q_SIGNALS: - void totalTimeChanged(); + void totalTimeChanged(qint64 length); void stateChanged(Phonon::State oldState, Phonon::State newState); void finished(); |