diff options
author | Rick Pasetto <rick@lindenlab.com> | 2010-02-12 13:38:17 -0800 |
---|---|---|
committer | Rick Pasetto <rick@lindenlab.com> | 2010-02-12 13:38:17 -0800 |
commit | ffd962f3a3eafd7b65f90039a5bb04dccb0205bc (patch) | |
tree | 9f1674862487a62a8c269ae32f424bb2433000b2 /indra/newview/llviewermedia.cpp | |
parent | e47dc498e86034a2c991d0add56d522a39354417 (diff) |
EXT-5267 EXT-5268: Add Parcel Media and Parcel Audio items to nearby media panel
Review #109
This (fairly major) change adds new "items" to the media list for
Parcel Media and Parcel Audio. Since these items are special (before
the items were always MoaP impls), they had to be treated
special. Moreover, actions on all of "media" had to be centralized so
that they would have similar behavior.
Diffstat (limited to 'indra/newview/llviewermedia.cpp')
-rw-r--r-- | indra/newview/llviewermedia.cpp | 98 |
1 files changed, 78 insertions, 20 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 1b6236ce4a..7b5d1d9814 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -864,26 +864,9 @@ void LLViewerMedia::updateMedia(void *dummy_arg) total_cpu += pimpl->getCPUUsage(); - // Only set sAnyMedia​Showing if it isn't used in the UI. If it isn't - // parcel media, do the normal "hasMedia()" check. If it is parcel media, - // hasMedia() seems to always be true, so we do some other checks to see - // if there actually is parcel media showing - if (!pimpl->getUsedInUI()) + if (!pimpl->getUsedInUI() && pimpl->hasMedia()) { - if (! pimpl->isParcelMedia()) - { - if (pimpl->hasMedia()) - { - sAnyMediaShowing = true; - } - } - else { - // Parcel media showing? - if (!LLViewerParcelMedia::getURL().empty() && LLViewerParcelMedia::getParcelMedia().notNull()) - { - sAnyMediaShowing = true; - } - } + sAnyMediaShowing = true; } } @@ -947,9 +930,84 @@ void LLViewerMedia::setAllMediaEnabled(bool val) for(; iter != end; iter++) { LLViewerMediaImpl* pimpl = *iter; - if (!pimpl->getUsedInUI()) + if (!pimpl->getUsedInUI()) + { pimpl->setDisabled(!val); + } + } + + // Also do Parcel Media and Parcel Audio + if (val) + { + if (!LLViewerMedia::isParcelMediaPlaying()) + { + LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); + } + + if (!LLViewerMedia::isParcelAudioPlaying() && gAudiop) + { + gAudiop->startInternetStream(LLViewerMedia::getParcelAudioURL()); + } } + else { + // This actually unloads the impl, as opposed to "stop"ping the media + LLViewerParcelMedia::stop(); + if (gAudiop) gAudiop->stopInternetStream(); + } +} + +////////////////////////////////////////////////////////////////////////////////////////// +// static +bool LLViewerMedia::isParcelMediaPlaying() +{ + return (LLViewerMedia::hasParcelMedia() && LLViewerParcelMedia::getParcelMedia() && LLViewerParcelMedia::getParcelMedia()->hasMedia()); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +bool LLViewerMedia::isParcelAudioPlaying() +{ + return (LLViewerMedia::hasParcelAudio() && gAudiop && LLAudioEngine::AUDIO_PLAYING == gAudiop->isInternetStreamPlaying()); +} + +bool LLViewerMedia::hasInWorldMedia() +{ + if (! gSavedSettings.getBOOL("AudioStreamingMedia")) return false; + if (sInWorldMediaDisabled) return false; + impl_list::iterator iter = sViewerMediaImplList.begin(); + impl_list::iterator end = sViewerMediaImplList.end(); + // This should be quick, because there should be very few non-in-world-media impls + for (; iter != end; iter++) + { + LLViewerMediaImpl* pimpl = *iter; + if (!pimpl->getUsedInUI() && !pimpl->isParcelMedia()) + { + // Found an in-world media impl + return true; + } + } + return false; +} + +////////////////////////////////////////////////////////////////////////////////////////// +// static +bool LLViewerMedia::hasParcelMedia() +{ + return !LLViewerParcelMedia::getURL().empty(); +} + +////////////////////////////////////////////////////////////////////////////////////////// +// static +bool LLViewerMedia::hasParcelAudio() +{ + return !LLViewerMedia::getParcelAudioURL().empty(); +} + +////////////////////////////////////////////////////////////////////////////////////////// +// static +std::string LLViewerMedia::getParcelAudioURL() +{ + return LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL(); } ////////////////////////////////////////////////////////////////////////////////////////// |