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.cpp92
1 files changed, 91 insertions, 1 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 78c4d98d55..ec06cc432f 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -167,6 +167,7 @@ static bool sForceUpdate = false;
static LLUUID sOnlyAudibleTextureID = LLUUID::null;
static F64 sLowestLoadableImplInterest = 0.0f;
static bool sAnyMediaShowing = false;
+static bool sAnyMediaPlaying = false;
static boost::signals2::connection sTeleportFinishConnection;
static std::string sUpdatedCookies;
static const char *PLUGIN_COOKIE_FILE_NAME = "plugin_cookies.txt";
@@ -606,6 +607,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
createSpareBrowserMediaSource();
sAnyMediaShowing = false;
+ sAnyMediaPlaying = false;
sUpdatedCookies = getCookieStore()->getChangedCookies();
if(!sUpdatedCookies.empty())
{
@@ -808,6 +810,11 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
sAnyMediaShowing = true;
}
+ if (!pimpl->getUsedInUI() && pimpl->hasMedia() && (!pimpl->isMediaPaused() || !pimpl->isMediaTimeBased()))
+ {
+ sAnyMediaPlaying = true;
+ }
+
}
}
@@ -858,6 +865,13 @@ bool LLViewerMedia::isAnyMediaShowing()
//////////////////////////////////////////////////////////////////////////////////////////
// static
+bool LLViewerMedia::isAnyMediaPlaying()
+{
+ return sAnyMediaPlaying;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// static
void LLViewerMedia::setAllMediaEnabled(bool val)
{
// Set "tentative" autoplay first. We need to do this here or else
@@ -913,6 +927,78 @@ void LLViewerMedia::setAllMediaEnabled(bool val)
//////////////////////////////////////////////////////////////////////////////////////////
// static
+void LLViewerMedia::setAllMediaPaused(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())
+ {
+ // upause/pause time based media, enable/disable any other
+ if (!val)
+ {
+ pimpl->setDisabled(val);
+ if (pimpl->isMediaTimeBased() && pimpl->isMediaPaused())
+ {
+ pimpl->play();
+ return;
+ }
+ }
+ else if (pimpl->isMediaTimeBased() && pimpl->mMediaSource)
+ {
+ pimpl->pause();
+ }
+ else
+ {
+ pimpl->setDisabled(val);
+ }
+ }
+ }
+
+ // Also do Parcel Media and Parcel Audio
+ if (!val)
+ {
+ if (!LLViewerMedia::isParcelMediaPlaying() && LLViewerMedia::hasParcelMedia())
+ {
+ LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel());
+ }
+
+ if (gSavedSettings.getBOOL("AudioStreamingMusic") &&
+ !LLViewerMedia::isParcelAudioPlaying() &&
+ gAudiop &&
+ LLViewerMedia::hasParcelAudio())
+ {
+ if (LLAudioEngine::AUDIO_PAUSED == gAudiop->isInternetStreamPlaying())
+ {
+ // 'false' means unpause
+ gAudiop->pauseInternetStream(false);
+ }
+ else
+ {
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getParcelAudioURL());
+ }
+ }
+ }
+ else {
+ // This actually unloads the impl, as opposed to "stop"ping the media
+ LLViewerParcelMedia::stop();
+ if (gAudiop)
+ {
+ LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// static
bool LLViewerMedia::isParcelMediaPlaying()
{
return (LLViewerMedia::hasParcelMedia() && LLViewerParcelMedia::getParcelMedia() && LLViewerParcelMedia::getParcelMedia()->hasMedia());
@@ -1820,7 +1906,9 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
}
else if(LLFile::stat(plugin_name, &s))
{
+#if !LL_LINUX
LL_WARNS_ONCE("Media") << "Couldn't find plugin at " << plugin_name << LL_ENDL;
+#endif
}
else
{
@@ -1862,8 +1950,10 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
}
}
}
-
+#if !LL_LINUX
LL_WARNS_ONCE("Plugin") << "plugin initialization failed for mime type: " << media_type << LL_ENDL;
+#endif
+
if(gAgent.isInitialized())
{
if (std::find(sMimeTypesFailed.begin(), sMimeTypesFailed.end(), media_type) == sMimeTypesFailed.end())