summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermedia.cpp')
-rw-r--r--indra/newview/llviewermedia.cpp50
1 files changed, 48 insertions, 2 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 3063341ade..c4f2f0eed7 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -261,6 +261,7 @@ static LLTimer sMediaCreateTimer;
static const F32 LLVIEWERMEDIA_CREATE_DELAY = 1.0f;
static F32 sGlobalVolume = 1.0f;
static F64 sLowestLoadableImplInterest = 0.0f;
+static bool sAnyMediaShowing = false;
//////////////////////////////////////////////////////////////////////////////////////////
static void add_media_impl(LLViewerMediaImpl* media)
@@ -694,6 +695,7 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi
// static
void LLViewerMedia::updateMedia(void *dummy_arg)
{
+ sAnyMediaShowing = false;
impl_list::iterator iter = sViewerMediaImplList.begin();
impl_list::iterator end = sViewerMediaImplList.end();
@@ -860,6 +862,25 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
}
total_cpu += pimpl->getCPUUsage();
+
+ if (!pimpl->getUsedInUI())
+ {
+ if (! pimpl->isParcelMedia())
+ {
+ if (pimpl->hasMedia())
+ {
+ sAnyMediaShowing = true;
+ }
+ }
+ else {
+ // Parcel media showing?
+ if (!LLViewerParcelMedia::getURL().empty() && LLViewerParcelMedia::getParcelMedia().notNull())
+ {
+ sAnyMediaShowing = true;
+ }
+ }
+ }
+
}
// Re-calculate this every time.
@@ -901,6 +922,33 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
//////////////////////////////////////////////////////////////////////////////////////////
// static
+bool LLViewerMedia::isAnyMediaShowing()
+{
+ return sAnyMediaShowing;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::setAllMediaEnabled(bool val)
+{
+ // Set "tentative" autoplay first. We need to do this here or else
+ // re-enabling won't start up the media below.
+ gSavedSettings.setBOOL("MediaTentativeAutoPlay", val);
+
+ // Then
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
+
+ for(; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+ if (!pimpl->getUsedInUI())
+ pimpl->setDisabled(!val);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// static
void LLViewerMedia::initClass()
{
gIdleCallbacks.addFunction(LLViewerMedia::updateMedia, NULL);
@@ -913,8 +961,6 @@ void LLViewerMedia::cleanupClass()
gIdleCallbacks.deleteFunction(LLViewerMedia::updateMedia, NULL);
}
- // XXX TODO: what to do about other AUTO_PLAY settings?
- // XXX TODO: what to do about other AUTO_PLAY settings?
//////////////////////////////////////////////////////////////////////////////////////////
// LLViewerMediaImpl
//////////////////////////////////////////////////////////////////////////////////////////