summaryrefslogtreecommitdiffstats
path: root/src/3rdparty
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.cpp142
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.h18
-rw-r--r--src/3rdparty/phonon/mmf/abstractplayer.cpp107
-rw-r--r--src/3rdparty/phonon/mmf/abstractplayer.h39
-rw-r--r--src/3rdparty/phonon/mmf/audiooutput.cpp9
-rw-r--r--src/3rdparty/phonon/mmf/audiooutput.h3
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.cpp52
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.h12
-rw-r--r--src/3rdparty/phonon/mmf/defs.h34
-rw-r--r--src/3rdparty/phonon/mmf/dummyplayer.cpp60
-rw-r--r--src/3rdparty/phonon/mmf/dummyplayer.h23
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.cpp39
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.h1
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer.cpp54
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer.h8
15 files changed, 364 insertions, 237 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
index 0777276..a86f634 100644
--- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
@@ -17,7 +17,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "abstractmediaplayer.h"
-#include "audiooutput.h"
#include "utils.h"
using namespace Phonon;
@@ -27,12 +26,8 @@ using namespace Phonon::MMF;
// Constants
//-----------------------------------------------------------------------------
-const qint32 DefaultTickInterval = 20;
const int NullMaxVolume = -1;
-// TODO: consolidate this with constant used in AudioOutput
-const qreal InitialVolume = 0.5;
-
//-----------------------------------------------------------------------------
// Constructor / destructor
@@ -41,9 +36,17 @@ const qreal InitialVolume = 0.5;
MMF::AbstractMediaPlayer::AbstractMediaPlayer() :
m_state(GroundState)
, m_error(NoError)
- , m_tickInterval(DefaultTickInterval)
, m_tickTimer(new QTimer(this))
- , m_volume(InitialVolume)
+ , m_mmfMaxVolume(NullMaxVolume)
+{
+ connect(m_tickTimer.data(), SIGNAL(timeout()), this, SLOT(tick()));
+}
+
+MMF::AbstractMediaPlayer::AbstractMediaPlayer(const AbstractPlayer& player) :
+ AbstractPlayer(player)
+ , m_state(GroundState)
+ , m_error(NoError)
+ , m_tickTimer(new QTimer(this))
, m_mmfMaxVolume(NullMaxVolume)
{
connect(m_tickTimer.data(), SIGNAL(timeout()), this, SLOT(tick()));
@@ -159,20 +162,11 @@ bool MMF::AbstractMediaPlayer::isSeekable() const
return true;
}
-qint32 MMF::AbstractMediaPlayer::tickInterval() const
-{
- TRACE_CONTEXT(AbstractMediaPlayer::tickInterval, EAudioApi);
- TRACE_ENTRY("state %d", m_state);
-
- TRACE_RETURN("%d", m_tickInterval);
-}
-
-void MMF::AbstractMediaPlayer::setTickInterval(qint32 interval)
+void MMF::AbstractMediaPlayer::doSetTickInterval(qint32 interval)
{
- TRACE_CONTEXT(AbstractMediaPlayer::setTickInterval, EAudioApi);
- TRACE_ENTRY("state %d m_interval %d interval %d", m_state, m_tickInterval, interval);
+ TRACE_CONTEXT(AbstractMediaPlayer::doSetTickInterval, EAudioApi);
+ TRACE_ENTRY("state %d m_interval %d interval %d", m_state, tickInterval(), interval);
- m_tickInterval = interval;
m_tickTimer->setInterval(interval);
TRACE_EXIT_0();
@@ -206,66 +200,11 @@ Phonon::State MMF::AbstractMediaPlayer::state() const
TRACE_RETURN("%d", result);
}
-qint32 MMF::AbstractMediaPlayer::prefinishMark() const
-{
- TRACE_CONTEXT(AbstractMediaPlayer::prefinishMark, EAudioApi);
- TRACE_ENTRY("state %d", m_state);
-
- // TODO: implement prefinish mark
- const qint32 result = 0;
- TRACE_RETURN("%d", result);
-}
-
-void MMF::AbstractMediaPlayer::setPrefinishMark(qint32 mark)
-{
- TRACE_CONTEXT(AbstractMediaPlayer::setPrefinishMark, EAudioApi);
- TRACE_ENTRY("state %d mark %d", m_state, mark);
- Q_UNUSED(mark); // to silence warnings in release builds
-
- // TODO: implement prefinish mark
-
- TRACE_EXIT_0();
-}
-
-qint32 MMF::AbstractMediaPlayer::transitionTime() const
-{
- TRACE_CONTEXT(AbstractMediaPlayer::transitionTime, EAudioApi);
- TRACE_ENTRY("state %d", m_state);
-
- // TODO: implement transition time
- const qint32 result = 0;
- TRACE_RETURN("%d", result);
-}
-
-void MMF::AbstractMediaPlayer::setTransitionTime(qint32 time)
-{
- TRACE_CONTEXT(AbstractMediaPlayer::setTransitionTime, EAudioApi);
- TRACE_ENTRY("state %d time %d", m_state, time);
- Q_UNUSED(time); // to silence warnings in release builds
-
- // TODO: implement transition time
-
- TRACE_EXIT_0();
-}
-
MediaSource MMF::AbstractMediaPlayer::source() const
{
return m_source;
}
-void MMF::AbstractMediaPlayer::setNextSource(const MediaSource &source)
-{
- TRACE_CONTEXT(AbstractMediaPlayer::setNextSource, EAudioApi);
- TRACE_ENTRY("state %d", m_state);
-
- // TODO: handle 'next source'
-
- m_nextSource = source;
- Q_UNUSED(source);
-
- TRACE_EXIT_0();
-}
-
void MMF::AbstractMediaPlayer::setFileSource(const MediaSource &source, RFile& file)
{
TRACE_CONTEXT(AudioPlayer::setSource, EAudioApi);
@@ -335,29 +274,37 @@ void MMF::AbstractMediaPlayer::setFileSource(const MediaSource &source, RFile& f
TRACE_EXIT_0();
}
+void MMF::AbstractMediaPlayer::setNextSource(const MediaSource &source)
+{
+ TRACE_CONTEXT(AbstractMediaPlayer::setNextSource, EAudioApi);
+ TRACE_ENTRY("state %d", m_state);
+
+ // TODO: handle 'next source'
+
+ m_nextSource = source;
+ Q_UNUSED(source);
+
+ TRACE_EXIT_0();
+}
+
//-----------------------------------------------------------------------------
// VolumeControlInterface
//-----------------------------------------------------------------------------
-qreal MMF::AbstractMediaPlayer::volume() const
+bool MMF::AbstractMediaPlayer::doSetVolume(qreal volume)
{
- return m_volume;
-}
-
-bool MMF::AbstractMediaPlayer::setVolume(qreal volume)
-{
- TRACE_CONTEXT(AbstractMediaPlayer::setVolume, EAudioInternal);
+ TRACE_CONTEXT(AbstractMediaPlayer::doSetVolume, EAudioInternal);
TRACE_ENTRY("state %d", m_state);
- bool volumeChanged = false;
-
+ bool result = true;
+
switch(m_state)
{
case GroundState:
case LoadingState:
case ErrorState:
- m_volume = volume;
+ // Do nothing
break;
case StoppedState:
@@ -365,20 +312,13 @@ bool MMF::AbstractMediaPlayer::setVolume(qreal volume)
case PlayingState:
case BufferingState:
{
- if(volume != m_volume)
- {
- const int err = doSetVolume(volume * m_mmfMaxVolume);
+ const int err = doSetMmfVolume(volume * m_mmfMaxVolume);
- if(KErrNone == err)
- {
- m_volume = volume;
- volumeChanged = true;
- }
- else
- {
- m_error = NormalError;
- changeState(ErrorState);
- }
+ if(KErrNone != err)
+ {
+ m_error = NormalError;
+ changeState(ErrorState);
+ result = false;
}
break;
}
@@ -388,8 +328,8 @@ bool MMF::AbstractMediaPlayer::setVolume(qreal volume)
default:
TRACE_PANIC(InvalidStatePanic);
}
-
- TRACE_RETURN("%d", volumeChanged);
+
+ return result;
}
@@ -399,7 +339,7 @@ bool MMF::AbstractMediaPlayer::setVolume(qreal volume)
void MMF::AbstractMediaPlayer::startTickTimer()
{
- m_tickTimer->start(m_tickInterval);
+ m_tickTimer->start(tickInterval());
}
void MMF::AbstractMediaPlayer::stopTickTimer()
@@ -410,7 +350,7 @@ void MMF::AbstractMediaPlayer::stopTickTimer()
void MMF::AbstractMediaPlayer::initVolume(int mmfMaxVolume)
{
m_mmfMaxVolume = mmfMaxVolume;
- doSetVolume(m_volume * m_mmfMaxVolume);
+ doSetVolume(volume() * m_mmfMaxVolume);
}
Phonon::State MMF::AbstractMediaPlayer::phononState() const
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h
index 2f95e73..0c233c9 100644
--- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h
@@ -42,6 +42,7 @@ namespace Phonon
protected:
AbstractMediaPlayer();
+ explicit AbstractMediaPlayer(const AbstractPlayer& player);
~AbstractMediaPlayer();
public:
@@ -50,28 +51,23 @@ namespace Phonon
virtual void pause();
virtual void stop();
virtual bool isSeekable() const;
- virtual qint32 tickInterval() const;
- virtual void setTickInterval(qint32 interval);
virtual Phonon::ErrorType errorType() const;
virtual QString errorString() const;
virtual Phonon::State state() const;
- virtual qint32 prefinishMark() const;
- virtual void setPrefinishMark(qint32);
- virtual qint32 transitionTime() const;
- virtual void setTransitionTime(qint32);
virtual MediaSource source() const;
virtual void setFileSource(const Phonon::MediaSource&, RFile&);
virtual void setNextSource(const MediaSource &source);
- // VolumeControlInterface
- qreal volume() const;
- bool setVolume(qreal volume);
+ protected:
+ // AbstractPlayer
+ virtual void doSetTickInterval(qint32 interval);
+ virtual bool doSetVolume(qreal volume);
protected:
virtual void doPlay() = 0;
virtual void doPause() = 0;
virtual void doStop() = 0;
- virtual int doSetVolume(int mmfVolume) = 0;
+ virtual int doSetMmfVolume(int mmfVolume) = 0;
virtual int openFile(RFile& file) = 0;
virtual void close() = 0;
@@ -131,9 +127,7 @@ namespace Phonon
PrivateState m_state;
Phonon::ErrorType m_error;
- qint32 m_tickInterval;
QScopedPointer<QTimer> m_tickTimer;
- qreal m_volume;
int m_mmfMaxVolume;
MediaSource m_source;
diff --git a/src/3rdparty/phonon/mmf/abstractplayer.cpp b/src/3rdparty/phonon/mmf/abstractplayer.cpp
new file mode 100644
index 0000000..7786d8b
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp
@@ -0,0 +1,107 @@
+/* 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/>.
+
+*/
+
+#include "abstractplayer.h"
+#include "defs.h"
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+
+//-----------------------------------------------------------------------------
+// Constructor / destructor
+//-----------------------------------------------------------------------------
+
+MMF::AbstractPlayer::AbstractPlayer() :
+ m_tickInterval(DefaultTickInterval)
+ , m_volume(InitialVolume)
+ , m_transitionTime(0)
+ , m_prefinishMark(0)
+{
+
+}
+
+MMF::AbstractPlayer::AbstractPlayer(const AbstractPlayer& player) :
+ m_tickInterval(player.tickInterval())
+ , m_volume(player.volume())
+ , m_transitionTime(player.transitionTime())
+ , m_prefinishMark(player.prefinishMark())
+{
+
+}
+
+//-----------------------------------------------------------------------------
+// MediaObjectInterface
+//-----------------------------------------------------------------------------
+
+qint32 MMF::AbstractPlayer::tickInterval() const
+{
+ return m_tickInterval;
+}
+
+void MMF::AbstractPlayer::setTickInterval(qint32 interval)
+{
+ m_tickInterval = interval;
+ doSetTickInterval(interval);
+}
+
+qint32 MMF::AbstractPlayer::prefinishMark() const
+{
+ return m_prefinishMark;
+}
+
+void MMF::AbstractPlayer::setPrefinishMark(qint32 mark)
+{
+ m_prefinishMark = mark;
+}
+
+qint32 MMF::AbstractPlayer::transitionTime() const
+{
+ return m_transitionTime;
+}
+
+void MMF::AbstractPlayer::setTransitionTime(qint32 time)
+{
+ m_transitionTime = time;
+}
+
+
+//-----------------------------------------------------------------------------
+// VolumeControlInterface
+//-----------------------------------------------------------------------------
+
+qreal MMF::AbstractPlayer::volume() const
+{
+ return m_volume;
+}
+
+bool MMF::AbstractPlayer::setVolume(qreal volume)
+{
+ bool result = false;
+ if(volume != m_volume)
+ {
+ result = doSetVolume(volume);
+ if(result)
+ {
+ m_volume = volume;
+ }
+ }
+ return result;
+}
+
+
diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h
index 0f496ac..546d929 100644
--- a/src/3rdparty/phonon/mmf/abstractplayer.h
+++ b/src/3rdparty/phonon/mmf/abstractplayer.h
@@ -34,9 +34,11 @@ namespace Phonon
class AudioOutput;
/**
- * Interface which abstracts from MediaObject the current media type.
+ * @short Interface which abstracts from MediaObject the current
+ * media type
+ *
* This may be:
- * - Nothing, in which case this interface is implemented by
+ * - Nothing, in which case this interface is implemented by
* DummyPlayer
* - Audio, in which case the implementation is AudioPlayer
* - Video, in which case the implementation is VideoPlayer
@@ -49,13 +51,22 @@ namespace Phonon
Q_OBJECT
public:
- // Mirror of Phonon::MediaObjectInterfac
+ AbstractPlayer();
+ explicit AbstractPlayer(const AbstractPlayer& player);
+
+ // MediaObjectInterface (implemented)
+ qint32 tickInterval() const;
+ void setTickInterval(qint32);
+ void setTransitionTime(qint32);
+ qint32 transitionTime() const;
+ void setPrefinishMark(qint32);
+ qint32 prefinishMark() const;
+
+ // MediaObjectInterface (abstract)
virtual void play() = 0;
virtual void pause() = 0;
virtual void stop() = 0;
virtual void seek(qint64 milliseconds) = 0;
- virtual qint32 tickInterval() const = 0;
- virtual void setTickInterval(qint32) = 0;
virtual bool hasVideo() const = 0;
virtual bool isSeekable() const = 0;
virtual qint64 currentTime() const = 0;
@@ -69,10 +80,20 @@ namespace Phonon
//virtual void setSource(const Phonon::MediaSource &) = 0;
virtual void setFileSource(const Phonon::MediaSource&, RFile&) = 0;
virtual void setNextSource(const Phonon::MediaSource &) = 0;
- virtual void setTransitionTime(qint32) = 0;
- virtual qint32 transitionTime() const = 0;
- virtual qint32 prefinishMark() const = 0;
- virtual void setPrefinishMark(qint32) = 0;
+
+ // VolumeControlInterface
+ qreal volume() const;
+ bool setVolume(qreal volume);
+
+ private:
+ virtual void doSetTickInterval(qint32 interval) = 0;
+ virtual bool doSetVolume(qreal volume) = 0;
+
+ private:
+ qint32 m_tickInterval;
+ qreal m_volume;
+ qint32 m_transitionTime;
+ qint32 m_prefinishMark;
};
}
diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp
index 77d9a6d..2e5cbc6 100644
--- a/src/3rdparty/phonon/mmf/audiooutput.cpp
+++ b/src/3rdparty/phonon/mmf/audiooutput.cpp
@@ -18,8 +18,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <e32debug.h>
-#include "mediaobject.h"
#include "audiooutput.h"
+#include "defs.h"
#include "utils.h"
#include "volumecontrolinterface.h"
@@ -28,13 +28,6 @@ using namespace Phonon::MMF;
//-----------------------------------------------------------------------------
-// Constants
-//-----------------------------------------------------------------------------
-
-static const qreal InitialVolume = 0.5;
-
-
-//-----------------------------------------------------------------------------
// Constructor / destructor
//-----------------------------------------------------------------------------
diff --git a/src/3rdparty/phonon/mmf/audiooutput.h b/src/3rdparty/phonon/mmf/audiooutput.h
index b8290c7..016ec8e 100644
--- a/src/3rdparty/phonon/mmf/audiooutput.h
+++ b/src/3rdparty/phonon/mmf/audiooutput.h
@@ -32,7 +32,8 @@ namespace Phonon
* @short AudioOutputInterface implementation for MMF.
*
* Forwards volume commands to the VolumeControlInterface instance,
- * provided by the backend.
+ * which is provided by the backend when MediaNode objects are
+ * connected.
*
* \section volume Volume
*
diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp
index c0a0767..f7ab0df 100644
--- a/src/3rdparty/phonon/mmf/audioplayer.cpp
+++ b/src/3rdparty/phonon/mmf/audioplayer.cpp
@@ -28,19 +28,31 @@ using namespace Phonon::MMF;
// Constructor / destructor
//-----------------------------------------------------------------------------
-MMF::AudioPlayer::AudioPlayer() : m_player(NULL)
+MMF::AudioPlayer::AudioPlayer() : m_player(NULL)
{
- TRACE_CONTEXT(AudioPlayer::AudioPlayer, EAudioApi);
- TRACE_ENTRY_0();
+ construct();
+}
- // TODO: is this the correct way to handle errors in constructing Symbian objects?
- TRAPD(err, m_player = CPlayerType::NewL(*this, 0, EMdaPriorityPreferenceNone));
- if(KErrNone != err)
- {
+MMF::AudioPlayer::AudioPlayer(const AbstractPlayer& player)
+ : AbstractMediaPlayer(player)
+ , m_player(NULL)
+{
+ construct();
+}
+
+void MMF::AudioPlayer::construct()
+{
+ TRACE_CONTEXT(AudioPlayer::AudioPlayer, EAudioApi);
+ TRACE_ENTRY_0();
+
+ // TODO: is this the correct way to handle errors in constructing Symbian objects?
+ TRAPD(err, m_player = CPlayerType::NewL(*this, 0, EMdaPriorityPreferenceNone));
+ if(KErrNone != err)
+ {
changeState(ErrorState);
- }
-
- TRACE_EXIT_0();
+ }
+
+ TRACE_EXIT_0();
}
MMF::AudioPlayer::~AudioPlayer()
@@ -72,7 +84,7 @@ void MMF::AudioPlayer::doStop()
m_player->Stop();
}
-int MMF::AudioPlayer::doSetVolume(int mmfVolume)
+int MMF::AudioPlayer::doSetMmfVolume(int mmfVolume)
{
return m_player->SetVolume(mmfVolume);
}
@@ -164,22 +176,10 @@ void MMF::AudioPlayer::MapcInitComplete(TInt aError,
if(KErrNone == aError)
{
-// TODO: CLEANUP
-/*
- TInt volume = 0;
- aError = m_player->GetVolume(volume);
- if(KErrNone == aError)
- {
-*/
- initVolume(m_player->MaxVolume());
+ initVolume(m_player->MaxVolume());
- emit totalTimeChanged();
- changeState(StoppedState);
-
-// TODO: CLEANUP
-/*
- }
-*/
+ emit totalTimeChanged();
+ changeState(StoppedState);
}
else
{
diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h
index 39e55d9..b73ea44 100644
--- a/src/3rdparty/phonon/mmf/audioplayer.h
+++ b/src/3rdparty/phonon/mmf/audioplayer.h
@@ -39,10 +39,7 @@ namespace Phonon
namespace MMF
{
/**
- *
- * See
- * <a href="http://wiki.forum.nokia.com/index.php/How_to_play_a_video_file_using_CVideoPlayerUtility">How to
- * play a video file using CVideoPlayerUtility</a>
+ * @short Wrapper over MMF audio client utility
*/
class AudioPlayer : public AbstractMediaPlayer
, public MPlayerObserverType // typedef
@@ -54,16 +51,18 @@ namespace Phonon
public:
AudioPlayer();
+ explicit AudioPlayer(const AbstractPlayer& player);
virtual ~AudioPlayer();
// AbstractMediaPlayer
virtual void doPlay();
virtual void doPause();
virtual void doStop();
- virtual int doSetVolume(int mmfVolume);
+ virtual int doSetMmfVolume(int mmfVolume);
virtual int openFile(RFile& file);
virtual void close();
+ // MediaObjectInterface
virtual void seek(qint64 milliseconds);
virtual bool hasVideo() const;
virtual qint64 currentTime() const;
@@ -88,6 +87,9 @@ namespace Phonon
Q_SIGNALS:
void totalTimeChanged();
void finished();
+
+ private:
+ void construct();
private:
/**
diff --git a/src/3rdparty/phonon/mmf/defs.h b/src/3rdparty/phonon/mmf/defs.h
new file mode 100644
index 0000000..d31cabb
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/defs.h
@@ -0,0 +1,34 @@
+/* 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_DEFS_H
+#define PHONON_MMF_DEFS_H
+
+#include <QtGlobal>
+
+namespace Phonon
+{
+ namespace MMF
+ {
+ static const qint32 DefaultTickInterval = 20;
+ static const qreal InitialVolume = 0.5;
+
+ }
+}
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/dummyplayer.cpp b/src/3rdparty/phonon/mmf/dummyplayer.cpp
index 26257c0..737af78 100644
--- a/src/3rdparty/phonon/mmf/dummyplayer.cpp
+++ b/src/3rdparty/phonon/mmf/dummyplayer.cpp
@@ -22,32 +22,43 @@ using namespace Phonon;
using namespace Phonon::MMF;
//-----------------------------------------------------------------------------
-// Public functions (AbstractPlayer interface)
+// Constructor / destructor
//-----------------------------------------------------------------------------
-void MMF::DummyPlayer::play()
+MMF::DummyPlayer::DummyPlayer()
{
+
}
-void MMF::DummyPlayer::pause()
+MMF::DummyPlayer::DummyPlayer(const AbstractPlayer& player)
+ : AbstractPlayer(player)
{
+
}
-void MMF::DummyPlayer::stop()
+
+//-----------------------------------------------------------------------------
+// MediaObjectInterface
+//-----------------------------------------------------------------------------
+
+void MMF::DummyPlayer::play()
{
+
}
-void MMF::DummyPlayer::seek(qint64)
+void MMF::DummyPlayer::pause()
{
+
}
-qint32 MMF::DummyPlayer::tickInterval() const
+void MMF::DummyPlayer::stop()
{
- return 0;
+
}
-void MMF::DummyPlayer::setTickInterval(qint32)
+void MMF::DummyPlayer::seek(qint64)
{
+
}
bool MMF::DummyPlayer::hasVideo() const
@@ -90,46 +101,29 @@ MediaSource MMF::DummyPlayer::source() const
return MediaSource();
}
-/*
-void MMF::DummyPlayer::setSource(const MediaSource &)
+void MMF::DummyPlayer::setFileSource(const Phonon::MediaSource &, RFile &)
{
-}
-*/
-void MMF::DummyPlayer::setNextSource(const MediaSource &)
-{
}
-qint32 MMF::DummyPlayer::prefinishMark() const
+void MMF::DummyPlayer::setNextSource(const MediaSource &)
{
- return 0;
-}
-void MMF::DummyPlayer::setPrefinishMark(qint32)
-{
}
-qint32 MMF::DummyPlayer::transitionTime() const
-{
- return 0;
-}
-void MMF::DummyPlayer::setTransitionTime(qint32)
-{
-}
+//-----------------------------------------------------------------------------
+// AbstractPlayer
+//-----------------------------------------------------------------------------
-void MMF::DummyPlayer::setFileSource(const Phonon::MediaSource &, RFile &)
+void MMF::DummyPlayer::doSetTickInterval(qint32)
{
-}
-qreal MMF::DummyPlayer::volume() const
-{
- return 0;
}
-bool MMF::DummyPlayer::setVolume(qreal)
+bool MMF::DummyPlayer::doSetVolume(qreal)
{
- return true;
+ return true;
}
diff --git a/src/3rdparty/phonon/mmf/dummyplayer.h b/src/3rdparty/phonon/mmf/dummyplayer.h
index e5c1365..6a2ad73 100644
--- a/src/3rdparty/phonon/mmf/dummyplayer.h
+++ b/src/3rdparty/phonon/mmf/dummyplayer.h
@@ -40,13 +40,14 @@ namespace Phonon
class DummyPlayer : public AbstractPlayer
{
public:
+ DummyPlayer();
+ DummyPlayer(const AbstractPlayer& player);
+
// MediaObjectInterface
virtual void play();
virtual void pause();
virtual void stop();
virtual void seek(qint64 milliseconds);
- virtual qint32 tickInterval() const;
- virtual void setTickInterval(qint32 interval);
virtual bool hasVideo() const;
virtual bool isSeekable() const;
virtual qint64 currentTime() const;
@@ -55,24 +56,14 @@ namespace Phonon
virtual Phonon::ErrorType errorType() const;
virtual qint64 totalTime() const;
virtual MediaSource source() const;
- // virtual void setSource(const MediaSource &);
+ // virtual void setSource(const MediaSource &);
virtual void setFileSource(const Phonon::MediaSource&, RFile&);
virtual void setNextSource(const MediaSource &source);
- virtual qint32 prefinishMark() const;
- virtual void setPrefinishMark(qint32);
- virtual qint32 transitionTime() const;
- virtual void setTransitionTime(qint32);
- // VolumeControlInterface
- virtual qreal volume() const;
- virtual bool setVolume(qreal volume);
+ // AbstractPlayer
+ virtual void doSetTickInterval(qint32 interval);
+ virtual bool doSetVolume(qreal volume);
- Q_SIGNALS:
- void totalTimeChanged();
- void stateChanged(Phonon::State oldState,
- Phonon::State newState);
- void finished();
- void tick(qint64 time);
};
}
}
diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp
index 6b32eb3..0336109 100644
--- a/src/3rdparty/phonon/mmf/mediaobject.cpp
+++ b/src/3rdparty/phonon/mmf/mediaobject.cpp
@@ -230,6 +230,8 @@ void MMF::MediaObject::createPlayer(const MediaSource &source)
MediaType mediaType = MediaTypeUnknown;
+ AbstractPlayer* oldPlayer = m_player.data();
+
// Determine media type
switch(source.type())
{
@@ -265,13 +267,26 @@ void MMF::MediaObject::createPlayer(const MediaSource &source)
break;
}
+ AbstractPlayer* newPlayer = NULL;
+
+ // Construct newPlayer using oldPlayer (if not NULL) in order to copy
+ // parameters (volume, prefinishMark, transitionTime) which may have
+ // been set on oldPlayer.
+
switch(mediaType)
{
case MediaTypeUnknown:
TRACE_0("Media type could not be determined");
- m_player.reset(new DummyPlayer());
+ if(oldPlayer)
+ {
+ newPlayer = new DummyPlayer(*oldPlayer);
+ }
+ else
+ {
+ newPlayer = new DummyPlayer();
+ }
/*
- * TODO: handle error
+ * TODO: handle error?
*
m_error = NormalError;
changeState(ErrorState);
@@ -279,13 +294,29 @@ void MMF::MediaObject::createPlayer(const MediaSource &source)
break;
case MediaTypeAudio:
- m_player.reset(new AudioPlayer());
+ if(oldPlayer)
+ {
+ newPlayer = new AudioPlayer(*oldPlayer);
+ }
+ else
+ {
+ newPlayer = new AudioPlayer();
+ }
break;
case MediaTypeVideo:
- m_player.reset(new VideoPlayer());
+ if(oldPlayer)
+ {
+ newPlayer = new VideoPlayer(*oldPlayer);
+ }
+ else
+ {
+ newPlayer = new VideoPlayer();
+ }
break;
}
+
+ m_player.reset(newPlayer);
connect(m_player.data(), SIGNAL(totalTimeChanged()), SIGNAL(totalTimeChanged()));
connect(m_player.data(), SIGNAL(stateChanged(Phonon::State, Phonon::State)), SIGNAL(stateChanged(Phonon::State, Phonon::State)));
diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h
index 97ea115..a6d932d 100644
--- a/src/3rdparty/phonon/mmf/mediaobject.h
+++ b/src/3rdparty/phonon/mmf/mediaobject.h
@@ -37,6 +37,7 @@ namespace Phonon
class AudioOutput;
/**
+ * @short Facade class which wraps MMF client utility instance
*/
class MediaObject : public QObject
, public MediaObjectInterface
diff --git a/src/3rdparty/phonon/mmf/videoplayer.cpp b/src/3rdparty/phonon/mmf/videoplayer.cpp
index 6bbd010..b0c786b 100644
--- a/src/3rdparty/phonon/mmf/videoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/videoplayer.cpp
@@ -35,23 +35,35 @@ using namespace Phonon::MMF;
MMF::VideoPlayer::VideoPlayer() : m_widget(new QWidget())
{
- TRACE_CONTEXT(VideoPlayer::VideoPlayer, EAudioApi);
- TRACE_ENTRY_0();
-
- CCoeControl* control = m_widget->winId();
- CCoeEnv* coeEnv = control->ControlEnv();
-
- const TInt priority = 0;
- const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone;
- RWsSession& wsSession = coeEnv->WsSession();
- CWsScreenDevice& screenDevice = *(coeEnv->ScreenDevice());
- RDrawableWindow& window = *(control->DrawableWindow());
- const TRect screenRect = control->Rect();
- const TRect clipRect = control->Rect();
-
- // TODO: is this the correct way to handle errors in constructing Symbian objects?
- TRAPD(err,
- m_player = CVideoPlayerUtility::NewL
+ construct();
+}
+
+MMF::VideoPlayer::VideoPlayer(const AbstractPlayer& player)
+ : AbstractMediaPlayer(player)
+ , m_widget(new QWidget())
+{
+ construct();
+}
+
+void MMF::VideoPlayer::construct()
+{
+ TRACE_CONTEXT(VideoPlayer::VideoPlayer, EAudioApi);
+ TRACE_ENTRY_0();
+
+ CCoeControl* control = m_widget->winId();
+ CCoeEnv* coeEnv = control->ControlEnv();
+
+ const TInt priority = 0;
+ const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone;
+ RWsSession& wsSession = coeEnv->WsSession();
+ CWsScreenDevice& screenDevice = *(coeEnv->ScreenDevice());
+ RDrawableWindow& window = *(control->DrawableWindow());
+ const TRect screenRect = control->Rect();
+ const TRect clipRect = control->Rect();
+
+ // TODO: is this the correct way to handle errors in constructing Symbian objects?
+ TRAPD(err,
+ m_player = CVideoPlayerUtility::NewL
(
*this,
priority, preference,
@@ -60,13 +72,13 @@ MMF::VideoPlayer::VideoPlayer() : m_widget(new QWidget())
screenRect, clipRect
)
);
-
+
if(KErrNone != err)
{
changeState(ErrorState);
}
-
- TRACE_EXIT_0();
+
+ TRACE_EXIT_0();
}
MMF::VideoPlayer::~VideoPlayer()
@@ -98,7 +110,7 @@ void MMF::VideoPlayer::doStop()
// TODO
}
-int MMF::VideoPlayer::doSetVolume(int mmfVolume)
+int MMF::VideoPlayer::doSetMmfVolume(int mmfVolume)
{
// TODO
Q_UNUSED(mmfVolume);
diff --git a/src/3rdparty/phonon/mmf/videoplayer.h b/src/3rdparty/phonon/mmf/videoplayer.h
index ae44ec3..9bf2622 100644
--- a/src/3rdparty/phonon/mmf/videoplayer.h
+++ b/src/3rdparty/phonon/mmf/videoplayer.h
@@ -31,6 +31,7 @@ namespace Phonon
namespace MMF
{
/**
+ * @short Wrapper over MMF video client utility
*
* See
* <a href="http://wiki.forum.nokia.com/index.php/How_to_play_a_video_file_using_CVideoPlayerUtility">How to
@@ -42,16 +43,18 @@ namespace Phonon
Q_OBJECT
public:
VideoPlayer();
+ explicit VideoPlayer(const AbstractPlayer& player);
virtual ~VideoPlayer();
// AbstractPlayer
virtual void doPlay();
virtual void doPause();
virtual void doStop();
- virtual int doSetVolume(int mmfVolume);
+ virtual int doSetMmfVolume(int mmfVolume);
virtual int openFile(RFile& file);
virtual void close();
+ // MediaObjectInterface
virtual void seek(qint64 milliseconds);
virtual bool hasVideo() const;
virtual qint64 currentTime() const;
@@ -71,6 +74,9 @@ namespace Phonon
void finished();
private:
+ void construct();
+
+ private:
CVideoPlayerUtility* m_player;
QScopedPointer<QWidget> m_widget;