summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/phonon/mmf/TODO.txt5
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.cpp347
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.h247
-rw-r--r--src/3rdparty/phonon/mmf/abstractplayer.cpp24
-rw-r--r--src/3rdparty/phonon/mmf/abstractplayer.h142
-rw-r--r--src/3rdparty/phonon/mmf/audiooutput.cpp33
-rw-r--r--src/3rdparty/phonon/mmf/audiooutput.h120
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.cpp127
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.h114
-rw-r--r--src/3rdparty/phonon/mmf/backend.cpp177
-rw-r--r--src/3rdparty/phonon/mmf/backend.h46
-rw-r--r--src/3rdparty/phonon/mmf/defs.h27
-rw-r--r--src/3rdparty/phonon/mmf/dummyplayer.cpp6
-rw-r--r--src/3rdparty/phonon/mmf/dummyplayer.h90
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.cpp343
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.h176
-rw-r--r--src/3rdparty/phonon/mmf/utils.cpp24
-rw-r--r--src/3rdparty/phonon/mmf/utils.h250
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.cpp126
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.h68
-rw-r--r--src/3rdparty/phonon/mmf/videooutputobserver.h24
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer.cpp407
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer.h150
-rw-r--r--src/3rdparty/phonon/mmf/videowidget.cpp94
-rw-r--r--src/3rdparty/phonon/mmf/videowidget.h86
-rw-r--r--src/3rdparty/phonon/mmf/volumeobserver.h24
26 files changed, 1591 insertions, 1686 deletions
diff --git a/src/3rdparty/phonon/mmf/TODO.txt b/src/3rdparty/phonon/mmf/TODO.txt
index 7f20793..846f0bb 100644
--- a/src/3rdparty/phonon/mmf/TODO.txt
+++ b/src/3rdparty/phonon/mmf/TODO.txt
@@ -37,9 +37,4 @@ Compare video frame rate obtained using default S60 media player and Qt demo app
* Implement MMF::Backend::disconnectNodes
This should probably be left for now, particularly until audio effects have been implemented. This is because the node connection mechanism may need to be refactored slightly once we start building up longer graphs (e.g. MediaObject -> Effect -> Effect -> AudioOutput).
-* Fix code layout
-My editor was set to use tabs for indenting, rather than the Qt standard of 4 spaces. So we can either:
- 1. Do "s/\t/ /g" - which will just fix the indenting
- 2. Use http://astyle.sourceforge.net/:
- astyle --indent=spaces=4 --brackets=linux --indent-labels --pad=oper --unpad=paren --one-line=keep-statements --convert-tabs --indent-preprocessor --recursive ./
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
index 7883709..1e032f3 100644
--- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
@@ -29,7 +29,7 @@ using namespace Phonon::MMF;
// Constants
//-----------------------------------------------------------------------------
-const int NullMaxVolume = -1;
+const int NullMaxVolume = -1;
//-----------------------------------------------------------------------------
@@ -37,31 +37,31 @@ const int NullMaxVolume = -1;
//-----------------------------------------------------------------------------
MMF::AbstractMediaPlayer::AbstractMediaPlayer() :
- m_state(GroundState)
- , m_error(NoError)
- , m_playPending(false)
- , m_tickTimer(new QTimer(this))
- , m_volume(InitialVolume)
- , m_mmfMaxVolume(NullMaxVolume)
+ m_state(GroundState)
+ , m_error(NoError)
+ , m_playPending(false)
+ , m_tickTimer(new QTimer(this))
+ , m_volume(InitialVolume)
+ , m_mmfMaxVolume(NullMaxVolume)
{
- connect(m_tickTimer.data(), SIGNAL(timeout()), this, SLOT(tick()));
+ connect(m_tickTimer.data(), SIGNAL(timeout()), this, SLOT(tick()));
}
MMF::AbstractMediaPlayer::AbstractMediaPlayer(const AbstractPlayer& player) :
- AbstractPlayer(player)
- , m_state(GroundState)
- , m_error(NoError)
- , m_playPending(false)
- , m_tickTimer(new QTimer(this))
- , m_volume(InitialVolume)
- , m_mmfMaxVolume(NullMaxVolume)
+ AbstractPlayer(player)
+ , m_state(GroundState)
+ , m_error(NoError)
+ , m_playPending(false)
+ , m_tickTimer(new QTimer(this))
+ , m_volume(InitialVolume)
+ , m_mmfMaxVolume(NullMaxVolume)
{
- connect(m_tickTimer.data(), SIGNAL(timeout()), this, SLOT(tick()));
+ connect(m_tickTimer.data(), SIGNAL(timeout()), this, SLOT(tick()));
}
MMF::AbstractMediaPlayer::~AbstractMediaPlayer()
{
-
+
}
@@ -74,34 +74,33 @@ void MMF::AbstractMediaPlayer::play()
TRACE_CONTEXT(AbstractMediaPlayer::play, EAudioApi);
TRACE_ENTRY("state %d", m_state);
- switch(m_state)
- {
- case GroundState:
- // Is this the correct error? Really we want 'NotReadyError'
- m_error = NormalError;
- changeState(ErrorState);
- break;
-
- case LoadingState:
- m_playPending = true;
- break;
-
- case StoppedState:
- case PausedState:
- doPlay();
- startTickTimer();
- changeState(PlayingState);
- break;
-
- case PlayingState:
- case BufferingState:
- case ErrorState:
- // Do nothing
- break;
+ switch (m_state) {
+ case GroundState:
+ // Is this the correct error? Really we want 'NotReadyError'
+ m_error = NormalError;
+ changeState(ErrorState);
+ break;
+
+ case LoadingState:
+ m_playPending = true;
+ break;
+
+ case StoppedState:
+ case PausedState:
+ doPlay();
+ startTickTimer();
+ changeState(PlayingState);
+ break;
+
+ case PlayingState:
+ case BufferingState:
+ case ErrorState:
+ // Do nothing
+ break;
// Protection against adding new states and forgetting to update this switch
- default:
- TRACE_PANIC(InvalidStatePanic);
+ default:
+ TRACE_PANIC(InvalidStatePanic);
}
TRACE_EXIT("state %d", m_state);
@@ -113,27 +112,26 @@ void MMF::AbstractMediaPlayer::pause()
TRACE_ENTRY("state %d", m_state);
m_playPending = false;
-
- switch(m_state)
- {
- case GroundState:
- case LoadingState:
- case StoppedState:
- case PausedState:
- case ErrorState:
- // Do nothing
- break;
-
- case PlayingState:
- case BufferingState:
- doPause();
- stopTickTimer();
- changeState(PausedState);
- break;
+
+ switch (m_state) {
+ case GroundState:
+ case LoadingState:
+ case StoppedState:
+ case PausedState:
+ case ErrorState:
+ // Do nothing
+ break;
+
+ case PlayingState:
+ case BufferingState:
+ doPause();
+ stopTickTimer();
+ changeState(PausedState);
+ break;
// Protection against adding new states and forgetting to update this switch
- default:
- TRACE_PANIC(InvalidStatePanic);
+ default:
+ TRACE_PANIC(InvalidStatePanic);
}
TRACE_EXIT("state %d", m_state);
@@ -145,27 +143,26 @@ void MMF::AbstractMediaPlayer::stop()
TRACE_ENTRY("state %d", m_state);
m_playPending = false;
-
- switch(m_state)
- {
- case GroundState:
- case LoadingState:
- case StoppedState:
- case ErrorState:
- // Do nothing
- break;
-
- case PlayingState:
- case BufferingState:
- case PausedState:
- doStop();
- stopTickTimer();
- changeState(StoppedState);
- break;
+
+ switch (m_state) {
+ case GroundState:
+ case LoadingState:
+ case StoppedState:
+ case ErrorState:
+ // Do nothing
+ break;
+
+ case PlayingState:
+ case BufferingState:
+ case PausedState:
+ doStop();
+ stopTickTimer();
+ changeState(StoppedState);
+ break;
// Protection against adding new states and forgetting to update this switch
- default:
- TRACE_PANIC(InvalidStatePanic);
+ default:
+ TRACE_PANIC(InvalidStatePanic);
}
TRACE_EXIT("state %d", m_state);
@@ -177,23 +174,22 @@ void MMF::AbstractMediaPlayer::seek(qint64 ms)
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)
- {
+
+ if (tickTimerWasRunning) {
startTickTimer();
}
-
+
TRACE_EXIT_0();
}
bool MMF::AbstractMediaPlayer::isSeekable() const
{
- return true;
+ return true;
}
void MMF::AbstractMediaPlayer::doSetTickInterval(qint32 interval)
@@ -209,7 +205,7 @@ void MMF::AbstractMediaPlayer::doSetTickInterval(qint32 interval)
Phonon::ErrorType MMF::AbstractMediaPlayer::errorType() const
{
const Phonon::ErrorType result = (ErrorState == m_state)
- ? m_error : NoError;
+ ? m_error : NoError;
return result;
}
@@ -244,58 +240,52 @@ void MMF::AbstractMediaPlayer::setFileSource(const MediaSource &source, RFile& f
TInt symbianErr = KErrNone;
- switch(m_source.type())
- {
- case MediaSource::LocalFile:
- {
- // TODO: work out whose responsibility it is to ensure that paths
- // are Symbian-style, i.e. have backslashes for path delimiters.
- // Until then, use this utility function...
- //const QHBufC filename = Utils::symbianFilename(m_source.fileName());
- //TRAP(symbianErr, m_player->OpenFileL(*filename));
-
- // Open using shared filehandle
- // This is a temporary hack to work around KErrInUse from MMF
- // client utility OpenFileL calls
- //TRAP(symbianErr, m_player->OpenFileL(file));
-
- symbianErr = openFile(file);
- break;
- }
+ switch (m_source.type()) {
+ case MediaSource::LocalFile: {
+ // TODO: work out whose responsibility it is to ensure that paths
+ // are Symbian-style, i.e. have backslashes for path delimiters.
+ // Until then, use this utility function...
+ //const QHBufC filename = Utils::symbianFilename(m_source.fileName());
+ //TRAP(symbianErr, m_player->OpenFileL(*filename));
+
+ // Open using shared filehandle
+ // This is a temporary hack to work around KErrInUse from MMF
+ // client utility OpenFileL calls
+ //TRAP(symbianErr, m_player->OpenFileL(file));
+
+ symbianErr = openFile(file);
+ break;
+ }
- case MediaSource::Url:
- {
- TRACE_0("Source type not supported");
- // TODO: support opening URLs
- symbianErr = KErrNotSupported;
- break;
- }
+ case MediaSource::Url: {
+ TRACE_0("Source type not supported");
+ // TODO: support opening URLs
+ symbianErr = KErrNotSupported;
+ break;
+ }
- case MediaSource::Invalid:
- case MediaSource::Disc:
- case MediaSource::Stream:
- TRACE_0("Source type not supported");
- symbianErr = KErrNotSupported;
- break;
+ case MediaSource::Invalid:
+ case MediaSource::Disc:
+ case MediaSource::Stream:
+ TRACE_0("Source type not supported");
+ symbianErr = KErrNotSupported;
+ break;
- case MediaSource::Empty:
- TRACE_0("Empty source - doing nothing");
- TRACE_EXIT_0();
- return;
+ case MediaSource::Empty:
+ TRACE_0("Empty source - doing nothing");
+ TRACE_EXIT_0();
+ return;
// Protection against adding new media types and forgetting to update this switch
- default:
- TRACE_PANIC(InvalidMediaTypePanic);
+ default:
+ TRACE_PANIC(InvalidMediaTypePanic);
}
- if(KErrNone == symbianErr)
- {
+ if (KErrNone == symbianErr) {
changeState(LoadingState);
- }
- else
- {
- TRACE("error %d", symbianErr)
-
+ } else {
+ TRACE("error %d", symbianErr)
+
// TODO: do something with the value of symbianErr?
m_error = NormalError;
changeState(ErrorState);
@@ -326,44 +316,41 @@ void MMF::AbstractMediaPlayer::volumeChanged(qreal volume)
{
TRACE_CONTEXT(AbstractMediaPlayer::volumeChanged, EAudioInternal);
TRACE_ENTRY("state %d", m_state);
-
+
m_volume = volume;
doVolumeChanged();
-
+
TRACE_EXIT_0();
}
void MMF::AbstractMediaPlayer::doVolumeChanged()
{
- switch(m_state)
- {
- case GroundState:
- case LoadingState:
- case ErrorState:
- // Do nothing
- break;
-
- case StoppedState:
- case PausedState:
- case PlayingState:
- case BufferingState:
- {
- const int err = setDeviceVolume(m_volume * m_mmfMaxVolume);
-
- if(KErrNone != err)
- {
- m_error = NormalError;
- changeState(ErrorState);
- }
- break;
- }
-
- // Protection against adding new states and forgetting to update this
- // switch
- default:
- Utils::panic(InvalidStatePanic);
- }
+ switch (m_state) {
+ case GroundState:
+ case LoadingState:
+ case ErrorState:
+ // Do nothing
+ break;
+
+ case StoppedState:
+ case PausedState:
+ case PlayingState:
+ case BufferingState: {
+ const int err = setDeviceVolume(m_volume * m_mmfMaxVolume);
+
+ if (KErrNone != err) {
+ m_error = NormalError;
+ changeState(ErrorState);
+ }
+ break;
+ }
+
+ // Protection against adding new states and forgetting to update this
+ // switch
+ default:
+ Utils::panic(InvalidStatePanic);
+ }
}
@@ -373,23 +360,23 @@ void MMF::AbstractMediaPlayer::doVolumeChanged()
void MMF::AbstractMediaPlayer::startTickTimer()
{
- m_tickTimer->start(tickInterval());
+ m_tickTimer->start(tickInterval());
}
void MMF::AbstractMediaPlayer::stopTickTimer()
{
- m_tickTimer->stop();
+ m_tickTimer->stop();
}
void MMF::AbstractMediaPlayer::maxVolumeChanged(int mmfMaxVolume)
{
- m_mmfMaxVolume = mmfMaxVolume;
- doVolumeChanged();
+ m_mmfMaxVolume = mmfMaxVolume;
+ doVolumeChanged();
}
Phonon::State MMF::AbstractMediaPlayer::phononState() const
{
- return phononState(m_state);
+ return phononState(m_state);
}
Phonon::State MMF::AbstractMediaPlayer::phononState(PrivateState state)
@@ -411,27 +398,25 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState)
const Phonon::State oldPhononState = phononState(m_state);
const Phonon::State newPhononState = phononState(newState);
- if(oldPhononState != newPhononState)
- {
+ if (oldPhononState != newPhononState) {
TRACE("emit stateChanged(%d, %d)", newPhononState, oldPhononState);
emit stateChanged(newPhononState, oldPhononState);
}
m_state = newState;
-
+
// Check whether play() was called while clip was being loaded. If so,
// playback should be started now
- if(
- LoadingState == oldPhononState
- and StoppedState == newPhononState
- and m_playPending
- )
- {
- TRACE_0("play was called while loading; starting playback now");
- m_playPending = false;
- play();
+ if (
+ LoadingState == oldPhononState
+ and StoppedState == newPhononState
+ and m_playPending
+ ) {
+ TRACE_0("play was called while loading; starting playback now");
+ m_playPending = false;
+ play();
}
-
+
TRACE_EXIT_0();
}
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h
index 51935a3..f11b559 100644
--- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h
@@ -30,130 +30,129 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
- namespace MMF
- {
- class AudioOutput;
-
- /**
- * Interface via which MMF client APIs for both audio and video can be
- * accessed.
- */
- class AbstractMediaPlayer : public AbstractPlayer
- {
- Q_OBJECT
-
- protected:
- AbstractMediaPlayer();
- explicit AbstractMediaPlayer(const AbstractPlayer& player);
- ~AbstractMediaPlayer();
-
- public:
- // MediaObjectInterface
- 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;
- virtual Phonon::State state() const;
- virtual MediaSource source() const;
- virtual void setFileSource(const Phonon::MediaSource&, RFile&);
- virtual void setNextSource(const MediaSource &source);
-
- // VolumeObserver
- virtual void volumeChanged(qreal volume);
-
- protected:
- // AbstractPlayer
- virtual void doSetTickInterval(qint32 interval);
-
- protected:
- 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:
- bool tickTimerRunning() const;
- void startTickTimer();
- void stopTickTimer();
- void maxVolumeChanged(int maxVolume);
-
- /**
- * Defined private state enumeration in order to add GroundState
- */
- enum PrivateState
- {
- LoadingState = Phonon::LoadingState,
- StoppedState = Phonon::StoppedState,
- PlayingState = Phonon::PlayingState,
- BufferingState = Phonon::BufferingState,
- PausedState = Phonon::PausedState,
- ErrorState = Phonon::ErrorState,
- GroundState
- };
-
- /**
- * Converts PrivateState into the corresponding Phonon::State
- */
- Phonon::State phononState() const;
-
- /**
- * Converts PrivateState into the corresponding Phonon::State
- */
- static Phonon::State phononState(PrivateState state);
-
- /**
- * Changes state and emits stateChanged()
- */
- void changeState(PrivateState newState);
-
- /**
- * Records error and changes state to ErrorState
- */
- void setError(Phonon::ErrorType error);
-
- static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &);
-
- private:
- void doVolumeChanged();
-
- Q_SIGNALS:
- void tick(qint64 time);
- void stateChanged(Phonon::State oldState,
- Phonon::State newState);
-
- private Q_SLOTS:
- /**
- * Receives signal from m_tickTimer
- */
- void tick();
-
- private:
- PrivateState m_state;
- Phonon::ErrorType m_error;
-
- /**
- * This flag is set to true if play is called when the object is
- * in a Loading state. Once loading is complete, playback will
- * be started.
- */
- bool m_playPending;
-
- QScopedPointer<QTimer> m_tickTimer;
-
- qreal m_volume;
- int m_mmfMaxVolume;
-
- MediaSource m_source;
- MediaSource m_nextSource;
-
- };
- }
+namespace MMF
+{
+class AudioOutput;
+
+/**
+ * Interface via which MMF client APIs for both audio and video can be
+ * accessed.
+ */
+class AbstractMediaPlayer : public AbstractPlayer
+{
+ Q_OBJECT
+
+protected:
+ AbstractMediaPlayer();
+ explicit AbstractMediaPlayer(const AbstractPlayer& player);
+ ~AbstractMediaPlayer();
+
+public:
+ // MediaObjectInterface
+ 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;
+ virtual Phonon::State state() const;
+ virtual MediaSource source() const;
+ virtual void setFileSource(const Phonon::MediaSource&, RFile&);
+ virtual void setNextSource(const MediaSource &source);
+
+ // VolumeObserver
+ virtual void volumeChanged(qreal volume);
+
+protected:
+ // AbstractPlayer
+ virtual void doSetTickInterval(qint32 interval);
+
+protected:
+ 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:
+ bool tickTimerRunning() const;
+ void startTickTimer();
+ void stopTickTimer();
+ void maxVolumeChanged(int maxVolume);
+
+ /**
+ * Defined private state enumeration in order to add GroundState
+ */
+ enum PrivateState {
+ LoadingState = Phonon::LoadingState,
+ StoppedState = Phonon::StoppedState,
+ PlayingState = Phonon::PlayingState,
+ BufferingState = Phonon::BufferingState,
+ PausedState = Phonon::PausedState,
+ ErrorState = Phonon::ErrorState,
+ GroundState
+ };
+
+ /**
+ * Converts PrivateState into the corresponding Phonon::State
+ */
+ Phonon::State phononState() const;
+
+ /**
+ * Converts PrivateState into the corresponding Phonon::State
+ */
+ static Phonon::State phononState(PrivateState state);
+
+ /**
+ * Changes state and emits stateChanged()
+ */
+ void changeState(PrivateState newState);
+
+ /**
+ * Records error and changes state to ErrorState
+ */
+ void setError(Phonon::ErrorType error);
+
+ static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &);
+
+private:
+ void doVolumeChanged();
+
+Q_SIGNALS:
+ void tick(qint64 time);
+ void stateChanged(Phonon::State oldState,
+ Phonon::State newState);
+
+private Q_SLOTS:
+ /**
+ * Receives signal from m_tickTimer
+ */
+ void tick();
+
+private:
+ PrivateState m_state;
+ Phonon::ErrorType m_error;
+
+ /**
+ * This flag is set to true if play is called when the object is
+ * in a Loading state. Once loading is complete, playback will
+ * be started.
+ */
+ bool m_playPending;
+
+ QScopedPointer<QTimer> m_tickTimer;
+
+ qreal m_volume;
+ int m_mmfMaxVolume;
+
+ MediaSource m_source;
+ MediaSource m_nextSource;
+
+};
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/abstractplayer.cpp b/src/3rdparty/phonon/mmf/abstractplayer.cpp
index 328ab37..c6f0f6b 100644
--- a/src/3rdparty/phonon/mmf/abstractplayer.cpp
+++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp
@@ -30,19 +30,19 @@ using namespace Phonon::MMF;
//-----------------------------------------------------------------------------
MMF::AbstractPlayer::AbstractPlayer()
- : m_videoOutput(NULL)
- , m_tickInterval(DefaultTickInterval)
- , m_transitionTime(0)
- , m_prefinishMark(0)
+ : m_videoOutput(NULL)
+ , m_tickInterval(DefaultTickInterval)
+ , m_transitionTime(0)
+ , m_prefinishMark(0)
{
}
MMF::AbstractPlayer::AbstractPlayer(const AbstractPlayer& player)
- : m_videoOutput(player.m_videoOutput)
- , m_tickInterval(player.tickInterval())
- , m_transitionTime(player.transitionTime())
- , m_prefinishMark(player.prefinishMark())
+ : m_videoOutput(player.m_videoOutput)
+ , m_tickInterval(player.tickInterval())
+ , m_transitionTime(player.transitionTime())
+ , m_prefinishMark(player.prefinishMark())
{
}
@@ -64,17 +64,17 @@ void MMF::AbstractPlayer::setTickInterval(qint32 interval)
qint32 MMF::AbstractPlayer::prefinishMark() const
{
- return m_prefinishMark;
+ return m_prefinishMark;
}
void MMF::AbstractPlayer::setPrefinishMark(qint32 mark)
{
- m_prefinishMark = mark;
+ m_prefinishMark = mark;
}
qint32 MMF::AbstractPlayer::transitionTime() const
{
- return m_transitionTime;
+ return m_transitionTime;
}
void MMF::AbstractPlayer::setTransitionTime(qint32 time)
@@ -95,7 +95,7 @@ void MMF::AbstractPlayer::setVideoOutput(VideoOutput* videoOutput)
void MMF::AbstractPlayer::videoOutputChanged()
{
- // Default behaviour is empty - overridden by VideoPlayer
+ // Default behaviour is empty - overridden by VideoPlayer
}
diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h
index 399cd5d..da0fe51 100644
--- a/src/3rdparty/phonon/mmf/abstractplayer.h
+++ b/src/3rdparty/phonon/mmf/abstractplayer.h
@@ -34,77 +34,77 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
- namespace MMF
- {
- class VideoOutput;
-
- /**
- * @short Interface which abstracts from MediaObject the current
- * media type
- *
- * This may be:
- * - 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
- */
- class AbstractPlayer : public QObject
- , public VolumeObserver
- {
- // Required although this class has no signals or slots
- // Without this, qobject_cast will fail
- Q_OBJECT
-
- public:
- 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 bool hasVideo() const = 0;
- virtual bool isSeekable() const = 0;
- virtual qint64 currentTime() const = 0;
- virtual Phonon::State state() const = 0;
- virtual QString errorString() const = 0;
- virtual Phonon::ErrorType errorType() const = 0;
- virtual qint64 totalTime() const = 0;
- virtual Phonon::MediaSource source() const = 0;
- // This is a temporary hack to work around KErrInUse from MMF
- // client utility OpenFileL calls
- //virtual void setSource(const Phonon::MediaSource &) = 0;
- virtual void setFileSource(const Phonon::MediaSource&, RFile&) = 0;
- virtual void setNextSource(const Phonon::MediaSource &) = 0;
-
- void setVideoOutput(VideoOutput* videoOutput);
-
- protected:
- virtual void videoOutputChanged();
-
- private:
- virtual void doSetTickInterval(qint32 interval) = 0;
-
- protected:
- // Not owned
- VideoOutput* m_videoOutput;
-
- private:
- qint32 m_tickInterval;
- qint32 m_transitionTime;
- qint32 m_prefinishMark;
-
- };
- }
+namespace MMF
+{
+class VideoOutput;
+
+/**
+ * @short Interface which abstracts from MediaObject the current
+ * media type
+ *
+ * This may be:
+ * - 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
+ */
+class AbstractPlayer : public QObject
+ , public VolumeObserver
+{
+ // Required although this class has no signals or slots
+ // Without this, qobject_cast will fail
+ Q_OBJECT
+
+public:
+ 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 bool hasVideo() const = 0;
+ virtual bool isSeekable() const = 0;
+ virtual qint64 currentTime() const = 0;
+ virtual Phonon::State state() const = 0;
+ virtual QString errorString() const = 0;
+ virtual Phonon::ErrorType errorType() const = 0;
+ virtual qint64 totalTime() const = 0;
+ virtual Phonon::MediaSource source() const = 0;
+ // This is a temporary hack to work around KErrInUse from MMF
+ // client utility OpenFileL calls
+ //virtual void setSource(const Phonon::MediaSource &) = 0;
+ virtual void setFileSource(const Phonon::MediaSource&, RFile&) = 0;
+ virtual void setNextSource(const Phonon::MediaSource &) = 0;
+
+ void setVideoOutput(VideoOutput* videoOutput);
+
+protected:
+ virtual void videoOutputChanged();
+
+private:
+ virtual void doSetTickInterval(qint32 interval) = 0;
+
+protected:
+ // Not owned
+ VideoOutput* m_videoOutput;
+
+private:
+ qint32 m_tickInterval;
+ qint32 m_transitionTime;
+ qint32 m_prefinishMark;
+
+};
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp
index 099c899..909e568 100644
--- a/src/3rdparty/phonon/mmf/audiooutput.cpp
+++ b/src/3rdparty/phonon/mmf/audiooutput.cpp
@@ -33,9 +33,9 @@ using namespace Phonon::MMF;
// Constructor / destructor
//-----------------------------------------------------------------------------
-MMF::AudioOutput::AudioOutput(Backend *, QObject *parent) : QObject(parent)
- , m_volume(InitialVolume)
- , m_observer(NULL)
+MMF::AudioOutput::AudioOutput(Backend *, QObject *parent) : QObject(parent)
+ , m_volume(InitialVolume)
+ , m_observer(NULL)
{
}
@@ -47,7 +47,7 @@ MMF::AudioOutput::AudioOutput(Backend *, QObject *parent) : QObject(parent)
qreal MMF::AudioOutput::volume() const
{
- return m_volume;
+ return m_volume;
}
void MMF::AudioOutput::setVolume(qreal volume)
@@ -55,18 +55,16 @@ void MMF::AudioOutput::setVolume(qreal volume)
TRACE_CONTEXT(AudioOutput::setVolume, EAudioApi);
TRACE_ENTRY("observer 0x%08x volume %f", m_observer, volume);
- if(volume != m_volume)
- {
- if(m_observer)
- {
- m_observer->volumeChanged(volume);
- }
-
- m_volume = volume;
- TRACE("emit volumeChanged(%f)", volume)
- emit volumeChanged(volume);
+ if (volume != m_volume) {
+ if (m_observer) {
+ m_observer->volumeChanged(volume);
+ }
+
+ m_volume = volume;
+ TRACE("emit volumeChanged(%f)", volume)
+ emit volumeChanged(volume);
}
-
+
TRACE_EXIT_0();
}
@@ -88,9 +86,8 @@ bool MMF::AudioOutput::setOutputDevice(const Phonon::AudioOutputDevice &)
void MMF::AudioOutput::setVolumeObserver(VolumeObserver* observer)
{
m_observer = observer;
- if(m_observer)
- {
- m_observer->volumeChanged(m_volume);
+ if (m_observer) {
+ m_observer->volumeChanged(m_volume);
}
}
diff --git a/src/3rdparty/phonon/mmf/audiooutput.h b/src/3rdparty/phonon/mmf/audiooutput.h
index ab90c44..001190f 100644
--- a/src/3rdparty/phonon/mmf/audiooutput.h
+++ b/src/3rdparty/phonon/mmf/audiooutput.h
@@ -25,66 +25,66 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
- namespace MMF
- {
- class Backend;
- class VolumeObserver;
-
- /**
- * @short AudioOutputInterface implementation for MMF.
- *
- * Forwards volume commands to the VolumeObserver instance,
- * which is provided by the backend when MediaNode objects are
- * connected.
- *
- * \section volume Volume
- *
- * Phonon's concept on volume is from 0.0 to 1.0, and from 1< it does
- * voltage multiplication. CDrmPlayerUtility goes from 1 to
- * CDrmPlayerUtility::MaxVolume(). We apply some basic math to convert
- * between the two.
- *
- * @author Frans Englich<frans.englich@nokia.com>
- */
- class AudioOutput : public QObject
- , public AudioOutputInterface
- {
- Q_OBJECT
- Q_INTERFACES(Phonon::AudioOutputInterface)
-
- public:
- AudioOutput(Backend *backend, QObject *parent);
- virtual qreal volume() const;
- virtual void setVolume(qreal volume);
-
- virtual int outputDevice() const;
-
- /**
- * Has no effect.
- */
- virtual bool setOutputDevice(int);
-
- /**
- * Has no effect.
- */
- virtual bool setOutputDevice(const Phonon::AudioOutputDevice &);
-
- /**
- * Called by backend when nodes are connected.
- */
- void setVolumeObserver(VolumeObserver* observer);
-
- Q_SIGNALS:
- void volumeChanged(qreal volume);
- void audioDeviceFailed();
-
- private:
- qreal m_volume;
-
- // Not owned
- VolumeObserver* m_observer;
- };
- }
+namespace MMF
+{
+class Backend;
+class VolumeObserver;
+
+/**
+ * @short AudioOutputInterface implementation for MMF.
+ *
+ * Forwards volume commands to the VolumeObserver instance,
+ * which is provided by the backend when MediaNode objects are
+ * connected.
+ *
+ * \section volume Volume
+ *
+ * Phonon's concept on volume is from 0.0 to 1.0, and from 1< it does
+ * voltage multiplication. CDrmPlayerUtility goes from 1 to
+ * CDrmPlayerUtility::MaxVolume(). We apply some basic math to convert
+ * between the two.
+ *
+ * @author Frans Englich<frans.englich@nokia.com>
+ */
+class AudioOutput : public QObject
+ , public AudioOutputInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(Phonon::AudioOutputInterface)
+
+public:
+ AudioOutput(Backend *backend, QObject *parent);
+ virtual qreal volume() const;
+ virtual void setVolume(qreal volume);
+
+ virtual int outputDevice() const;
+
+ /**
+ * Has no effect.
+ */
+ virtual bool setOutputDevice(int);
+
+ /**
+ * Has no effect.
+ */
+ virtual bool setOutputDevice(const Phonon::AudioOutputDevice &);
+
+ /**
+ * Called by backend when nodes are connected.
+ */
+ void setVolumeObserver(VolumeObserver* observer);
+
+Q_SIGNALS:
+ void volumeChanged(qreal volume);
+ void audioDeviceFailed();
+
+private:
+ qreal m_volume;
+
+ // Not owned
+ VolumeObserver* m_observer;
+};
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp
index 50048c8..1229625 100644
--- a/src/3rdparty/phonon/mmf/audioplayer.cpp
+++ b/src/3rdparty/phonon/mmf/audioplayer.cpp
@@ -30,32 +30,31 @@ using namespace Phonon::MMF;
// Constructor / destructor
//-----------------------------------------------------------------------------
-MMF::AudioPlayer::AudioPlayer() : m_player(NULL)
+MMF::AudioPlayer::AudioPlayer() : m_player(NULL)
{
- construct();
+ construct();
}
MMF::AudioPlayer::AudioPlayer(const AbstractPlayer& player)
- : AbstractMediaPlayer(player)
- , m_player(NULL)
+ : AbstractMediaPlayer(player)
+ , m_player(NULL)
{
- construct();
+ construct();
}
void MMF::AudioPlayer::construct()
{
- TRACE_CONTEXT(AudioPlayer::AudioPlayer, EAudioApi);
- TRACE_ENTRY_0();
-
- // TODO: is this the correct way to handle errors which occur when
- // creating a Symbian object in the constructor of a Qt object?
- TRAPD(err, m_player = CPlayerType::NewL(*this, 0, EMdaPriorityPreferenceNone));
- if(KErrNone != err)
- {
- changeState(ErrorState);
- }
-
- TRACE_EXIT_0();
+ TRACE_CONTEXT(AudioPlayer::AudioPlayer, EAudioApi);
+ TRACE_ENTRY_0();
+
+ // TODO: is this the correct way to handle errors which occur when
+ // creating a Symbian object in the constructor of a Qt object?
+ TRAPD(err, m_player = CPlayerType::NewL(*this, 0, EMdaPriorityPreferenceNone));
+ if (KErrNone != err) {
+ changeState(ErrorState);
+ }
+
+ TRACE_EXIT_0();
}
MMF::AudioPlayer::~AudioPlayer()
@@ -74,17 +73,17 @@ MMF::AudioPlayer::~AudioPlayer()
void MMF::AudioPlayer::doPlay()
{
- m_player->Play();
+ m_player->Play();
}
void MMF::AudioPlayer::doPause()
{
- m_player->Pause();
+ m_player->Pause();
}
void MMF::AudioPlayer::doStop()
{
- m_player->Stop();
+ m_player->Stop();
}
void MMF::AudioPlayer::doSeek(qint64 ms)
@@ -94,30 +93,29 @@ void MMF::AudioPlayer::doSeek(qint64 ms)
int MMF::AudioPlayer::setDeviceVolume(int mmfVolume)
{
- return m_player->SetVolume(mmfVolume);
+ return m_player->SetVolume(mmfVolume);
}
int MMF::AudioPlayer::openFile(RFile& file)
{
- TRAPD(err, m_player->OpenFileL(file));
-
+ TRAPD(err, m_player->OpenFileL(file));
+
#ifdef QT_PHONON_MMF_AUDIO_DRM
- if(KErrNone == err)
- {
+ if (KErrNone == err) {
// There appears to be a bug in the CDrmPlayerUtility implementation (at least
// in S60 5.x) whereby the player does not check whether the loading observer
// pointer is null before dereferencing it. Therefore we must register for
// loading notification, even though we do nothing in the callback functions.
m_player->RegisterForAudioLoadingNotification(*this);
- }
+ }
#endif
-
- return err;
+
+ return err;
}
void MMF::AudioPlayer::close()
{
- m_player->Close();
+ m_player->Close();
}
bool MMF::AudioPlayer::hasVideo() const
@@ -134,17 +132,14 @@ qint64 MMF::AudioPlayer::currentTime() const
qint64 result = 0;
- if(KErrNone == err)
- {
+ if (KErrNone == err) {
result = toMilliSeconds(us);
- }
- else
- {
- TRACE("GetPosition err %d", err);
-
- // If we don't cast away constness here, we simply have to ignore
- // the error.
- const_cast<AudioPlayer*>(this)->setError(NormalError);
+ } else {
+ TRACE("GetPosition err %d", err);
+
+ // If we don't cast away constness here, we simply have to ignore
+ // the error.
+ const_cast<AudioPlayer*>(this)->setError(NormalError);
}
return result;
@@ -162,10 +157,10 @@ qint64 MMF::AudioPlayer::totalTime() const
#ifdef QT_PHONON_MMF_AUDIO_DRM
void MMF::AudioPlayer::MdapcInitComplete(TInt aError,
- const TTimeIntervalMicroSeconds &)
+ const TTimeIntervalMicroSeconds &)
#else
void MMF::AudioPlayer::MapcInitComplete(TInt aError,
- const TTimeIntervalMicroSeconds &)
+ const TTimeIntervalMicroSeconds &)
#endif
{
TRACE_CONTEXT(AudioPlayer::MapcInitComplete, EAudioInternal);
@@ -173,15 +168,12 @@ void MMF::AudioPlayer::MapcInitComplete(TInt aError,
__ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic));
- if(KErrNone == aError)
- {
- maxVolumeChanged(m_player->MaxVolume());
+ if (KErrNone == aError) {
+ maxVolumeChanged(m_player->MaxVolume());
- emit totalTimeChanged(totalTime());
- changeState(StoppedState);
- }
- else
- {
+ emit totalTimeChanged(totalTime());
+ changeState(StoppedState);
+ } else {
// TODO: set different error states according to value of aError?
setError(NormalError);
}
@@ -200,33 +192,30 @@ void MMF::AudioPlayer::MapcPlayComplete(TInt aError)
stopTickTimer();
- if(KErrNone == aError)
- {
+ if (KErrNone == aError) {
changeState(StoppedState);
// TODO: move on to m_nextSource
- }
- else
- {
+ } else {
// TODO: do something with aError?
setError(NormalError);
}
-/*
- if(aError == KErrNone) {
- if(m_nextSource.type() == MediaSource::Empty) {
- emit finished();
- } else {
- setSource(m_nextSource);
- m_nextSource = MediaSource();
- }
+ /*
+ if(aError == KErrNone) {
+ if(m_nextSource.type() == MediaSource::Empty) {
+ emit finished();
+ } else {
+ setSource(m_nextSource);
+ m_nextSource = MediaSource();
+ }
- changeState(StoppedState);
- }
- else {
- m_error = NormalError;
- changeState(ErrorState);
- }
-*/
+ changeState(StoppedState);
+ }
+ else {
+ m_error = NormalError;
+ changeState(ErrorState);
+ }
+ */
TRACE_EXIT_0();
}
diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h
index cdb6cb9..424985c 100644
--- a/src/3rdparty/phonon/mmf/audioplayer.h
+++ b/src/3rdparty/phonon/mmf/audioplayer.h
@@ -38,70 +38,70 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
- namespace MMF
- {
- /**
- * @short Wrapper over MMF audio client utility
- */
- class AudioPlayer : public AbstractMediaPlayer
- , public MPlayerObserverType // typedef
+namespace MMF
+{
+/**
+ * @short Wrapper over MMF audio client utility
+ */
+class AudioPlayer : public AbstractMediaPlayer
+ , public MPlayerObserverType // typedef
#ifdef QT_PHONON_MMF_AUDIO_DRM
- , public MAudioLoadingObserver
+ , public MAudioLoadingObserver
#endif
- {
- Q_OBJECT
-
- public:
- AudioPlayer();
- explicit AudioPlayer(const AbstractPlayer& player);
- virtual ~AudioPlayer();
-
- // AbstractMediaPlayer
- 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 bool hasVideo() const;
- virtual qint64 currentTime() const;
- virtual qint64 totalTime() const;
+{
+ Q_OBJECT
+
+public:
+ AudioPlayer();
+ explicit AudioPlayer(const AbstractPlayer& player);
+ virtual ~AudioPlayer();
+
+ // AbstractMediaPlayer
+ 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 bool hasVideo() const;
+ virtual qint64 currentTime() const;
+ virtual qint64 totalTime() const;
#ifdef QT_PHONON_MMF_AUDIO_DRM
- // MDrmAudioPlayerCallback
- virtual void MdapcInitComplete(TInt aError,
- const TTimeIntervalMicroSeconds &aDuration);
- virtual void MdapcPlayComplete(TInt aError);
-
- // MAudioLoadingObserver
- virtual void MaloLoadingStarted();
- virtual void MaloLoadingComplete();
+ // MDrmAudioPlayerCallback
+ virtual void MdapcInitComplete(TInt aError,
+ const TTimeIntervalMicroSeconds &aDuration);
+ virtual void MdapcPlayComplete(TInt aError);
+
+ // MAudioLoadingObserver
+ virtual void MaloLoadingStarted();
+ virtual void MaloLoadingComplete();
#else
- // MMdaAudioPlayerCallback
- virtual void MapcInitComplete(TInt aError,
- const TTimeIntervalMicroSeconds &aDuration);
- virtual void MapcPlayComplete(TInt aError);
+ // MMdaAudioPlayerCallback
+ virtual void MapcInitComplete(TInt aError,
+ const TTimeIntervalMicroSeconds &aDuration);
+ virtual void MapcPlayComplete(TInt aError);
#endif
- Q_SIGNALS:
- void totalTimeChanged(qint64 length);
- void finished();
-
- private:
- void construct();
-
- private:
- /**
- * Using CPlayerType typedef in order to be able to easily switch between
- * CMdaAudioPlayerUtility and CDrmPlayerUtility
- */
- CPlayerType* m_player;
-
- };
- }
+Q_SIGNALS:
+ void totalTimeChanged(qint64 length);
+ void finished();
+
+private:
+ void construct();
+
+private:
+ /**
+ * Using CPlayerType typedef in order to be able to easily switch between
+ * CMdaAudioPlayerUtility and CDrmPlayerUtility
+ */
+ CPlayerType* m_player;
+
+};
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp
index 236ef28..71e51d9 100644
--- a/src/3rdparty/phonon/mmf/backend.cpp
+++ b/src/3rdparty/phonon/mmf/backend.cpp
@@ -34,49 +34,48 @@ QT_BEGIN_NAMESPACE
using namespace Phonon;
using namespace Phonon::MMF;
-Backend::Backend(QObject *parent) : QObject(parent)
+Backend::Backend(QObject *parent) : QObject(parent)
{
- TRACE_CONTEXT(Backend::Backend, EBackend);
- TRACE_ENTRY_0();
+ TRACE_CONTEXT(Backend::Backend, EBackend);
+ TRACE_ENTRY_0();
setProperty("identifier", QLatin1String("phonon_mmf"));
setProperty("backendName", QLatin1String("MMF"));
setProperty("backendComment", QLatin1String("Backend using Symbian Multimedia Framework (MMF)"));
setProperty("backendVersion", QLatin1String("0.1"));
setProperty("backendWebsite", QLatin1String("http://www.qtsoftware.com/"));
-
+
TRACE_EXIT_0();
}
QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &)
{
- TRACE_CONTEXT(Backend::createObject, EBackend);
- TRACE_ENTRY("class %d", c);
-
- QObject* result = NULL;
-
- switch(c)
- {
- case AudioOutputClass:
- result = new AudioOutput(this, parent);
- break;
-
- case MediaObjectClass:
- result = new MediaObject(parent);
- break;
-
- case VolumeFaderEffectClass:
- case VisualizationClass:
- case VideoDataOutputClass:
- case EffectClass:
- break;
-
- case VideoWidgetClass:
- result = new VideoWidget(qobject_cast<QWidget *>(parent));
- break;
-
- default:
- TRACE_PANIC(InvalidBackendInterfaceClass);
+ TRACE_CONTEXT(Backend::createObject, EBackend);
+ TRACE_ENTRY("class %d", c);
+
+ QObject* result = NULL;
+
+ switch (c) {
+ case AudioOutputClass:
+ result = new AudioOutput(this, parent);
+ break;
+
+ case MediaObjectClass:
+ result = new MediaObject(parent);
+ break;
+
+ case VolumeFaderEffectClass:
+ case VisualizationClass:
+ case VideoDataOutputClass:
+ case EffectClass:
+ break;
+
+ case VideoWidgetClass:
+ result = new VideoWidget(qobject_cast<QWidget *>(parent));
+ break;
+
+ default:
+ TRACE_PANIC(InvalidBackendInterfaceClass);
}
TRACE_RETURN("0x%08x", result);
@@ -99,46 +98,44 @@ bool Backend::startConnectionChange(QSet<QObject *>)
bool Backend::connectNodes(QObject *source, QObject *target)
{
- TRACE_CONTEXT(Backend::connectNodes, EBackend);
- TRACE_ENTRY("source 0x%08x target 0x%08x", source, target);
+ TRACE_CONTEXT(Backend::connectNodes, EBackend);
+ TRACE_ENTRY("source 0x%08x target 0x%08x", source, target);
- MediaObject *const mediaObject = qobject_cast<MediaObject *>(source);
+ MediaObject *const mediaObject = qobject_cast<MediaObject *>(source);
AudioOutput *const audioOutput = qobject_cast<AudioOutput *>(target);
VideoWidget *const videoWidget = qobject_cast<VideoWidget *>(target);
-
+
bool result = false;
-
- if(mediaObject and audioOutput)
- {
- TRACE("mediaObject 0x%08x -> audioOutput 0x%08x", mediaObject, audioOutput);
- audioOutput->setVolumeObserver(mediaObject);
- result = true;
+
+ if (mediaObject and audioOutput) {
+ TRACE("mediaObject 0x%08x -> audioOutput 0x%08x", mediaObject, audioOutput);
+ audioOutput->setVolumeObserver(mediaObject);
+ result = true;
}
-
- if(mediaObject and videoWidget)
- {
- TRACE("mediaObject 0x%08x -> videoWidget 0x%08x", mediaObject, videoWidget);
- mediaObject->setVideoOutput(&videoWidget->videoOutput());
- result = true;
- }
-
+
+ if (mediaObject and videoWidget) {
+ TRACE("mediaObject 0x%08x -> videoWidget 0x%08x", mediaObject, videoWidget);
+ mediaObject->setVideoOutput(&videoWidget->videoOutput());
+ result = true;
+ }
+
TRACE_RETURN("%d", result);
}
bool Backend::disconnectNodes(QObject *source, QObject *target)
{
- TRACE_CONTEXT(Backend::disconnectNodes, EBackend);
- TRACE_ENTRY("source 0x%08x target 0x%08x", source, target);
-
- MediaObject *const mediaObject = qobject_cast<MediaObject *>(source);
- AudioOutput *const audioOutput = qobject_cast<AudioOutput *>(target);
- VideoWidget *const videoWidget = qobject_cast<VideoWidget *>(target);
-
- bool result = true;
-
- // TODO: disconnection
-
- TRACE_RETURN("%d", result);
+ TRACE_CONTEXT(Backend::disconnectNodes, EBackend);
+ TRACE_ENTRY("source 0x%08x target 0x%08x", source, target);
+
+ MediaObject *const mediaObject = qobject_cast<MediaObject *>(source);
+ AudioOutput *const audioOutput = qobject_cast<AudioOutput *>(target);
+ VideoWidget *const videoWidget = qobject_cast<VideoWidget *>(target);
+
+ bool result = true;
+
+ // TODO: disconnection
+
+ TRACE_RETURN("%d", result);
}
bool Backend::endConnectionChange(QSet<QObject *>)
@@ -148,40 +145,38 @@ bool Backend::endConnectionChange(QSet<QObject *>)
void getAvailableMimeTypesL(QStringList& result)
{
- RApaLsSession apaSession;
- User::LeaveIfError(apaSession.Connect());
- CleanupClosePushL(apaSession);
-
- static const TInt DataTypeArrayGranularity = 8;
- CDataTypeArray* array = new (ELeave) CDataTypeArray(DataTypeArrayGranularity);
- CleanupStack::PushL(array);
-
- apaSession.GetSupportedDataTypesL(*array);
-
- for(TInt i=0; i<array->Count(); ++i)
- {
- const TPtrC mimeType = array->At(i).Des();
- const MediaType mediaType = Utils::mimeTypeToMediaType(mimeType);
- if(MediaTypeAudio == mediaType or MediaTypeVideo == mediaType)
- {
- result.append(qt_TDesC2QString(mimeType));
- }
- }
-
- CleanupStack::PopAndDestroy(2); // apaSession, array
+ RApaLsSession apaSession;
+ User::LeaveIfError(apaSession.Connect());
+ CleanupClosePushL(apaSession);
+
+ static const TInt DataTypeArrayGranularity = 8;
+ CDataTypeArray* array = new(ELeave) CDataTypeArray(DataTypeArrayGranularity);
+ CleanupStack::PushL(array);
+
+ apaSession.GetSupportedDataTypesL(*array);
+
+ for (TInt i = 0; i < array->Count(); ++i) {
+ const TPtrC mimeType = array->At(i).Des();
+ const MediaType mediaType = Utils::mimeTypeToMediaType(mimeType);
+ if (MediaTypeAudio == mediaType or MediaTypeVideo == mediaType) {
+ result.append(qt_TDesC2QString(mimeType));
+ }
+ }
+
+ CleanupStack::PopAndDestroy(2); // apaSession, array
}
QStringList Backend::availableMimeTypes() const
{
- QStringList result;
-
- // There is no way to return an error from this function, so we just
- // have to trap and ignore exceptions...
- TRAP_IGNORE(getAvailableMimeTypesL(result));
-
- result.sort();
-
- return result;
+ QStringList result;
+
+ // There is no way to return an error from this function, so we just
+ // have to trap and ignore exceptions...
+ TRAP_IGNORE(getAvailableMimeTypesL(result));
+
+ result.sort();
+
+ return result;
}
Q_EXPORT_PLUGIN2(phonon_mmf, Phonon::MMF::Backend);
diff --git a/src/3rdparty/phonon/mmf/backend.h b/src/3rdparty/phonon/mmf/backend.h
index b448187..7598fa7 100644
--- a/src/3rdparty/phonon/mmf/backend.h
+++ b/src/3rdparty/phonon/mmf/backend.h
@@ -26,29 +26,29 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
- namespace MMF
- {
- class Backend : public QObject
- , public BackendInterface
- {
- Q_OBJECT
- Q_INTERFACES(Phonon::BackendInterface)
- public:
- Backend(QObject *parent = 0);
-
- virtual QObject *createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args);
- virtual QList<int> objectDescriptionIndexes(ObjectDescriptionType type) const;
- virtual QHash<QByteArray, QVariant> objectDescriptionProperties(ObjectDescriptionType type, int index) const;
- virtual bool startConnectionChange(QSet<QObject *>);
- virtual bool connectNodes(QObject *, QObject *);
- virtual bool disconnectNodes(QObject *, QObject *);
- virtual bool endConnectionChange(QSet<QObject *>);
- virtual QStringList availableMimeTypes() const;
-
- Q_SIGNALS:
- void objectDescriptionChanged(ObjectDescriptionType);
- };
- }
+namespace MMF
+{
+class Backend : public QObject
+ , public BackendInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(Phonon::BackendInterface)
+public:
+ Backend(QObject *parent = 0);
+
+ virtual QObject *createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args);
+ virtual QList<int> objectDescriptionIndexes(ObjectDescriptionType type) const;
+ virtual QHash<QByteArray, QVariant> objectDescriptionProperties(ObjectDescriptionType type, int index) const;
+ virtual bool startConnectionChange(QSet<QObject *>);
+ virtual bool connectNodes(QObject *, QObject *);
+ virtual bool disconnectNodes(QObject *, QObject *);
+ virtual bool endConnectionChange(QSet<QObject *>);
+ virtual QStringList availableMimeTypes() const;
+
+Q_SIGNALS:
+ void objectDescriptionChanged(ObjectDescriptionType);
+};
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/defs.h b/src/3rdparty/phonon/mmf/defs.h
index 37a25d1..674e767 100644
--- a/src/3rdparty/phonon/mmf/defs.h
+++ b/src/3rdparty/phonon/mmf/defs.h
@@ -21,11 +21,11 @@ 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,
+// 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. This is to allow us to test whether the QWidget function
+// QWidget. This is to allow us to test whether the QWidget function
// overrides present in VideoOutput (e.g. sizeHint, paintEvent etc) may
// be the cause of the visibility problems.
//#define PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET
@@ -40,18 +40,17 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
- namespace MMF
- {
- static const qint32 DefaultTickInterval = 10;
- static const qreal InitialVolume = 0.5;
-
- enum MediaType
- {
- MediaTypeUnknown,
- MediaTypeAudio,
- MediaTypeVideo
- };
- }
+namespace MMF
+{
+static const qint32 DefaultTickInterval = 10;
+static const qreal InitialVolume = 0.5;
+
+enum MediaType {
+ MediaTypeUnknown,
+ MediaTypeAudio,
+ MediaTypeVideo
+};
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/dummyplayer.cpp b/src/3rdparty/phonon/mmf/dummyplayer.cpp
index dc7f8d1..dc55af7 100644
--- a/src/3rdparty/phonon/mmf/dummyplayer.cpp
+++ b/src/3rdparty/phonon/mmf/dummyplayer.cpp
@@ -29,13 +29,13 @@ using namespace Phonon::MMF;
MMF::DummyPlayer::DummyPlayer()
{
-
+
}
MMF::DummyPlayer::DummyPlayer(const AbstractPlayer& player)
- : AbstractPlayer(player)
+ : AbstractPlayer(player)
{
-
+
}
diff --git a/src/3rdparty/phonon/mmf/dummyplayer.h b/src/3rdparty/phonon/mmf/dummyplayer.h
index 12e3bd8..b2725df 100644
--- a/src/3rdparty/phonon/mmf/dummyplayer.h
+++ b/src/3rdparty/phonon/mmf/dummyplayer.h
@@ -25,51 +25,51 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
- namespace MMF
- {
- class AudioOutput;
-
- /**
- * @short Stub implementation of AbstractPlayer.
- *
- * The functions of this class are:
- * - Allow MediaObject to call a subset of the MediaObjectInterface
- * API, before SetSource has been called.
- * - Cache any parameters which are set in this state (e.g.
- * prefinish mark), so that they can be copied into the 'real'
- * AbstractPlayer implementation once a source has been loaded.
- */
- 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 bool hasVideo() const;
- virtual bool isSeekable() const;
- virtual qint64 currentTime() const;
- virtual Phonon::State state() const;
- virtual QString errorString() const;
- virtual Phonon::ErrorType errorType() const;
- virtual qint64 totalTime() const;
- virtual MediaSource source() const;
- // virtual void setSource(const MediaSource &);
- virtual void setFileSource(const Phonon::MediaSource&, RFile&);
- virtual void setNextSource(const MediaSource &source);
-
- // VolumeObserver
- virtual void volumeChanged(qreal volume);
-
- // AbstractPlayer
- virtual void doSetTickInterval(qint32 interval);
-
- };
- }
+namespace MMF
+{
+class AudioOutput;
+
+/**
+ * @short Stub implementation of AbstractPlayer.
+ *
+ * The functions of this class are:
+ * - Allow MediaObject to call a subset of the MediaObjectInterface
+ * API, before SetSource has been called.
+ * - Cache any parameters which are set in this state (e.g.
+ * prefinish mark), so that they can be copied into the 'real'
+ * AbstractPlayer implementation once a source has been loaded.
+ */
+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 bool hasVideo() const;
+ virtual bool isSeekable() const;
+ virtual qint64 currentTime() const;
+ virtual Phonon::State state() const;
+ virtual QString errorString() const;
+ virtual Phonon::ErrorType errorType() const;
+ virtual qint64 totalTime() const;
+ virtual MediaSource source() const;
+ // virtual void setSource(const MediaSource &);
+ virtual void setFileSource(const Phonon::MediaSource&, RFile&);
+ virtual void setNextSource(const MediaSource &source);
+
+ // VolumeObserver
+ virtual void volumeChanged(qreal volume);
+
+ // AbstractPlayer
+ virtual void doSetTickInterval(qint32 interval);
+
+};
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp
index 91ed859..bf55781 100644
--- a/src/3rdparty/phonon/mmf/mediaobject.cpp
+++ b/src/3rdparty/phonon/mmf/mediaobject.cpp
@@ -32,8 +32,8 @@ using namespace Phonon::MMF;
// Constructor / destructor
//-----------------------------------------------------------------------------
-MMF::MediaObject::MediaObject(QObject *parent) : QObject(parent)
- , m_recognizerOpened(false)
+MMF::MediaObject::MediaObject(QObject *parent) : QObject(parent)
+ , m_recognizerOpened(false)
{
m_player.reset(new DummyPlayer());
@@ -64,74 +64,63 @@ MMF::MediaObject::~MediaObject()
bool MMF::MediaObject::openRecognizer()
{
- TRACE_CONTEXT(MediaObject::openRecognizer, EAudioInternal);
-
- if(!m_recognizerOpened)
- {
- TInt err = m_recognizer.Connect();
- if(KErrNone != err)
- {
- TRACE("RApaLsSession::Connect error %d", err);
- return false;
- }
-
- err = m_fileServer.Connect();
- if(KErrNone != err)
- {
- TRACE("RFs::Connect error %d", err);
- return false;
- }
-
- // This must be called in order to be able to share file handles with
- // the recognizer server (see fileMediaType function).
- err = m_fileServer.ShareProtected();
- if(KErrNone != err)
- {
- TRACE("RFs::ShareProtected error %d", err);
- return false;
- }
-
- m_recognizerOpened = true;
- }
-
- return true;
+ TRACE_CONTEXT(MediaObject::openRecognizer, EAudioInternal);
+
+ if (!m_recognizerOpened) {
+ TInt err = m_recognizer.Connect();
+ if (KErrNone != err) {
+ TRACE("RApaLsSession::Connect error %d", err);
+ return false;
+ }
+
+ err = m_fileServer.Connect();
+ if (KErrNone != err) {
+ TRACE("RFs::Connect error %d", err);
+ return false;
+ }
+
+ // This must be called in order to be able to share file handles with
+ // the recognizer server (see fileMediaType function).
+ err = m_fileServer.ShareProtected();
+ if (KErrNone != err) {
+ TRACE("RFs::ShareProtected error %d", err);
+ return false;
+ }
+
+ m_recognizerOpened = true;
+ }
+
+ return true;
}
MMF::MediaType MMF::MediaObject::fileMediaType
- (const QString& fileName)
+(const QString& fileName)
{
- TRACE_CONTEXT(MediaObject::fileMediaType, EAudioInternal);
-
- MediaType result = MediaTypeUnknown;
-
- if(openRecognizer())
- {
- QHBufC fileNameSymbian = Utils::symbianFilename(fileName);
-
- m_file.Close();
- TInt err = m_file.Open(m_fileServer, *fileNameSymbian, EFileRead|EFileShareReadersOnly);
-
- if(KErrNone == err)
- {
- TDataRecognitionResult recognizerResult;
- err = m_recognizer.RecognizeData(m_file, recognizerResult);
- if(KErrNone == err)
- {
- const TPtrC mimeType = recognizerResult.iDataType.Des();
- result = Utils::mimeTypeToMediaType(mimeType);
- }
- else
- {
- TRACE("RApaLsSession::RecognizeData filename %S error %d", fileNameSymbian.data(), err);
- }
- }
- else
- {
- TRACE("RFile::Open filename %S error %d", fileNameSymbian.data(), err);
- }
- }
-
- return result;
+ TRACE_CONTEXT(MediaObject::fileMediaType, EAudioInternal);
+
+ MediaType result = MediaTypeUnknown;
+
+ if (openRecognizer()) {
+ QHBufC fileNameSymbian = Utils::symbianFilename(fileName);
+
+ m_file.Close();
+ TInt err = m_file.Open(m_fileServer, *fileNameSymbian, EFileRead | EFileShareReadersOnly);
+
+ if (KErrNone == err) {
+ TDataRecognitionResult recognizerResult;
+ err = m_recognizer.RecognizeData(m_file, recognizerResult);
+ if (KErrNone == err) {
+ const TPtrC mimeType = recognizerResult.iDataType.Des();
+ result = Utils::mimeTypeToMediaType(mimeType);
+ } else {
+ TRACE("RApaLsSession::RecognizeData filename %S error %d", fileNameSymbian.data(), err);
+ }
+ } else {
+ TRACE("RFile::Open filename %S error %d", fileNameSymbian.data(), err);
+ }
+ }
+
+ return result;
}
@@ -157,9 +146,8 @@ void MMF::MediaObject::stop()
void MMF::MediaObject::seek(qint64 ms)
{
m_player->seek(ms);
-
- if(state() == PausedState or state() == PlayingState)
- {
+
+ if (state() == PausedState or state() == PlayingState) {
emit tick(currentTime());
}
}
@@ -216,130 +204,117 @@ MediaSource MMF::MediaObject::source() const
void MMF::MediaObject::setSource(const MediaSource &source)
{
- createPlayer(source);
-
+ createPlayer(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)
{
- TRACE_CONTEXT(MediaObject::createPlayer, EAudioApi);
+ TRACE_CONTEXT(MediaObject::createPlayer, EAudioApi);
TRACE_ENTRY("state %d source.type %d", state(), source.type());
- TRACE_ENTRY("source.type %d", source.type());
-
- MediaType mediaType = MediaTypeUnknown;
-
- AbstractPlayer* oldPlayer = m_player.data();
-
- const bool oldPlayerHasVideo = oldPlayer->hasVideo();
- const bool oldPlayerSeekable = oldPlayer->isSeekable();
-
- // Determine media type
- switch(source.type())
- {
- case MediaSource::LocalFile:
- mediaType = fileMediaType(source.fileName());
- break;
-
- case MediaSource::Url:
- // TODO: support detection of media type from HTTP streams
- TRACE_0("Network streaming not supported yet");
- /*
- * TODO: handle error
- *
- m_error = NormalError;
- changeState(ErrorState);
- */
- break;
-
- case MediaSource::Invalid:
- case MediaSource::Disc:
- case MediaSource::Stream:
- TRACE_0("Unsupported media type");
- /*
- * TODO: handle error
- *
- m_error = NormalError;
- changeState(ErrorState);
- */
- break;
-
- case MediaSource::Empty:
- TRACE_0("Empty media 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");
- if(oldPlayer)
- {
- newPlayer = new DummyPlayer(*oldPlayer);
- }
- else
- {
- newPlayer = new DummyPlayer();
- }
- /*
- * TODO: handle error?
- *
- m_error = NormalError;
- changeState(ErrorState);
- */
- break;
-
- case MediaTypeAudio:
- if(oldPlayer)
- {
- newPlayer = new AudioPlayer(*oldPlayer);
- }
- else
- {
- newPlayer = new AudioPlayer();
- }
- break;
-
- case MediaTypeVideo:
- if(oldPlayer)
- {
- newPlayer = new VideoPlayer(*oldPlayer);
- }
- else
- {
- newPlayer = new VideoPlayer();
- }
- break;
- }
-
- m_player.reset(newPlayer);
-
- if(oldPlayerHasVideo != hasVideo())
- {
- emit hasVideoChanged(hasVideo());
- }
-
- if(oldPlayerSeekable != isSeekable())
- {
- emit seekableChanged(isSeekable());
- }
-
- 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)));
-
- TRACE_EXIT_0();
+ TRACE_ENTRY("source.type %d", source.type());
+
+ MediaType mediaType = MediaTypeUnknown;
+
+ AbstractPlayer* oldPlayer = m_player.data();
+
+ const bool oldPlayerHasVideo = oldPlayer->hasVideo();
+ const bool oldPlayerSeekable = oldPlayer->isSeekable();
+
+ // Determine media type
+ switch (source.type()) {
+ case MediaSource::LocalFile:
+ mediaType = fileMediaType(source.fileName());
+ break;
+
+ case MediaSource::Url:
+ // TODO: support detection of media type from HTTP streams
+ TRACE_0("Network streaming not supported yet");
+ /*
+ * TODO: handle error
+ *
+ m_error = NormalError;
+ changeState(ErrorState);
+ */
+ break;
+
+ case MediaSource::Invalid:
+ case MediaSource::Disc:
+ case MediaSource::Stream:
+ TRACE_0("Unsupported media type");
+ /*
+ * TODO: handle error
+ *
+ m_error = NormalError;
+ changeState(ErrorState);
+ */
+ break;
+
+ case MediaSource::Empty:
+ TRACE_0("Empty media 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");
+ if (oldPlayer) {
+ newPlayer = new DummyPlayer(*oldPlayer);
+ } else {
+ newPlayer = new DummyPlayer();
+ }
+ /*
+ * TODO: handle error?
+ *
+ m_error = NormalError;
+ changeState(ErrorState);
+ */
+ break;
+
+ case MediaTypeAudio:
+ if (oldPlayer) {
+ newPlayer = new AudioPlayer(*oldPlayer);
+ } else {
+ newPlayer = new AudioPlayer();
+ }
+ break;
+
+ case MediaTypeVideo:
+ if (oldPlayer) {
+ newPlayer = new VideoPlayer(*oldPlayer);
+ } else {
+ newPlayer = new VideoPlayer();
+ }
+ break;
+ }
+
+ m_player.reset(newPlayer);
+
+ if (oldPlayerHasVideo != hasVideo()) {
+ emit hasVideoChanged(hasVideo());
+ }
+
+ if (oldPlayerSeekable != isSeekable()) {
+ emit seekableChanged(isSeekable());
+ }
+
+ 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)));
+
+ TRACE_EXIT_0();
}
void MMF::MediaObject::setNextSource(const MediaSource &source)
diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h
index d9c32ce..c53b908 100644
--- a/src/3rdparty/phonon/mmf/mediaobject.h
+++ b/src/3rdparty/phonon/mmf/mediaobject.h
@@ -34,94 +34,94 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
- namespace MMF
- {
- class AbstractPlayer;
- class VideoOutput;
-
- /**
- * @short Facade class which wraps MMF client utility instance
- */
- class MediaObject : public QObject
- , public MediaObjectInterface
- , public VolumeObserver
- {
- Q_OBJECT
- Q_INTERFACES(Phonon::MediaObjectInterface)
-
- public:
- MediaObject(QObject *parent);
- virtual ~MediaObject();
-
- // 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;
- virtual Phonon::State state() const;
- virtual QString errorString() const;
- virtual Phonon::ErrorType errorType() const;
- virtual qint64 totalTime() const;
- virtual MediaSource source() const;
- virtual void setSource(const MediaSource &);
- virtual void setNextSource(const MediaSource &source);
- virtual qint32 prefinishMark() const;
- virtual void setPrefinishMark(qint32);
- virtual qint32 transitionTime() const;
- virtual void setTransitionTime(qint32);
-
- // VolumeObserver
- void volumeChanged(qreal volume);
-
- void setVideoOutput(VideoOutput* videoOutput);
-
- Q_SIGNALS:
- 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();
- void tick(qint64 time);
-
- private:
- void createPlayer(const MediaSource &source);
- bool openRecognizer();
-
- // Audio / video media type recognition
- MediaType fileMediaType(const QString& fileName);
- // TODO: urlMediaType function
-
- static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &);
-
- private:
- // Audio / video media type recognition
- bool m_recognizerOpened;
- RApaLsSession m_recognizer;
- RFs m_fileServer;
-
- // Storing the file handle here to work around KErrInUse error
- // from MMF player utility OpenFileL functions
- RFile m_file;
-
- QScopedPointer<AbstractPlayer> m_player;
-
- };
- }
+namespace MMF
+{
+class AbstractPlayer;
+class VideoOutput;
+
+/**
+ * @short Facade class which wraps MMF client utility instance
+ */
+class MediaObject : public QObject
+ , public MediaObjectInterface
+ , public VolumeObserver
+{
+ Q_OBJECT
+ Q_INTERFACES(Phonon::MediaObjectInterface)
+
+public:
+ MediaObject(QObject *parent);
+ virtual ~MediaObject();
+
+ // 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;
+ virtual Phonon::State state() const;
+ virtual QString errorString() const;
+ virtual Phonon::ErrorType errorType() const;
+ virtual qint64 totalTime() const;
+ virtual MediaSource source() const;
+ virtual void setSource(const MediaSource &);
+ virtual void setNextSource(const MediaSource &source);
+ virtual qint32 prefinishMark() const;
+ virtual void setPrefinishMark(qint32);
+ virtual qint32 transitionTime() const;
+ virtual void setTransitionTime(qint32);
+
+ // VolumeObserver
+ void volumeChanged(qreal volume);
+
+ void setVideoOutput(VideoOutput* videoOutput);
+
+Q_SIGNALS:
+ 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();
+ void tick(qint64 time);
+
+private:
+ void createPlayer(const MediaSource &source);
+ bool openRecognizer();
+
+ // Audio / video media type recognition
+ MediaType fileMediaType(const QString& fileName);
+ // TODO: urlMediaType function
+
+ static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &);
+
+private:
+ // Audio / video media type recognition
+ bool m_recognizerOpened;
+ RApaLsSession m_recognizer;
+ RFs m_fileServer;
+
+ // Storing the file handle here to work around KErrInUse error
+ // from MMF player utility OpenFileL functions
+ RFile m_file;
+
+ QScopedPointer<AbstractPlayer> m_player;
+
+};
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/utils.cpp b/src/3rdparty/phonon/mmf/utils.cpp
index eb367f6..df9ceae 100644
--- a/src/3rdparty/phonon/mmf/utils.cpp
+++ b/src/3rdparty/phonon/mmf/utils.cpp
@@ -38,8 +38,7 @@ QHBufC MMF::Utils::symbianFilename(const QString& qtFilename)
QHBufC result(qtFilename);
TInt pos = result->Find(ForwardSlash);
- while(pos != KErrNotFound)
- {
+ while (pos != KErrNotFound) {
result->Des().Replace(pos, 1, BackwardSlash);
pos = result->Find(ForwardSlash);
}
@@ -54,18 +53,15 @@ _LIT(KMimePrefixVideo, "video/");
MMF::MediaType MMF::Utils::mimeTypeToMediaType(const TDesC& mimeType)
{
- MediaType result = MediaTypeUnknown;
-
- if(mimeType.Left(KMimePrefixLength).Compare(KMimePrefixAudio) == 0)
- {
- result = MediaTypeAudio;
- }
- else if(mimeType.Left(KMimePrefixLength).Compare(KMimePrefixVideo) == 0)
- {
- result = MediaTypeVideo;
- }
-
- return result;
+ MediaType result = MediaTypeUnknown;
+
+ if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixAudio) == 0) {
+ result = MediaTypeAudio;
+ } else if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixVideo) == 0) {
+ result = MediaTypeVideo;
+ }
+
+ return result;
}
diff --git a/src/3rdparty/phonon/mmf/utils.h b/src/3rdparty/phonon/mmf/utils.h
index e2b5e59..c0487a7 100644
--- a/src/3rdparty/phonon/mmf/utils.h
+++ b/src/3rdparty/phonon/mmf/utils.h
@@ -20,7 +20,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#define PHONON_MMF_UTILS_H
#include <private/qcore_symbian_p.h>
-#include <e32debug.h> // for RDebug
+#include <e32debug.h> // for RDebug
#include "defs.h"
@@ -28,136 +28,132 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
- namespace MMF
- {
- /**
- * Panic codes for fatal errors
- */
- enum PanicCode
- {
- InvalidStatePanic = 1,
- InvalidMediaTypePanic = 2,
- InvalidBackendInterfaceClass = 3
- };
-
- namespace Utils
- {
- /**
- * Raise a fatal exception
- */
- void panic(PanicCode code);
-
- /**
- * Translate forward slashes to backslashes
- *
- * \note This function is a temporary measure, for use until the
- * responsibility for constructing valid file paths is
- * determined.
- */
- QHBufC symbianFilename(const QString& qtFilename);
-
- /**
- * Determines whether the provided MIME type is an audio or video
- * type. If it is neither, the function returns MediaTypeUnknown.
- */
- MediaType mimeTypeToMediaType(const TDesC& mimeType);
- }
-
- /**
- * Available trace categories;
- */
- enum TTraceCategory
- {
- /**
- * Backend
- */
- EBackend = 0x00000001,
-
- /**
- * Functions which map directly to the public Phonon audio API
- */
- EAudioApi = 0x00000010,
-
- /**
- * Internal functions in the audio implementation
- */
- EAudioInternal = 0x00000020,
-
- /**
- * Functions which map directly to the public Phonon video API
- */
- EVideoApi = 0x00010000,
-
- /**
- * Internal functions in the video implementation
- */
- EVideoInternal = 0x00020000
- };
-
- /**
- * Mask indicating which trace categories are enabled
- *
- * Note that, at the moment, this is a compiled static constant. For
- * runtime control over enabled trace categories, this could be replaced
- * by a per-thread singleton object which owns the trace mask, and which
- * exposes an API allowing it to be modified.
- */
- static const TUint KTraceMask = 0xffffffff;
-
- /**
- * Data structure used by tracing macros
- */
- class TTraceContext
- {
- public:
- TTraceContext(const TText* aFunction, const TUint aAddr,
- const TUint aCategory=0)
+namespace MMF
+{
+/**
+ * Panic codes for fatal errors
+ */
+enum PanicCode {
+ InvalidStatePanic = 1,
+ InvalidMediaTypePanic = 2,
+ InvalidBackendInterfaceClass = 3
+};
+
+namespace Utils
+{
+/**
+ * Raise a fatal exception
+ */
+void panic(PanicCode code);
+
+/**
+ * Translate forward slashes to backslashes
+ *
+ * \note This function is a temporary measure, for use until the
+ * responsibility for constructing valid file paths is
+ * determined.
+ */
+QHBufC symbianFilename(const QString& qtFilename);
+
+/**
+ * Determines whether the provided MIME type is an audio or video
+ * type. If it is neither, the function returns MediaTypeUnknown.
+ */
+MediaType mimeTypeToMediaType(const TDesC& mimeType);
+}
+
+/**
+ * Available trace categories;
+ */
+enum TTraceCategory {
+ /**
+ * Backend
+ */
+ EBackend = 0x00000001,
+
+ /**
+ * Functions which map directly to the public Phonon audio API
+ */
+ EAudioApi = 0x00000010,
+
+ /**
+ * Internal functions in the audio implementation
+ */
+ EAudioInternal = 0x00000020,
+
+ /**
+ * Functions which map directly to the public Phonon video API
+ */
+ EVideoApi = 0x00010000,
+
+ /**
+ * Internal functions in the video implementation
+ */
+ EVideoInternal = 0x00020000
+};
+
+/**
+ * Mask indicating which trace categories are enabled
+ *
+ * Note that, at the moment, this is a compiled static constant. For
+ * runtime control over enabled trace categories, this could be replaced
+ * by a per-thread singleton object which owns the trace mask, and which
+ * exposes an API allowing it to be modified.
+ */
+static const TUint KTraceMask = 0xffffffff;
+
+/**
+ * Data structure used by tracing macros
+ */
+class TTraceContext
+{
+public:
+ TTraceContext(const TText* aFunction, const TUint aAddr,
+ const TUint aCategory = 0)
: iFunction(aFunction),
- iAddr(aAddr),
- iCategory(aCategory)
- { }
-
- /**
- * Check whether iCategory appears in the trace mask
- */
- TBool Enabled() const
- {
- return (iCategory == 0) or (iCategory & KTraceMask);
- }
-
- const TText* iFunction; // Name of function
- const TUint iAddr; // 'this' pointer
- const TUint iCategory;
- };
-
- // Macros used internally by the trace system
- #define _TRACE_PRINT RDebug::Print
- #define _TRACE_TEXT(x) (TPtrC((const TText *)(x)))
- #define _TRACE_MODULE Phonon::MMF
-
- // Macros available for use by implementation code
+ iAddr(aAddr),
+ iCategory(aCategory) { }
+
+ /**
+ * Check whether iCategory appears in the trace mask
+ */
+ TBool Enabled() const {
+ return (iCategory == 0) or(iCategory & KTraceMask);
+ }
+
+ const TText* iFunction; // Name of function
+ const TUint iAddr; // 'this' pointer
+ const TUint iCategory;
+};
+
+// Macros used internally by the trace system
+#define _TRACE_PRINT RDebug::Print
+#define _TRACE_TEXT(x) (TPtrC((const TText *)(x)))
+#define _TRACE_MODULE Phonon::MMF
+
+// Macros available for use by implementation code
#ifdef _DEBUG
- #define TRACE_CONTEXT(_fn, _cat) const ::Phonon::MMF::TTraceContext _tc((TText*)L ## #_fn, (TUint)this, _cat);
- #define TRACE_ENTRY_0() { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "+ Phonon::MMF::%s [0x%08x]"), _tc.iFunction, _tc.iAddr); }
- #define TRACE_ENTRY(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "+ Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); }
- #define TRACE_EXIT_0() { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "- Phonon::MMF::%s [0x%08x]"), _tc.iFunction, _tc.iAddr); }
- #define TRACE_EXIT(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "- Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); }
- #define TRACE_RETURN(string, result) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "r Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, result); } return result;
- #define TRACE_PANIC(code) { _TRACE_PRINT(_TRACE_TEXT(L ## "! Phonon::MMF::%s [0x%08x] panic %d"), _tc.iFunction, _tc.iAddr, code); } Utils::panic(code);
- #define TRACE_0(string) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## " Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr); }
- #define TRACE(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## " Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); }
+#define TRACE_CONTEXT(_fn, _cat) const ::Phonon::MMF::TTraceContext _tc((TText*)L ## #_fn, (TUint)this, _cat);
+#define TRACE_ENTRY_0() { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "+ Phonon::MMF::%s [0x%08x]"), _tc.iFunction, _tc.iAddr); }
+#define TRACE_ENTRY(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "+ Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); }
+#define TRACE_EXIT_0() { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "- Phonon::MMF::%s [0x%08x]"), _tc.iFunction, _tc.iAddr); }
+#define TRACE_EXIT(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "- Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); }
+#define TRACE_RETURN(string, result) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "r Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, result); } return result;
+#define TRACE_PANIC(code) { _TRACE_PRINT(_TRACE_TEXT(L ## "! Phonon::MMF::%s [0x%08x] panic %d"), _tc.iFunction, _tc.iAddr, code); } Utils::panic(code);
+#define TRACE_0(string) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## " Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr); }
+#define TRACE(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## " Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); }
#else
- #define TRACE_CONTEXT(_fn, _cat)
- #define TRACE_ENTRY_0()
- #define TRACE_ENTRY(string, args...)
- #define TRACE_EXIT_0()
- #define TRACE_EXIT(string, args...)
- #define TRACE_RETURN(string, result) return result;
- #define TRACE_PANIC(code) Utils::panic(code);
- #define TRACE_0(string)
- #define TRACE(string, args...)
+#define TRACE_CONTEXT(_fn, _cat)
+#define TRACE_ENTRY_0()
+#define TRACE_ENTRY(string, args...)
+#define TRACE_EXIT_0()
+#define TRACE_EXIT(string, args...)
+#define TRACE_RETURN(string, result) return result;
+#define TRACE_PANIC(code) Utils::panic(code);
+#define TRACE_0(string)
+#define TRACE(string, args...)
#endif
- }
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp
index 6534b7b..53178cb 100644
--- a/src/3rdparty/phonon/mmf/videooutput.cpp
+++ b/src/3rdparty/phonon/mmf/videooutput.cpp
@@ -34,24 +34,24 @@ using namespace Phonon::MMF;
//-----------------------------------------------------------------------------
MMF::VideoOutput::VideoOutput(QWidget* parent)
- : QWidget(parent)
- , m_observer(NULL)
+ : QWidget(parent)
+ , m_observer(NULL)
{
- TRACE_CONTEXT(VideoOutput::VideoOutput, EVideoInternal);
- TRACE_ENTRY("parent 0x%08x", 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);
+ setPalette(QPalette(Qt::black));
+ //setAttribute(Qt::WA_OpaquePaintEvent, true);
+ setAttribute(Qt::WA_NoSystemBackground, true);
+ setAutoFillBackground(false);
#endif // PHONON_MMF_VIDEOOUTPUT_IS_QWIDGET
-
+
#ifdef PHONON_MMF_DEBUG_VIDEO_OUTPUT
- dump();
+ dump();
#endif
-
- TRACE_EXIT_0();
+
+ TRACE_EXIT_0();
}
#ifdef PHONON_MMF_DEBUG_VIDEO_OUTPUT
@@ -59,56 +59,54 @@ 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)
- {
+ while (node) {
QWidget* widget = qobject_cast<QWidget*>(node);
const bool visible = widget ? widget->isVisible() : false;
const QHBufC name(node->objectName());
TRACE("node 0x%08x name %S widget 0x%08x visible %d", node, name.data(), 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());
- if(parentWidget)
- {
+ if (parentWidget) {
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();
}
#endif // PHONON_MMF_DEBUG_VIDEO_OUTPUT
MMF::VideoOutput::~VideoOutput()
{
- TRACE_CONTEXT(VideoOutput::~VideoOutput, EVideoInternal);
- TRACE_ENTRY_0();
-
- TRACE_EXIT_0();
+ TRACE_CONTEXT(VideoOutput::~VideoOutput, EVideoInternal);
+ TRACE_ENTRY_0();
+
+ TRACE_EXIT_0();
}
void MMF::VideoOutput::setFrameSize(const QSize& frameSize)
@@ -118,11 +116,10 @@ void MMF::VideoOutput::setFrameSize(const QSize& frameSize)
#else
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.width(), m_frameSize.height(),
+ frameSize.width(), frameSize.height());
+
+ if (frameSize != m_frameSize) {
m_frameSize = frameSize;
updateGeometry();
}
@@ -133,7 +130,7 @@ void MMF::VideoOutput::setObserver(VideoOutputObserver* observer)
{
TRACE_CONTEXT(VideoOutput::setObserver, EVideoInternal);
TRACE("observer 0x%08x", observer);
-
+
m_observer = observer;
}
@@ -147,35 +144,34 @@ void MMF::VideoOutput::setObserver(VideoOutputObserver* observer)
QSize MMF::VideoOutput::sizeHint() const
{
TRACE_CONTEXT(VideoOutput::sizeHint, EVideoApi);
-
+
// TODO: replace this with a more sensible default
QSize result(320, 240);
-
- if(!m_frameSize.isNull())
- {
+
+ if (!m_frameSize.isNull()) {
result = m_frameSize;
}
-
+
TRACE(" result %d %d", result.width(), result.height());
return result;
}
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());
-
- QWidget::paintEvent(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());
+
+ QWidget::paintEvent(event);
}
QPaintEngine* MMF::VideoOutput::paintEngine() const
{
TRACE_CONTEXT(VideoOutput::sizeHint, EVideoApi);
-
+
QPaintEngine* const engine = QWidget::paintEngine();
TRACE_RETURN("0x%08x", engine);
@@ -183,30 +179,28 @@ QPaintEngine* MMF::VideoOutput::paintEngine() const
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());
-
- QWidget::resizeEvent(event);
-
- if(m_observer)
- {
- m_observer->videoOutputRegionChanged();
- }
+ TRACE_CONTEXT(VideoOutput::resizeEvent, EVideoInternal);
+ TRACE("%d %d -> %d %d",
+ event->oldSize().width(), event->oldSize().height(),
+ event->size().width(), event->size().height());
+
+ QWidget::resizeEvent(event);
+
+ if (m_observer) {
+ m_observer->videoOutputRegionChanged();
+ }
}
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());
-
- QWidget::moveEvent(event);
-
- if(m_observer)
- {
+ TRACE_CONTEXT(VideoOutput::moveEvent, EVideoInternal);
+ TRACE("%d %d -> %d %d",
+ event->oldPos().x(), event->oldPos().y(),
+ event->pos().x(), event->pos().y());
+
+ QWidget::moveEvent(event);
+
+ if (m_observer) {
m_observer->videoOutputRegionChanged();
}
}
diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h
index b8e22ca..0da6ea0 100644
--- a/src/3rdparty/phonon/mmf/videooutput.h
+++ b/src/3rdparty/phonon/mmf/videooutput.h
@@ -26,43 +26,43 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
- namespace MMF
- {
- class VideoOutputObserver;
-
- class VideoOutput : public QWidget
- {
- Q_OBJECT
-
- public:
- explicit VideoOutput(QWidget* parent);
- ~VideoOutput();
-
- void setFrameSize(const QSize& size);
- void setObserver(VideoOutputObserver* observer);
-
- protected:
- #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
+namespace MMF
+{
+class VideoOutputObserver;
+
+class VideoOutput : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit VideoOutput(QWidget* parent);
+ ~VideoOutput();
+
+ void setFrameSize(const QSize& size);
+ void setObserver(VideoOutputObserver* observer);
+
+protected:
+#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
#ifdef PHONON_MMF_DEBUG_VIDEO_OUTPUT
- public:
- void dump();
+public:
+ void dump();
#endif
-
- private:
- QSize m_frameSize;
-
- // Not owned
- VideoOutputObserver* m_observer;
- };
- }
+
+private:
+ QSize m_frameSize;
+
+ // Not owned
+ VideoOutputObserver* m_observer;
+};
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/videooutputobserver.h b/src/3rdparty/phonon/mmf/videooutputobserver.h
index d38ff87..e3ba305 100644
--- a/src/3rdparty/phonon/mmf/videooutputobserver.h
+++ b/src/3rdparty/phonon/mmf/videooutputobserver.h
@@ -25,18 +25,18 @@ QT_BEGIN_NAMESPACE
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;
- };
- }
+namespace MMF
+{
+/**
+ * Interface via which VideoOutput notifies VideoPlayer of changes to the
+ * video output screen region.
+ */
+class VideoOutputObserver
+{
+public:
+ virtual void videoOutputRegionChanged() = 0;
+};
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/videoplayer.cpp b/src/3rdparty/phonon/mmf/videoplayer.cpp
index ba06379..f008edd 100644
--- a/src/3rdparty/phonon/mmf/videoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/videoplayer.cpp
@@ -20,7 +20,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <QTimer>
#include <QWidget>
-#include <coemain.h> // For CCoeEnv
+#include <coemain.h> // For CCoeEnv
#include <coecntrl.h>
#include "videoplayer.h"
@@ -36,70 +36,68 @@ using namespace Phonon::MMF;
//-----------------------------------------------------------------------------
MMF::VideoPlayer::VideoPlayer()
- : m_wsSession(NULL)
- , m_screenDevice(NULL)
- , m_window(NULL)
- , m_totalTime(0)
+ : m_wsSession(NULL)
+ , m_screenDevice(NULL)
+ , m_window(NULL)
+ , m_totalTime(0)
{
- construct();
+ construct();
}
MMF::VideoPlayer::VideoPlayer(const AbstractPlayer& player)
- : AbstractMediaPlayer(player)
- , m_wsSession(NULL)
- , m_screenDevice(NULL)
- , m_window(NULL)
- , m_totalTime(0)
+ : AbstractMediaPlayer(player)
+ , m_wsSession(NULL)
+ , m_screenDevice(NULL)
+ , m_window(NULL)
+ , m_totalTime(0)
{
- construct();
+ construct();
}
void MMF::VideoPlayer::construct()
{
- TRACE_CONTEXT(VideoPlayer::VideoPlayer, EVideoApi);
- TRACE_ENTRY_0();
-
- if(!m_videoOutput)
- {
- m_dummyVideoOutput.reset(new VideoOutput(NULL));
- }
-
- videoOutput().setObserver(this);
-
- const TInt priority = 0;
- const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone;
-
- getNativeWindowSystemHandles();
-
- // TODO: is this the correct way to handle errors which occur when
- // creating a Symbian object in the constructor of a Qt object?
- TRAPD(err,
- m_player = CVideoPlayerUtility::NewL
- (
- *this,
- priority, preference,
- *m_wsSession, *m_screenDevice,
- *m_window,
- m_windowRect, m_clipRect
- )
- );
-
- if(KErrNone != err)
- {
- changeState(ErrorState);
- }
-
- TRACE_EXIT_0();
+ TRACE_CONTEXT(VideoPlayer::VideoPlayer, EVideoApi);
+ TRACE_ENTRY_0();
+
+ if (!m_videoOutput) {
+ m_dummyVideoOutput.reset(new VideoOutput(NULL));
+ }
+
+ videoOutput().setObserver(this);
+
+ const TInt priority = 0;
+ const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone;
+
+ getNativeWindowSystemHandles();
+
+ // TODO: is this the correct way to handle errors which occur when
+ // creating a Symbian object in the constructor of a Qt object?
+ TRAPD(err,
+ m_player = CVideoPlayerUtility::NewL
+ (
+ *this,
+ priority, preference,
+ *m_wsSession, *m_screenDevice,
+ *m_window,
+ m_windowRect, m_clipRect
+ )
+ );
+
+ if (KErrNone != err) {
+ changeState(ErrorState);
+ }
+
+ TRACE_EXIT_0();
}
MMF::VideoPlayer::~VideoPlayer()
{
- TRACE_CONTEXT(VideoPlayer::~VideoPlayer, EVideoApi);
+ TRACE_CONTEXT(VideoPlayer::~VideoPlayer, EVideoApi);
TRACE_ENTRY_0();
-
- delete m_player;
-
- TRACE_EXIT_0();
+
+ delete m_player;
+
+ TRACE_EXIT_0();
}
//-----------------------------------------------------------------------------
@@ -107,35 +105,33 @@ MMF::VideoPlayer::~VideoPlayer()
//-----------------------------------------------------------------------------
void MMF::VideoPlayer::doPlay()
-{
- m_player->Play();
+{
+ m_player->Play();
}
void MMF::VideoPlayer::doPause()
{
- TRACE_CONTEXT(VideoPlayer::doPause, EVideoApi);
-
- TRAPD(err, m_player->PauseL());
- if(KErrNone != err)
- {
- TRACE("PauseL error %d", err);
- setError(NormalError);
- }
+ TRACE_CONTEXT(VideoPlayer::doPause, EVideoApi);
+
+ TRAPD(err, m_player->PauseL());
+ if (KErrNone != err) {
+ TRACE("PauseL error %d", err);
+ setError(NormalError);
+ }
}
void MMF::VideoPlayer::doStop()
{
- m_player->Stop();
+ 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)
- {
+ if (KErrNone != err) {
TRACE("SetPositionL error %d", err);
setError(NormalError);
}
@@ -143,48 +139,45 @@ void MMF::VideoPlayer::doSeek(qint64 ms)
int MMF::VideoPlayer::setDeviceVolume(int mmfVolume)
{
- TRAPD(err, m_player->SetVolumeL(mmfVolume));
- return err;
+ TRAPD(err, m_player->SetVolumeL(mmfVolume));
+ return err;
}
int MMF::VideoPlayer::openFile(RFile& file)
{
- TRAPD(err, m_player->OpenFileL(file));
- return err;
+ TRAPD(err, m_player->OpenFileL(file));
+ return err;
}
void MMF::VideoPlayer::close()
{
- m_player->Close();
+ m_player->Close();
}
bool MMF::VideoPlayer::hasVideo() const
{
- return true;
+ return true;
}
qint64 MMF::VideoPlayer::currentTime() const
{
- TRACE_CONTEXT(VideoPlayer::currentTime, EVideoApi);
+ TRACE_CONTEXT(VideoPlayer::currentTime, EVideoApi);
- TTimeIntervalMicroSeconds us;
+ TTimeIntervalMicroSeconds us;
TRAPD(err, us = m_player->PositionL())
qint64 result = 0;
- if(KErrNone == err)
- {
+ if (KErrNone == err) {
result = toMilliSeconds(us);
+ } else {
+ TRACE("PositionL error %d", err);
+
+ // If we don't cast away constness here, we simply have to ignore
+ // the error.
+ const_cast<VideoPlayer*>(this)->setError(NormalError);
}
- else
- {
- TRACE("PositionL 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;
}
@@ -200,60 +193,54 @@ qint64 MMF::VideoPlayer::totalTime() const
void MMF::VideoPlayer::MvpuoOpenComplete(TInt aError)
{
- TRACE_CONTEXT(VideoPlayer::MvpuoOpenComplete, EVideoApi);
+ TRACE_CONTEXT(VideoPlayer::MvpuoOpenComplete, EVideoApi);
TRACE_ENTRY("state %d error %d", state(), aError);
__ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic));
- if(KErrNone == aError)
- {
- m_player->Prepare();
- }
- else
- {
- // TODO: set different error states according to value of aError?
- setError(NormalError);
- }
-
+ if (KErrNone == aError) {
+ m_player->Prepare();
+ } else {
+ // TODO: set different error states according to value of aError?
+ setError(NormalError);
+ }
+
TRACE_EXIT_0();
}
void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError)
{
- TRACE_CONTEXT(VideoPlayer::MvpuoPrepareComplete, EVideoApi);
- TRACE_ENTRY("state %d error %d", state(), aError);
+ TRACE_CONTEXT(VideoPlayer::MvpuoPrepareComplete, EVideoApi);
+ TRACE_ENTRY("state %d error %d", state(), aError);
__ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic));
-
+
TRAPD(err, doPrepareCompleteL(aError));
-
- if(KErrNone == err)
- {
- maxVolumeChanged(m_player->MaxVolume());
-
- videoOutput().setFrameSize(m_frameSize);
+
+ if (KErrNone == err) {
+ maxVolumeChanged(m_player->MaxVolume());
+
+ videoOutput().setFrameSize(m_frameSize);
emit totalTimeChanged(totalTime());
changeState(StoppedState);
- }
- else
- {
- // TODO: set different error states according to value of aError?
- setError(NormalError);
- }
-
- TRACE_EXIT_0();
+ } else {
+ // 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());
}
@@ -261,36 +248,36 @@ void MMF::VideoPlayer::doPrepareCompleteL(TInt aError)
void MMF::VideoPlayer::MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError)
{
- TRACE_CONTEXT(VideoPlayer::MvpuoFrameReady, EVideoApi);
- TRACE_ENTRY("state %d error %d", state(), aError);
-
- // TODO
- Q_UNUSED(aFrame);
- Q_UNUSED(aError); // suppress warnings in release builds
-
- TRACE_EXIT_0();
+ TRACE_CONTEXT(VideoPlayer::MvpuoFrameReady, EVideoApi);
+ TRACE_ENTRY("state %d error %d", state(), aError);
+
+ // TODO
+ Q_UNUSED(aFrame);
+ Q_UNUSED(aError); // suppress warnings in release builds
+
+ TRACE_EXIT_0();
}
void MMF::VideoPlayer::MvpuoPlayComplete(TInt aError)
{
- TRACE_CONTEXT(VideoPlayer::MvpuoPlayComplete, EVideoApi)
- TRACE_ENTRY("state %d error %d", state(), aError);
+ TRACE_CONTEXT(VideoPlayer::MvpuoPlayComplete, EVideoApi)
+ TRACE_ENTRY("state %d error %d", state(), aError);
- // TODO
- Q_UNUSED(aError); // suppress warnings in release builds
-
- TRACE_EXIT_0();
+ // TODO
+ Q_UNUSED(aError); // suppress warnings in release builds
+
+ TRACE_EXIT_0();
}
void MMF::VideoPlayer::MvpuoEvent(const TMMFEvent &aEvent)
{
- TRACE_CONTEXT(VideoPlayer::MvpuoEvent, EVideoApi);
- TRACE_ENTRY("state %d", state());
+ TRACE_CONTEXT(VideoPlayer::MvpuoEvent, EVideoApi);
+ TRACE_ENTRY("state %d", state());
- // TODO
- Q_UNUSED(aEvent);
-
- TRACE_EXIT_0();
+ // TODO
+ Q_UNUSED(aEvent);
+
+ TRACE_EXIT_0();
}
@@ -302,28 +289,27 @@ void MMF::VideoPlayer::videoOutputRegionChanged()
{
TRACE_CONTEXT(VideoPlayer::videoOutputRegionChanged, EVideoInternal);
TRACE_ENTRY_0();
-
+
#ifdef PHONON_MMF_DEBUG_VIDEO_OUTPUT
videoOutput().dump();
#endif
-
+
getNativeWindowSystemHandles();
-
+
TRAPD(err,
- m_player->SetDisplayWindowL
- (
- *m_wsSession, *m_screenDevice,
- *m_window,
- m_windowRect, m_clipRect
- )
- );
-
- if(KErrNone != 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();
}
@@ -334,81 +320,80 @@ void MMF::VideoPlayer::videoOutputRegionChanged()
VideoOutput& MMF::VideoPlayer::videoOutput()
{
- TRACE_CONTEXT(VideoPlayer::videoOutput, EVideoInternal);
- TRACE("videoOutput 0x%08x dummy 0x%08x", m_videoOutput, m_dummyVideoOutput.data());
+ TRACE_CONTEXT(VideoPlayer::videoOutput, EVideoInternal);
+ TRACE("videoOutput 0x%08x dummy 0x%08x", m_videoOutput, m_dummyVideoOutput.data());
- return m_videoOutput ? *m_videoOutput : *m_dummyVideoOutput;
+ return m_videoOutput ? *m_videoOutput : *m_dummyVideoOutput;
}
void MMF::VideoPlayer::videoOutputChanged()
{
- TRACE_CONTEXT(VideoPlayer::videoOutputChanged, EVideoInternal);
- TRACE_ENTRY_0();
-
- // Lazily construct a dummy output if needed here
- if(!m_videoOutput and m_dummyVideoOutput.isNull())
- {
- m_dummyVideoOutput.reset(new VideoOutput(NULL));
- }
-
- videoOutput().setObserver(this);
-
- videoOutput().setFrameSize(m_frameSize);
-
- videoOutputRegionChanged();
-
- TRACE_EXIT_0();
+ TRACE_CONTEXT(VideoPlayer::videoOutputChanged, EVideoInternal);
+ TRACE_ENTRY_0();
+
+ // Lazily construct a dummy output if needed here
+ if (!m_videoOutput and m_dummyVideoOutput.isNull()) {
+ m_dummyVideoOutput.reset(new VideoOutput(NULL));
+ }
+
+ videoOutput().setObserver(this);
+
+ videoOutput().setFrameSize(m_frameSize);
+
+ videoOutputRegionChanged();
+
+ TRACE_EXIT_0();
}
void MMF::VideoPlayer::getNativeWindowSystemHandles()
{
- TRACE_CONTEXT(VideoPlayer::getNativeWindowSystemHandles, EVideoInternal);
-
- VideoOutput& output = videoOutput();
- CCoeControl* const control = output.winId();
-
- TRACE("control 0x%08x", control);
- TRACE("control IsVisible %d", control->IsVisible());
- TRACE("control IsDimmed %d", control->IsDimmed());
- TRACE("control HasBorder %d", control->HasBorder());
- TRACE("control Position %d %d",
- control->Position().iX, control->Position().iY);
- TRACE("control Rect %d %d - %d %d",
- control->Rect().iTl.iX, control->Rect().iTl.iY,
- control->Rect().iBr.iX, control->Rect().iBr.iY);
- TRACE("control OwnsWindow %d", control->OwnsWindow());
-
- CCoeEnv* const coeEnv = control->ControlEnv();
-
- m_wsSession = &(coeEnv->WsSession());
-
- TRACE("session Handle 0x%08x", m_wsSession->Handle());
-
- m_screenDevice = coeEnv->ScreenDevice();
-
- TRACE("device WsHandle 0x%08x", m_screenDevice->WsHandle());
-
- m_window = control->DrawableWindow();
-
- TRACE("window ClientHandle 0x%08x", m_window->ClientHandle());
- TRACE("window WsHandle 0x%08x", m_window->WsHandle());
- TRACE("window WindowGroupId %d", m_window->WindowGroupId());
- TRACE("window Position %d %d",
- m_window->Position().iX, m_window->Position().iY);
- TRACE("window AbsPosition %d %d",
- m_window->AbsPosition().iX, m_window->AbsPosition().iY);
- TRACE("window Size %d %d",
- m_window->Size().iWidth, m_window->Size().iHeight);
-
+ TRACE_CONTEXT(VideoPlayer::getNativeWindowSystemHandles, EVideoInternal);
+
+ VideoOutput& output = videoOutput();
+ CCoeControl* const control = output.winId();
+
+ TRACE("control 0x%08x", control);
+ TRACE("control IsVisible %d", control->IsVisible());
+ TRACE("control IsDimmed %d", control->IsDimmed());
+ TRACE("control HasBorder %d", control->HasBorder());
+ TRACE("control Position %d %d",
+ control->Position().iX, control->Position().iY);
+ TRACE("control Rect %d %d - %d %d",
+ control->Rect().iTl.iX, control->Rect().iTl.iY,
+ control->Rect().iBr.iX, control->Rect().iBr.iY);
+ TRACE("control OwnsWindow %d", control->OwnsWindow());
+
+ CCoeEnv* const coeEnv = control->ControlEnv();
+
+ m_wsSession = &(coeEnv->WsSession());
+
+ TRACE("session Handle 0x%08x", m_wsSession->Handle());
+
+ m_screenDevice = coeEnv->ScreenDevice();
+
+ TRACE("device WsHandle 0x%08x", m_screenDevice->WsHandle());
+
+ m_window = control->DrawableWindow();
+
+ TRACE("window ClientHandle 0x%08x", m_window->ClientHandle());
+ TRACE("window WsHandle 0x%08x", m_window->WsHandle());
+ TRACE("window WindowGroupId %d", m_window->WindowGroupId());
+ TRACE("window Position %d %d",
+ m_window->Position().iX, m_window->Position().iY);
+ TRACE("window AbsPosition %d %d",
+ m_window->AbsPosition().iX, m_window->AbsPosition().iY);
+ 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);
+ // 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();
+ m_windowRect = control->Rect();
#endif
-
- m_clipRect = m_windowRect;
+
+ m_clipRect = m_windowRect;
}
diff --git a/src/3rdparty/phonon/mmf/videoplayer.h b/src/3rdparty/phonon/mmf/videoplayer.h
index f8b1486..da373ab 100644
--- a/src/3rdparty/phonon/mmf/videoplayer.h
+++ b/src/3rdparty/phonon/mmf/videoplayer.h
@@ -29,81 +29,81 @@ QT_BEGIN_NAMESPACE
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
- * play a video file using CVideoPlayerUtility</a>
- */
- class VideoPlayer : public AbstractMediaPlayer
- , public MVideoPlayerUtilityObserver
- , public VideoOutputObserver
- {
- Q_OBJECT
-
- public:
- VideoPlayer();
- explicit VideoPlayer(const AbstractPlayer& player);
- virtual ~VideoPlayer();
-
- // AbstractPlayer
- 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 bool hasVideo() const;
- virtual qint64 currentTime() const;
- virtual qint64 totalTime() const;
-
- // MVideoPlayerUtilityObserver
- virtual void MvpuoOpenComplete(TInt aError);
- virtual void MvpuoPrepareComplete(TInt aError);
- virtual void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError);
- virtual void MvpuoPlayComplete(TInt aError);
- virtual void MvpuoEvent(const TMMFEvent &aEvent);
-
- // VideoOutputObserver
- virtual void videoOutputRegionChanged();
-
- Q_SIGNALS:
- void totalTimeChanged(qint64 length);
- void finished();
-
- private:
- void construct();
- VideoOutput& videoOutput();
-
- void doPrepareCompleteL(TInt aError);
-
- // AbstractPlayer
- virtual void videoOutputChanged();
-
- void getNativeWindowSystemHandles();
-
- private:
- CVideoPlayerUtility* m_player;
- QScopedPointer<VideoOutput> m_dummyVideoOutput;
-
- // Not owned
- RWsSession* m_wsSession;
- CWsScreenDevice* m_screenDevice;
- RWindowBase* m_window;
- TRect m_windowRect;
- TRect m_clipRect;
-
- QSize m_frameSize;
- qint64 m_totalTime;
-
- };
- }
+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
+ * play a video file using CVideoPlayerUtility</a>
+ */
+class VideoPlayer : public AbstractMediaPlayer
+ , public MVideoPlayerUtilityObserver
+ , public VideoOutputObserver
+{
+ Q_OBJECT
+
+public:
+ VideoPlayer();
+ explicit VideoPlayer(const AbstractPlayer& player);
+ virtual ~VideoPlayer();
+
+ // AbstractPlayer
+ 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 bool hasVideo() const;
+ virtual qint64 currentTime() const;
+ virtual qint64 totalTime() const;
+
+ // MVideoPlayerUtilityObserver
+ virtual void MvpuoOpenComplete(TInt aError);
+ virtual void MvpuoPrepareComplete(TInt aError);
+ virtual void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError);
+ virtual void MvpuoPlayComplete(TInt aError);
+ virtual void MvpuoEvent(const TMMFEvent &aEvent);
+
+ // VideoOutputObserver
+ virtual void videoOutputRegionChanged();
+
+Q_SIGNALS:
+ void totalTimeChanged(qint64 length);
+ void finished();
+
+private:
+ void construct();
+ VideoOutput& videoOutput();
+
+ void doPrepareCompleteL(TInt aError);
+
+ // AbstractPlayer
+ virtual void videoOutputChanged();
+
+ void getNativeWindowSystemHandles();
+
+private:
+ CVideoPlayerUtility* m_player;
+ QScopedPointer<VideoOutput> m_dummyVideoOutput;
+
+ // Not owned
+ RWsSession* m_wsSession;
+ CWsScreenDevice* m_screenDevice;
+ RWindowBase* m_window;
+ TRect m_windowRect;
+ TRect m_clipRect;
+
+ QSize m_frameSize;
+ qint64 m_totalTime;
+
+};
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp
index ae94e5e..be3c752 100644
--- a/src/3rdparty/phonon/mmf/videowidget.cpp
+++ b/src/3rdparty/phonon/mmf/videowidget.cpp
@@ -29,11 +29,11 @@ using namespace Phonon::MMF;
// Constants
//-----------------------------------------------------------------------------
-static const Phonon::VideoWidget::AspectRatio DefaultAspectRatio =
- Phonon::VideoWidget::AspectRatioAuto;
+static const Phonon::VideoWidget::AspectRatio DefaultAspectRatio =
+ Phonon::VideoWidget::AspectRatioAuto;
static const qreal DefaultBrightness = 1.0;
-static const Phonon::VideoWidget::ScaleMode DefaultScaleMode =
- Phonon::VideoWidget::FitInView;
+static const Phonon::VideoWidget::ScaleMode DefaultScaleMode =
+ Phonon::VideoWidget::FitInView;
static const qreal DefaultContrast = 1.0;
static const qreal DefaultHue = 1.0;
static const qreal DefaultSaturation = 1.0;
@@ -44,27 +44,27 @@ static const qreal DefaultSaturation = 1.0;
//-----------------------------------------------------------------------------
MMF::VideoWidget::VideoWidget(QWidget* parent)
- : QObject(parent)
- , m_widget(new VideoOutput(parent))
- , m_aspectRatio(DefaultAspectRatio)
- , m_brightness(DefaultBrightness)
- , m_scaleMode(DefaultScaleMode)
- , m_contrast(DefaultContrast)
- , m_hue(DefaultHue)
- , m_saturation(DefaultSaturation)
+ : QObject(parent)
+ , m_widget(new VideoOutput(parent))
+ , m_aspectRatio(DefaultAspectRatio)
+ , m_brightness(DefaultBrightness)
+ , m_scaleMode(DefaultScaleMode)
+ , m_contrast(DefaultContrast)
+ , m_hue(DefaultHue)
+ , m_saturation(DefaultSaturation)
{
- TRACE_CONTEXT(VideoWidget::VideoWidget, EVideoApi);
- TRACE_ENTRY_0();
-
- TRACE_EXIT_0();
+ TRACE_CONTEXT(VideoWidget::VideoWidget, EVideoApi);
+ TRACE_ENTRY_0();
+
+ TRACE_EXIT_0();
}
MMF::VideoWidget::~VideoWidget()
{
- TRACE_CONTEXT(VideoWidget::~VideoWidget, EVideoApi);
- TRACE_ENTRY_0();
-
- TRACE_EXIT_0();
+ TRACE_CONTEXT(VideoWidget::~VideoWidget, EVideoApi);
+ TRACE_ENTRY_0();
+
+ TRACE_EXIT_0();
}
@@ -74,91 +74,91 @@ MMF::VideoWidget::~VideoWidget()
Phonon::VideoWidget::AspectRatio MMF::VideoWidget::aspectRatio() const
{
- return m_aspectRatio;
+ return m_aspectRatio;
}
void MMF::VideoWidget::setAspectRatio
- (Phonon::VideoWidget::AspectRatio aspectRatio)
+(Phonon::VideoWidget::AspectRatio aspectRatio)
{
- TRACE_CONTEXT(VideoWidget::setAspectRatio, EVideoApi);
- TRACE("aspectRatio %d", aspectRatio);
+ TRACE_CONTEXT(VideoWidget::setAspectRatio, EVideoApi);
+ TRACE("aspectRatio %d", aspectRatio);
- m_aspectRatio = aspectRatio;
+ m_aspectRatio = aspectRatio;
}
qreal MMF::VideoWidget::brightness() const
{
- return m_brightness;
+ return m_brightness;
}
void MMF::VideoWidget::setBrightness(qreal brightness)
{
- TRACE_CONTEXT(VideoWidget::setBrightness, EVideoApi);
- TRACE("brightness %f", brightness);
+ TRACE_CONTEXT(VideoWidget::setBrightness, EVideoApi);
+ TRACE("brightness %f", brightness);
- m_brightness = brightness;
+ m_brightness = brightness;
}
Phonon::VideoWidget::ScaleMode MMF::VideoWidget::scaleMode() const
{
- return m_scaleMode;
+ return m_scaleMode;
}
void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode)
{
- TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi);
- TRACE("setScaleMode %d", setScaleMode);
+ TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi);
+ TRACE("setScaleMode %d", setScaleMode);
- m_scaleMode = scaleMode;
+ m_scaleMode = scaleMode;
}
qreal MMF::VideoWidget::contrast() const
{
- return m_contrast;
+ return m_contrast;
}
void MMF::VideoWidget::setContrast(qreal contrast)
{
- TRACE_CONTEXT(VideoWidget::setContrast, EVideoApi);
- TRACE("contrast %f", contrast);
+ TRACE_CONTEXT(VideoWidget::setContrast, EVideoApi);
+ TRACE("contrast %f", contrast);
- m_contrast = contrast;
+ m_contrast = contrast;
}
qreal MMF::VideoWidget::hue() const
{
- return m_hue;
+ return m_hue;
}
void MMF::VideoWidget::setHue(qreal hue)
{
- TRACE_CONTEXT(VideoWidget::setHue, EVideoApi);
- TRACE("hue %f", hue);
+ TRACE_CONTEXT(VideoWidget::setHue, EVideoApi);
+ TRACE("hue %f", hue);
- m_hue = hue;
+ m_hue = hue;
}
qreal MMF::VideoWidget::saturation() const
{
- return m_saturation;
+ return m_saturation;
}
void MMF::VideoWidget::setSaturation(qreal saturation)
{
- TRACE_CONTEXT(VideoWidget::setSaturation, EVideoApi);
- TRACE("saturation %f", saturation);
+ TRACE_CONTEXT(VideoWidget::setSaturation, EVideoApi);
+ TRACE("saturation %f", saturation);
- m_saturation = saturation;
+ m_saturation = saturation;
}
QWidget* MMF::VideoWidget::widget()
{
- return m_widget.data();
+ return m_widget.data();
}
VideoOutput& MMF::VideoWidget::videoOutput()
{
- return *static_cast<VideoOutput*>(widget());
+ return *static_cast<VideoOutput*>(widget());
}
diff --git a/src/3rdparty/phonon/mmf/videowidget.h b/src/3rdparty/phonon/mmf/videowidget.h
index 799121b..e2e1f33 100644
--- a/src/3rdparty/phonon/mmf/videowidget.h
+++ b/src/3rdparty/phonon/mmf/videowidget.h
@@ -27,49 +27,49 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
- namespace MMF
- {
- class VideoOutput;
-
- class VideoWidget : public QObject
- , public Phonon::VideoWidgetInterface
- {
- Q_OBJECT
- Q_INTERFACES(Phonon::VideoWidgetInterface)
-
- public:
- VideoWidget(QWidget* parent);
- ~VideoWidget();
-
- // VideoWidgetInterface
- virtual Phonon::VideoWidget::AspectRatio aspectRatio() const;
- virtual void setAspectRatio(Phonon::VideoWidget::AspectRatio aspectRatio);
- virtual qreal brightness() const;
- virtual void setBrightness(qreal brightness);
- virtual Phonon::VideoWidget::ScaleMode scaleMode() const;
- virtual void setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode);
- virtual qreal contrast() const;
- virtual void setContrast(qreal constrast);
- virtual qreal hue() const;
- virtual void setHue(qreal hue);
- virtual qreal saturation() const;
- virtual void setSaturation(qreal saturation);
- virtual QWidget *widget();
-
- VideoOutput& videoOutput();
-
- private:
- QScopedPointer<QWidget> m_widget;
-
- Phonon::VideoWidget::AspectRatio m_aspectRatio;
- qreal m_brightness;
- Phonon::VideoWidget::ScaleMode m_scaleMode;
- qreal m_contrast;
- qreal m_hue;
- qreal m_saturation;
-
- };
- }
+namespace MMF
+{
+class VideoOutput;
+
+class VideoWidget : public QObject
+ , public Phonon::VideoWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(Phonon::VideoWidgetInterface)
+
+public:
+ VideoWidget(QWidget* parent);
+ ~VideoWidget();
+
+ // VideoWidgetInterface
+ virtual Phonon::VideoWidget::AspectRatio aspectRatio() const;
+ virtual void setAspectRatio(Phonon::VideoWidget::AspectRatio aspectRatio);
+ virtual qreal brightness() const;
+ virtual void setBrightness(qreal brightness);
+ virtual Phonon::VideoWidget::ScaleMode scaleMode() const;
+ virtual void setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode);
+ virtual qreal contrast() const;
+ virtual void setContrast(qreal constrast);
+ virtual qreal hue() const;
+ virtual void setHue(qreal hue);
+ virtual qreal saturation() const;
+ virtual void setSaturation(qreal saturation);
+ virtual QWidget *widget();
+
+ VideoOutput& videoOutput();
+
+private:
+ QScopedPointer<QWidget> m_widget;
+
+ Phonon::VideoWidget::AspectRatio m_aspectRatio;
+ qreal m_brightness;
+ Phonon::VideoWidget::ScaleMode m_scaleMode;
+ qreal m_contrast;
+ qreal m_hue;
+ qreal m_saturation;
+
+};
+}
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/volumeobserver.h b/src/3rdparty/phonon/mmf/volumeobserver.h
index d6717cba..bedd3de 100644
--- a/src/3rdparty/phonon/mmf/volumeobserver.h
+++ b/src/3rdparty/phonon/mmf/volumeobserver.h
@@ -25,18 +25,18 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
- namespace MMF
- {
- /**
- * Interface used by AudioOutput to pass volume control commands
- * back along the audio path to the MediaObject.
- */
- class VolumeObserver
- {
- public:
- virtual void volumeChanged(qreal volume) = 0;
- };
- }
+namespace MMF
+{
+/**
+ * Interface used by AudioOutput to pass volume control commands
+ * back along the audio path to the MediaObject.
+ */
+class VolumeObserver
+{
+public:
+ virtual void volumeChanged(qreal volume) = 0;
+};
+}
}
QT_END_NAMESPACE