diff options
Diffstat (limited to 'src/3rdparty/phonon/mmf/audioplayer.cpp')
-rw-r--r-- | src/3rdparty/phonon/mmf/audioplayer.cpp | 127 |
1 files changed, 58 insertions, 69 deletions
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(); } |