summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/phonon/mmf/mediaobject.cpp
diff options
context:
space:
mode:
authorGareth Stockwell <gareth.stockwell@sosco.com>2009-08-19 11:57:27 (GMT)
committerGareth Stockwell <gareth.stockwell@sosco.com>2009-08-19 11:57:27 (GMT)
commitd9e03376f9f82e5664dfd2446ff4c05e35ffb535 (patch)
tree711f77f7d307c05a3ae310b1fd59bbce74bd8eab /src/3rdparty/phonon/mmf/mediaobject.cpp
parent98d4c657803d5f1956560bd9b62e73f15c05e8fd (diff)
parentca0b5b503e8865c0eedeea86aa132291281fc49f (diff)
downloadQt-d9e03376f9f82e5664dfd2446ff4c05e35ffb535.zip
Qt-d9e03376f9f82e5664dfd2446ff4c05e35ffb535.tar.gz
Qt-d9e03376f9f82e5664dfd2446ff4c05e35ffb535.tar.bz2
Merged in DummyPlayer changes
Diffstat (limited to 'src/3rdparty/phonon/mmf/mediaobject.cpp')
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.cpp180
1 files changed, 45 insertions, 135 deletions
diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp
index 5b0ac36..c5310a5 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"
@@ -32,6 +33,8 @@ using namespace Phonon::MMF;
MMF::MediaObject::MediaObject(QObject *parent) : QObject::QObject(parent)
, m_recognizerOpened(false)
{
+ m_player.reset(new DummyPlayer());
+
TRACE_CONTEXT(MediaObject::MediaObject, EAudioApi);
TRACE_ENTRY_0();
@@ -142,145 +145,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)
{
- createPlayer(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);
- }
+ createPlayer(source);
+
+ // This is a hack to work around KErrInUse from MMF client utility
+ // OpenFileL calls
+ m_player->setFileSource(source, m_file);
}
void MMF::MediaObject::createPlayer(const MediaSource &source)
@@ -289,12 +228,18 @@ void MMF::MediaObject::createPlayer(const MediaSource &source)
TRACE_ENTRY("state %d source.type %d", state(), source.type());
TRACE_ENTRY("source.type %d", source.type());
+ // Store old player object
+/*
+ AbstractPlayer* oldPlayer = m_player.take();
+
+
// Destroy old player object
if(!m_player.isNull())
{
disconnect(m_player.data(), 0, this, 0);
- m_player.reset(NULL);
+ m_player.reset();
}
+*/
MediaType mediaType = MediaTypeUnknown;
@@ -308,14 +253,13 @@ void MMF::MediaObject::createPlayer(const MediaSource &source)
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;
*/
+ break;
case MediaSource::Invalid:
case MediaSource::Disc:
@@ -330,14 +274,15 @@ void MMF::MediaObject::createPlayer(const MediaSource &source)
break;
case MediaSource::Empty:
- TRACE_EXIT_0();
- return;
+ TRACE_0("Empty media source");
+ break;
}
switch(mediaType)
{
case MediaTypeUnknown:
TRACE_0("Media type could not be determined");
+ m_player.reset(new DummyPlayer());
/*
* TODO: handle error
*
@@ -355,57 +300,35 @@ void MMF::MediaObject::createPlayer(const MediaSource &source)
break;
}
- if(!m_player.isNull())
- {
- connect(m_player.data(), SIGNAL(totalTimeChanged()), SIGNAL(totalTimeChanged()));
- 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)));
- }
+ connect(m_player.data(), SIGNAL(totalTimeChanged()), SIGNAL(totalTimeChanged()));
+ 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)));
}
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);
}
//-----------------------------------------------------------------------------
@@ -414,29 +337,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);
}