From 829e1b311f5fdd3c19d812b14cccf1175ddf6dc6 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 20 Feb 2009 15:33:07 -0700 Subject: Added STATUS_DEAD to LLMediaBase --- linden/indra/llaudio/audioengine.cpp | 55 +++++++++++++++--------------------- linden/indra/llaudio/audioengine.h | 6 +++- 2 files changed, 28 insertions(+), 33 deletions(-) (limited to 'linden/indra/llaudio') diff --git a/linden/indra/llaudio/audioengine.cpp b/linden/indra/llaudio/audioengine.cpp index 3a079f1..400e938 100644 --- a/linden/indra/llaudio/audioengine.cpp +++ b/linden/indra/llaudio/audioengine.cpp @@ -45,6 +45,8 @@ #include "llassetstorage.h" #include "llmediamanager.h" +#include "llmediabase.h" +#include "llmediaimplcommon.h" // necessary for grabbing sounds from sim (implemented in viewer) extern void request_sound(const LLUUID &sound_guid); @@ -101,6 +103,8 @@ void LLAudioEngine::setDefaults() for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) mSecondaryGain[i] = 1.0f; + + mStatus = LLMediaBase::STATUS_UNKNOWN; } @@ -168,6 +172,14 @@ void LLAudioEngine::shutdown() } +//////////////////////////////////////////////////////////////////////////////// +// virtual (derives from LLMediaBase) +LLMediaBase::EStatus LLAudioEngine::getStatus() +{ + return mStatus; +} + + // virtual void LLAudioEngine::startInternetStream(const std::string& url) { @@ -179,12 +191,22 @@ void LLAudioEngine::startInternetStream(const std::string& url) if (mgr) { mInternetStreamMedia = mgr->createSourceFromMimeType(LLURI(url).scheme(), "audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis. - LL_INFOS("AudioEngine") << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl; + //LL_INFOS("AudioEngine") << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl; } } if(!mInternetStreamMedia) return; + + // Check for a dead stream, just in case + if(getStatus() == LLMediaBase::STATUS_DEAD) + { + mInternetStreamURL.clear(); + mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); + mInternetStreamMedia->updateMedia(); + stopInternetStream(); + return; + } if (!url.empty()) { @@ -202,7 +224,6 @@ void LLAudioEngine::startInternetStream(const std::string& url) mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); mInternetStreamMedia->updateMedia(); } - //#endif } // virtual @@ -223,31 +244,6 @@ void LLAudioEngine::stopInternetStream() } // virtual -void LLAudioEngine::pauseInternetStream(int pause) -{ - LL_INFOS("AudioEngine") << "entered pauseInternetStream()" << llendl; - - if(!mInternetStreamMedia) - return; - - if(pause) - { - if(! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_PAUSE)) - { - LL_INFOS("AudioEngine") << "attempting to pause stream failed!" << llendl; - } - } - else - { - if(! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START)) - { - LL_INFOS("AudioEngine") << "attempting to unpause stream failed!" << llendl; - } - } - mInternetStreamMedia->updateMedia(); -} - -// virtual void LLAudioEngine::updateInternetStream() { if (mInternetStreamMedia) @@ -265,11 +261,6 @@ int LLAudioEngine::isInternetStreamPlaying() return 1; // Active and playing } - if (mInternetStreamMedia->getStatus() == LLMediaBase::STATUS_PAUSED) - { - return 2; // paused - } - return 0; // Stopped } diff --git a/linden/indra/llaudio/audioengine.h b/linden/indra/llaudio/audioengine.h index 15cb35f..878a96a 100644 --- a/linden/indra/llaudio/audioengine.h +++ b/linden/indra/llaudio/audioengine.h @@ -45,6 +45,8 @@ #include "llframetimer.h" #include "llassettype.h" +#include "llmediabase.h" + class LLMediaBase; const F32 LL_WIND_UPDATE_INTERVAL = 0.1f; @@ -153,13 +155,13 @@ public: // Internet stream methods virtual void startInternetStream(const std::string& url); virtual void stopInternetStream(); - virtual void pauseInternetStream(int pause); virtual void updateInternetStream(); virtual int isInternetStreamPlaying(); virtual void getInternetStreamInfo(char* artist, char* title); // use a value from 0.0 to 1.0, inclusive virtual void setInternetStreamGain(F32 vol); virtual const std::string& getInternetStreamURL(); + virtual LLMediaBase::EStatus getStatus(); // For debugging usage virtual LLVector3 getListenerPos(); @@ -246,6 +248,8 @@ protected: LLFrameTimer mWindUpdateTimer; + LLMediaBase::EStatus mStatus; + private: void setDefaults(); LLMediaBase *mInternetStreamMedia; -- cgit v1.1