diff options
author | McCabe Maxsted | 2009-02-20 15:33:07 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-02-20 15:33:07 -0700 |
commit | 829e1b311f5fdd3c19d812b14cccf1175ddf6dc6 (patch) | |
tree | 148792be99dc308a5a95b1b50705e17a81a8565d /linden/indra/llaudio | |
parent | Updated GStreamer comments (diff) | |
download | meta-impy-829e1b311f5fdd3c19d812b14cccf1175ddf6dc6.zip meta-impy-829e1b311f5fdd3c19d812b14cccf1175ddf6dc6.tar.gz meta-impy-829e1b311f5fdd3c19d812b14cccf1175ddf6dc6.tar.bz2 meta-impy-829e1b311f5fdd3c19d812b14cccf1175ddf6dc6.tar.xz |
Added STATUS_DEAD to LLMediaBase
Diffstat (limited to 'linden/indra/llaudio')
-rw-r--r-- | linden/indra/llaudio/audioengine.cpp | 55 | ||||
-rw-r--r-- | linden/indra/llaudio/audioengine.h | 6 |
2 files changed, 28 insertions, 33 deletions
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 @@ | |||
45 | #include "llassetstorage.h" | 45 | #include "llassetstorage.h" |
46 | 46 | ||
47 | #include "llmediamanager.h" | 47 | #include "llmediamanager.h" |
48 | #include "llmediabase.h" | ||
49 | #include "llmediaimplcommon.h" | ||
48 | 50 | ||
49 | // necessary for grabbing sounds from sim (implemented in viewer) | 51 | // necessary for grabbing sounds from sim (implemented in viewer) |
50 | extern void request_sound(const LLUUID &sound_guid); | 52 | extern void request_sound(const LLUUID &sound_guid); |
@@ -101,6 +103,8 @@ void LLAudioEngine::setDefaults() | |||
101 | 103 | ||
102 | for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) | 104 | for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) |
103 | mSecondaryGain[i] = 1.0f; | 105 | mSecondaryGain[i] = 1.0f; |
106 | |||
107 | mStatus = LLMediaBase::STATUS_UNKNOWN; | ||
104 | } | 108 | } |
105 | 109 | ||
106 | 110 | ||
@@ -168,6 +172,14 @@ void LLAudioEngine::shutdown() | |||
168 | } | 172 | } |
169 | 173 | ||
170 | 174 | ||
175 | //////////////////////////////////////////////////////////////////////////////// | ||
176 | // virtual (derives from LLMediaBase) | ||
177 | LLMediaBase::EStatus LLAudioEngine::getStatus() | ||
178 | { | ||
179 | return mStatus; | ||
180 | } | ||
181 | |||
182 | |||
171 | // virtual | 183 | // virtual |
172 | void LLAudioEngine::startInternetStream(const std::string& url) | 184 | void LLAudioEngine::startInternetStream(const std::string& url) |
173 | { | 185 | { |
@@ -179,12 +191,22 @@ void LLAudioEngine::startInternetStream(const std::string& url) | |||
179 | if (mgr) | 191 | if (mgr) |
180 | { | 192 | { |
181 | mInternetStreamMedia = mgr->createSourceFromMimeType(LLURI(url).scheme(), "audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis. | 193 | mInternetStreamMedia = mgr->createSourceFromMimeType(LLURI(url).scheme(), "audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis. |
182 | LL_INFOS("AudioEngine") << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl; | 194 | //LL_INFOS("AudioEngine") << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl; |
183 | } | 195 | } |
184 | } | 196 | } |
185 | 197 | ||
186 | if(!mInternetStreamMedia) | 198 | if(!mInternetStreamMedia) |
187 | return; | 199 | return; |
200 | |||
201 | // Check for a dead stream, just in case | ||
202 | if(getStatus() == LLMediaBase::STATUS_DEAD) | ||
203 | { | ||
204 | mInternetStreamURL.clear(); | ||
205 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); | ||
206 | mInternetStreamMedia->updateMedia(); | ||
207 | stopInternetStream(); | ||
208 | return; | ||
209 | } | ||
188 | 210 | ||
189 | if (!url.empty()) | 211 | if (!url.empty()) |
190 | { | 212 | { |
@@ -202,7 +224,6 @@ void LLAudioEngine::startInternetStream(const std::string& url) | |||
202 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); | 224 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); |
203 | mInternetStreamMedia->updateMedia(); | 225 | mInternetStreamMedia->updateMedia(); |
204 | } | 226 | } |
205 | //#endif | ||
206 | } | 227 | } |
207 | 228 | ||
208 | // virtual | 229 | // virtual |
@@ -223,31 +244,6 @@ void LLAudioEngine::stopInternetStream() | |||
223 | } | 244 | } |
224 | 245 | ||
225 | // virtual | 246 | // virtual |
226 | void LLAudioEngine::pauseInternetStream(int pause) | ||
227 | { | ||
228 | LL_INFOS("AudioEngine") << "entered pauseInternetStream()" << llendl; | ||
229 | |||
230 | if(!mInternetStreamMedia) | ||
231 | return; | ||
232 | |||
233 | if(pause) | ||
234 | { | ||
235 | if(! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_PAUSE)) | ||
236 | { | ||
237 | LL_INFOS("AudioEngine") << "attempting to pause stream failed!" << llendl; | ||
238 | } | ||
239 | } | ||
240 | else | ||
241 | { | ||
242 | if(! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START)) | ||
243 | { | ||
244 | LL_INFOS("AudioEngine") << "attempting to unpause stream failed!" << llendl; | ||
245 | } | ||
246 | } | ||
247 | mInternetStreamMedia->updateMedia(); | ||
248 | } | ||
249 | |||
250 | // virtual | ||
251 | void LLAudioEngine::updateInternetStream() | 247 | void LLAudioEngine::updateInternetStream() |
252 | { | 248 | { |
253 | if (mInternetStreamMedia) | 249 | if (mInternetStreamMedia) |
@@ -265,11 +261,6 @@ int LLAudioEngine::isInternetStreamPlaying() | |||
265 | return 1; // Active and playing | 261 | return 1; // Active and playing |
266 | } | 262 | } |
267 | 263 | ||
268 | if (mInternetStreamMedia->getStatus() == LLMediaBase::STATUS_PAUSED) | ||
269 | { | ||
270 | return 2; // paused | ||
271 | } | ||
272 | |||
273 | return 0; // Stopped | 264 | return 0; // Stopped |
274 | } | 265 | } |
275 | 266 | ||
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 @@ | |||
45 | #include "llframetimer.h" | 45 | #include "llframetimer.h" |
46 | #include "llassettype.h" | 46 | #include "llassettype.h" |
47 | 47 | ||
48 | #include "llmediabase.h" | ||
49 | |||
48 | class LLMediaBase; | 50 | class LLMediaBase; |
49 | 51 | ||
50 | const F32 LL_WIND_UPDATE_INTERVAL = 0.1f; | 52 | const F32 LL_WIND_UPDATE_INTERVAL = 0.1f; |
@@ -153,13 +155,13 @@ public: | |||
153 | // Internet stream methods | 155 | // Internet stream methods |
154 | virtual void startInternetStream(const std::string& url); | 156 | virtual void startInternetStream(const std::string& url); |
155 | virtual void stopInternetStream(); | 157 | virtual void stopInternetStream(); |
156 | virtual void pauseInternetStream(int pause); | ||
157 | virtual void updateInternetStream(); | 158 | virtual void updateInternetStream(); |
158 | virtual int isInternetStreamPlaying(); | 159 | virtual int isInternetStreamPlaying(); |
159 | virtual void getInternetStreamInfo(char* artist, char* title); | 160 | virtual void getInternetStreamInfo(char* artist, char* title); |
160 | // use a value from 0.0 to 1.0, inclusive | 161 | // use a value from 0.0 to 1.0, inclusive |
161 | virtual void setInternetStreamGain(F32 vol); | 162 | virtual void setInternetStreamGain(F32 vol); |
162 | virtual const std::string& getInternetStreamURL(); | 163 | virtual const std::string& getInternetStreamURL(); |
164 | virtual LLMediaBase::EStatus getStatus(); | ||
163 | 165 | ||
164 | // For debugging usage | 166 | // For debugging usage |
165 | virtual LLVector3 getListenerPos(); | 167 | virtual LLVector3 getListenerPos(); |
@@ -246,6 +248,8 @@ protected: | |||
246 | 248 | ||
247 | LLFrameTimer mWindUpdateTimer; | 249 | LLFrameTimer mWindUpdateTimer; |
248 | 250 | ||
251 | LLMediaBase::EStatus mStatus; | ||
252 | |||
249 | private: | 253 | private: |
250 | void setDefaults(); | 254 | void setDefaults(); |
251 | LLMediaBase *mInternetStreamMedia; | 255 | LLMediaBase *mInternetStreamMedia; |