summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-08-18 09:50:35 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-08-18 09:56:37 (GMT)
commitf21096e918a587287d61446e930c40914e2b7ce5 (patch)
tree7eb0860f64401a361789a2a996edcc8a57250751
parent008d464ea90a0a33f16bd6ce29563e7dd206b91f (diff)
downloadQt-f21096e918a587287d61446e930c40914e2b7ce5.zip
Qt-f21096e918a587287d61446e930c40914e2b7ce5.tar.gz
Qt-f21096e918a587287d61446e930c40914e2b7ce5.tar.bz2
Add the DummyPlayer, as discussed with Gareth.
-rw-r--r--src/3rdparty/phonon/mmf/abstractplayer.h3
-rw-r--r--src/3rdparty/phonon/mmf/dummyplayer.cpp137
-rw-r--r--src/3rdparty/phonon/mmf/dummyplayer.h74
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.cpp154
-rw-r--r--src/plugins/phonon/mmf/mmf.pro6
5 files changed, 247 insertions, 127 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h
index 418b896..397521a 100644
--- a/src/3rdparty/phonon/mmf/abstractplayer.h
+++ b/src/3rdparty/phonon/mmf/abstractplayer.h
@@ -52,8 +52,7 @@ namespace Phonon
// 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 setFileSource(const Phonon::MediaSource&, RFile&) = 0;
virtual void setNextSource(const Phonon::MediaSource &) = 0;
diff --git a/src/3rdparty/phonon/mmf/dummyplayer.cpp b/src/3rdparty/phonon/mmf/dummyplayer.cpp
new file mode 100644
index 0000000..ecd6815
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/dummyplayer.cpp
@@ -0,0 +1,137 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "dummyplayer.h"
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+void MMF::DummyPlayer::play()
+{
+}
+
+void MMF::DummyPlayer::pause()
+{
+}
+
+void MMF::DummyPlayer::stop()
+{
+}
+
+void MMF::DummyPlayer::seek(qint64)
+{
+}
+
+qint32 MMF::DummyPlayer::tickInterval() const
+{
+ return 0;
+}
+
+void MMF::DummyPlayer::setTickInterval(qint32)
+{
+}
+
+bool MMF::DummyPlayer::hasVideo() const
+{
+ return false;
+}
+
+bool MMF::DummyPlayer::isSeekable() const
+{
+ return false;
+}
+
+Phonon::State MMF::DummyPlayer::state() const
+{
+ return Phonon::StoppedState;
+}
+
+qint64 MMF::DummyPlayer::currentTime() const
+{
+ return 0;
+}
+
+QString MMF::DummyPlayer::errorString() const
+{
+ return QString();
+}
+
+Phonon::ErrorType MMF::DummyPlayer::errorType() const
+{
+ return Phonon::NoError;
+}
+
+qint64 MMF::DummyPlayer::totalTime() const
+{
+ return 0;
+}
+
+MediaSource MMF::DummyPlayer::source() const
+{
+ return MediaSource();
+}
+
+void MMF::DummyPlayer::setSource(const MediaSource &)
+{
+}
+
+void MMF::DummyPlayer::setNextSource(const MediaSource &)
+{
+}
+
+qint32 MMF::DummyPlayer::prefinishMark() const
+{
+ return 0;
+}
+
+void MMF::DummyPlayer::setPrefinishMark(qint32)
+{
+}
+
+qint32 MMF::DummyPlayer::transitionTime() const
+{
+ return 0;
+}
+
+void MMF::DummyPlayer::setTransitionTime(qint32)
+{
+}
+
+void MMF::DummyPlayer::setFileSource(const Phonon::MediaSource &, RFile &)
+{
+}
+
+//-----------------------------------------------------------------------------
+// Volume
+//-----------------------------------------------------------------------------
+
+qreal MMF::DummyPlayer::volume() const
+{
+ return 0;
+}
+
+bool MMF::DummyPlayer::setVolume(qreal)
+{
+ return true;
+}
+
+void MMF::DummyPlayer::setAudioOutput(AudioOutput *)
+{
+}
+
+
diff --git a/src/3rdparty/phonon/mmf/dummyplayer.h b/src/3rdparty/phonon/mmf/dummyplayer.h
new file mode 100644
index 0000000..263a013
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/dummyplayer.h
@@ -0,0 +1,74 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_DUMMYPLAYER_H
+#define PHONON_MMF_DUMMYPLAYER_H
+
+#include "abstractplayer.h"
+
+namespace Phonon
+{
+ namespace MMF
+ {
+ class AudioOutput;
+
+ /**
+ * @short In order to make the implementation of MediaObject simpler,
+ * we have this class.
+ */
+ class DummyPlayer : public AbstractPlayer
+ {
+ public:
+ // AbstractPlayer
+ 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);
+ virtual qreal volume() const;
+ virtual bool setVolume(qreal volume);
+
+ virtual void setAudioOutput(AudioOutput* audioOutput);
+ virtual void setFileSource(const Phonon::MediaSource&, RFile&);
+
+ Q_SIGNALS:
+ void totalTimeChanged();
+ void stateChanged(Phonon::State oldState,
+ Phonon::State newState);
+ void finished();
+ void tick(qint64 time);
+ };
+ }
+}
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp
index 62dc903..0d106f5 100644
--- a/src/3rdparty/phonon/mmf/mediaobject.cpp
+++ b/src/3rdparty/phonon/mmf/mediaobject.cpp
@@ -17,6 +17,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "audioplayer.h"
+#include "dummyplayer.h"
#include "mediaobject.h"
#include "utils.h"
#include "videoplayer.h"
@@ -31,6 +32,8 @@ using namespace Phonon::MMF;
MMF::MediaObject::MediaObject(QObject *parent) : QObject::QObject(parent)
{
+ m_player.reset(new DummyPlayer());
+
TRACE_CONTEXT(MediaObject::MediaObject, EAudioApi);
TRACE_ENTRY_0();
@@ -121,145 +124,81 @@ MMF::MediaObject::MediaType MMF::MediaObject::fileMediaType
void MMF::MediaObject::play()
{
- if(!m_player.isNull())
- {
- m_player->play();
- }
+ m_player->play();
}
void MMF::MediaObject::pause()
{
- if(!m_player.isNull())
- {
- m_player->pause();
- }
+ m_player->pause();
}
void MMF::MediaObject::stop()
{
- if(!m_player.isNull())
- {
- m_player->stop();
- }
+ m_player->stop();
}
void MMF::MediaObject::seek(qint64 ms)
{
- if(!m_player.isNull())
- {
- m_player->seek(ms);
- }
+ m_player->seek(ms);
}
qint32 MMF::MediaObject::tickInterval() const
{
- qint32 result = 0;
- if(!m_player.isNull())
- {
- result = m_player->tickInterval();
- }
- return result;
+ return m_player->tickInterval();
}
void MMF::MediaObject::setTickInterval(qint32 interval)
{
- if(!m_player.isNull())
- {
- m_player->setTickInterval(interval);
- }
+ m_player->setTickInterval(interval);
}
bool MMF::MediaObject::hasVideo() const
{
- bool result = false;
- if(!m_player.isNull())
- {
- result = m_player->hasVideo();
- }
- return result;
+ return m_player->hasVideo();
}
bool MMF::MediaObject::isSeekable() const
{
- bool result = false;
- if(!m_player.isNull())
- {
- result = m_player->isSeekable();
- }
- return result;
+ return m_player->isSeekable();
}
Phonon::State MMF::MediaObject::state() const
{
- Phonon::State result = Phonon::StoppedState;
- if(!m_player.isNull())
- {
- result = m_player->state();
- }
- return result;
+ return m_player->state();
}
qint64 MMF::MediaObject::currentTime() const
{
- qint64 result = 0;
- if(!m_player.isNull())
- {
- result = m_player->currentTime();
- }
- return result;
+ return m_player->currentTime();
}
QString MMF::MediaObject::errorString() const
{
- QString result;
- if(!m_player.isNull())
- {
- result = m_player->errorString();
- }
- return result;
+ return m_player->errorString();
}
Phonon::ErrorType MMF::MediaObject::errorType() const
{
- Phonon::ErrorType result = Phonon::NoError;
- if(!m_player.isNull())
- {
- result = m_player->errorType();
- }
- return result;
+ return m_player->errorType();
}
qint64 MMF::MediaObject::totalTime() const
{
- qint64 result = 0;
- if(!m_player.isNull())
- {
- result = m_player->totalTime();
- }
- return result;
+ return m_player->totalTime();
}
MediaSource MMF::MediaObject::source() const
{
- MediaSource result;
- if(!m_player.isNull())
- {
- result = m_player->source();
- }
- return result;
+ return m_player->source();
}
void MMF::MediaObject::setSource(const MediaSource &source)
{
loadPlayer(source);
- if(!m_player.isNull())
- {
- //m_player->setSource(source);
-
- // This is a hack to work around KErrInUse from MMF client utility
- // OpenFileL calls
- m_player->setFileSource(source, m_file);
- }
+
+ // This is a hack to work around KErrInUse from MMF client utility
+ // OpenFileL calls
+ m_player->setFileSource(source, m_file);
}
void MMF::MediaObject::loadPlayer(const MediaSource &source)
@@ -273,7 +212,7 @@ void MMF::MediaObject::loadPlayer(const MediaSource &source)
if(!m_player.isNull())
{
disconnect(m_player.data(), 0, this, 0);
- m_player.reset(NULL);
+ m_player.reset();
}
MediaType mediaType = MediaTypeUnknown;
@@ -317,6 +256,7 @@ void MMF::MediaObject::loadPlayer(const MediaSource &source)
switch(mediaType)
{
case MediaTypeUnknown:
+ m_player.reset(new DummyPlayer());
TRACE_0("Media type could not be determined");
/*
* TODO: handle error
@@ -346,46 +286,27 @@ void MMF::MediaObject::loadPlayer(const MediaSource &source)
void MMF::MediaObject::setNextSource(const MediaSource &source)
{
- if(!m_player.isNull())
- {
- m_player->setNextSource(source);
- }
+ m_player->setNextSource(source);
}
qint32 MMF::MediaObject::prefinishMark() const
{
- qint32 result = 0;
- if(!m_player.isNull())
- {
- result = m_player->prefinishMark();
- }
- return result;
+ return m_player->prefinishMark();
}
void MMF::MediaObject::setPrefinishMark(qint32 mark)
{
- if(!m_player.isNull())
- {
- m_player->setPrefinishMark(mark);
- }
+ m_player->setPrefinishMark(mark);
}
qint32 MMF::MediaObject::transitionTime() const
{
- qint32 result = 0;
- if(!m_player.isNull())
- {
- result = m_player->transitionTime();
- }
- return result;
+ return m_player->transitionTime();
}
void MMF::MediaObject::setTransitionTime(qint32 time)
{
- if(!m_player.isNull())
- {
- m_player->setTransitionTime(time);
- }
+ m_player->setTransitionTime(time);
}
//-----------------------------------------------------------------------------
@@ -394,29 +315,16 @@ void MMF::MediaObject::setTransitionTime(qint32 time)
qreal MMF::MediaObject::volume() const
{
- qreal result = 0.0;
- if(!m_player.isNull())
- {
- m_player->volume();
- }
- return result;
+ return m_player->volume();
}
bool MMF::MediaObject::setVolume(qreal volume)
{
- bool result = false;
- if(!m_player.isNull())
- {
- result = m_player->setVolume(volume);
- }
- return result;
+ return m_player->setVolume(volume);
}
void MMF::MediaObject::setAudioOutput(AudioOutput* audioOutput)
{
- if(!m_player.isNull())
- {
- m_player->setAudioOutput(audioOutput);
- }
+ m_player->setAudioOutput(audioOutput);
}
diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro
index 0f00832..7beaa86 100644
--- a/src/plugins/phonon/mmf/mmf.pro
+++ b/src/plugins/phonon/mmf/mmf.pro
@@ -26,6 +26,7 @@ HEADERS += \
$$PHONON_MMF_DIR/audiooutput.h \
$$PHONON_MMF_DIR/audioplayer.h \
$$PHONON_MMF_DIR/backend.h \
+ $$PHONON_MMF_DIR/dummyplayer.h \
$$PHONON_MMF_DIR/mediaobject.h \
$$PHONON_MMF_DIR/utils.h \
$$PHONON_MMF_DIR/videoplayer.h
@@ -34,12 +35,13 @@ SOURCES += \
$$PHONON_MMF_DIR/audiooutput.cpp \
$$PHONON_MMF_DIR/audioplayer.cpp \
$$PHONON_MMF_DIR/backend.cpp \
+ $$PHONON_MMF_DIR/dummyplayer.cpp \
$$PHONON_MMF_DIR/mediaobject.cpp \
$$PHONON_MMF_DIR/utils.cpp \
$$PHONON_MMF_DIR/videoplayer.cpp
-LIBS += -lefsrv # For file server
-LIBS += -lapgrfx.lib -lapmime.lib # For recognizer
+LIBS += -lefsrv # For file server
+LIBS += -lapgrfx.lib -lapmime.lib # For recognizer
# This is needed for having the .qtplugin file properly created on Symbian.
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend