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.cpp200
1 files changed, 88 insertions, 112 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index a27a083a2a..6cfc22a4e5 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -77,12 +77,6 @@
#include <boost/bind.hpp> // for SkinFolder listener
#include <boost/signals2.hpp>
-/*static*/ const char* LLViewerMedia::AUTO_PLAY_MEDIA_SETTING = "ParcelMediaAutoPlayEnable";
-/*static*/ const char* LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING = "MediaShowOnOthers";
-/*static*/ const char* LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING = "MediaShowWithinParcel";
-/*static*/ const char* LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING = "MediaShowOutsideParcel";
-
-
class LLMediaFilePicker : public LLFilePickerThread // deletes itself when done
{
public:
@@ -191,9 +185,6 @@ LLViewerMediaObserver::~LLViewerMediaObserver()
}
-LLURL LLViewerMedia::sOpenIDURL;
-std::string LLViewerMedia::sOpenIDCookie;
-LLPluginClassMedia* LLViewerMedia::sSpareBrowserMediaSource = NULL;
static LLViewerMedia::impl_list sViewerMediaImplList;
static LLViewerMedia::impl_id_map sViewerMediaTextureIDMap;
static LLTimer sMediaCreateTimer;
@@ -203,8 +194,6 @@ 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 void add_media_impl(LLViewerMediaImpl* media)
@@ -230,7 +219,7 @@ static void remove_media_impl(LLViewerMediaImpl* media)
class LLViewerMediaMuteListObserver : public LLMuteListObserver
{
- /* virtual */ void onChange() { LLViewerMedia::muteListChanged();}
+ /* virtual */ void onChange() { LLViewerMedia::getInstance()->muteListChanged();}
};
static LLViewerMediaMuteListObserver sViewerMediaMuteListObserver;
@@ -239,9 +228,40 @@ static bool sViewerMediaMuteListObserverInitialized = false;
//////////////////////////////////////////////////////////////////////////////////////////
// LLViewerMedia
-
//////////////////////////////////////////////////////////////////////////////////////////
+
+/*static*/ const char* LLViewerMedia::AUTO_PLAY_MEDIA_SETTING = "ParcelMediaAutoPlayEnable";
+/*static*/ const char* LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING = "MediaShowOnOthers";
+/*static*/ const char* LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING = "MediaShowWithinParcel";
+/*static*/ const char* LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING = "MediaShowOutsideParcel";
+
+LLViewerMedia::LLViewerMedia():
+mAnyMediaShowing(false),
+mAnyMediaPlaying(false),
+mSpareBrowserMediaSource(NULL)
+{
+}
+
+LLViewerMedia::~LLViewerMedia()
+{
+ gIdleCallbacks.deleteFunction(LLViewerMedia::onIdle, NULL);
+ mTeleportFinishConnection.disconnect();
+ if (mSpareBrowserMediaSource != NULL)
+ {
+ delete mSpareBrowserMediaSource;
+ mSpareBrowserMediaSource = NULL;
+ }
+}
+
// static
+void LLViewerMedia::initSingleton()
+{
+ gIdleCallbacks.addFunction(LLViewerMedia::onIdle, NULL);
+ mTeleportFinishConnection = LLViewerParcelMgr::getInstance()->
+ setTeleportFinishedCallback(boost::bind(&LLViewerMedia::onTeleportFinished, this));
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
viewer_media_t LLViewerMedia::newMediaImpl(
const LLUUID& texture_id,
S32 media_width,
@@ -368,7 +388,6 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
LLViewerMediaImpl* LLViewerMedia::getMediaImplFromTextureID(const LLUUID& texture_id)
{
LLViewerMediaImpl* result = NULL;
@@ -384,7 +403,6 @@ LLViewerMediaImpl* LLViewerMedia::getMediaImplFromTextureID(const LLUUID& textur
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
std::string LLViewerMedia::getCurrentUserAgent()
{
// Don't use user-visible string to avoid
@@ -411,7 +429,6 @@ std::string LLViewerMedia::getCurrentUserAgent()
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::updateBrowserUserAgent()
{
std::string user_agent = getCurrentUserAgent();
@@ -431,7 +448,6 @@ void LLViewerMedia::updateBrowserUserAgent()
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
bool LLViewerMedia::handleSkinCurrentChanged(const LLSD& /*newvalue*/)
{
// gSavedSettings is already updated when this function is called.
@@ -440,7 +456,6 @@ bool LLViewerMedia::handleSkinCurrentChanged(const LLSD& /*newvalue*/)
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
bool LLViewerMedia::textureHasMedia(const LLUUID& texture_id)
{
impl_list::iterator iter = sViewerMediaImplList.begin();
@@ -458,7 +473,6 @@ bool LLViewerMedia::textureHasMedia(const LLUUID& texture_id)
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::setVolume(F32 volume)
{
if(volume != sGlobalVolume || sForceUpdate)
@@ -478,14 +492,12 @@ void LLViewerMedia::setVolume(F32 volume)
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
F32 LLViewerMedia::getVolume()
{
return sGlobalVolume;
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::muteListChanged()
{
// When the mute list changes, we need to check mute status on all impls.
@@ -500,7 +512,6 @@ void LLViewerMedia::muteListChanged()
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
bool LLViewerMedia::isInterestingEnough(const LLVOVolume *object, const F64 &object_interest)
{
bool result = false;
@@ -535,6 +546,7 @@ LLViewerMedia::impl_list &LLViewerMedia::getPriorityList()
return sViewerMediaImplList;
}
+// static
// This is the predicate function used to sort sViewerMediaImplList by priority.
bool LLViewerMedia::priorityComparitor(const LLViewerMediaImpl* i1, const LLViewerMediaImpl* i2)
{
@@ -629,7 +641,12 @@ static LLTrace::BlockTimerStatHandle FTM_MEDIA_MISC("Misc");
//////////////////////////////////////////////////////////////////////////////////////////
-// static
+void LLViewerMedia::onIdle(void *dummy_arg)
+{
+ LLViewerMedia::getInstance()->updateMedia(dummy_arg);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMedia::updateMedia(void *dummy_arg)
{
LL_RECORD_BLOCK_TIME(FTM_MEDIA_UPDATE);
@@ -642,8 +659,8 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
// removing it for now.
//createSpareBrowserMediaSource();
- sAnyMediaShowing = false;
- sAnyMediaPlaying = false;
+ mAnyMediaShowing = false;
+ mAnyMediaPlaying = false;
impl_list::iterator iter = sViewerMediaImplList.begin();
impl_list::iterator end = sViewerMediaImplList.end();
@@ -659,10 +676,10 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
}
// Let the spare media source actually launch
- if(sSpareBrowserMediaSource)
+ if(mSpareBrowserMediaSource)
{
LL_RECORD_BLOCK_TIME(FTM_MEDIA_SPARE_IDLE);
- sSpareBrowserMediaSource->idle();
+ mSpareBrowserMediaSource->idle();
}
{
@@ -854,7 +871,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
if (!pimpl->getUsedInUI() && pimpl->hasMedia() && (pimpl->isMediaPlaying() || !pimpl->isMediaTimeBased()))
{
// consider visible non-timebased media as playing
- sAnyMediaPlaying = true;
+ mAnyMediaPlaying = true;
}
}
@@ -899,21 +916,18 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
bool LLViewerMedia::isAnyMediaShowing()
{
- return sAnyMediaShowing;
+ return mAnyMediaShowing;
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
bool LLViewerMedia::isAnyMediaPlaying()
{
- return sAnyMediaPlaying;
+ return mAnyMediaPlaying;
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::setAllMediaEnabled(bool val)
{
// Set "tentative" autoplay first. We need to do this here or else
@@ -938,7 +952,7 @@ void LLViewerMedia::setAllMediaEnabled(bool val)
{
if (!LLViewerMedia::isParcelMediaPlaying() && LLViewerMedia::hasParcelMedia())
{
- LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel());
+ LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel());
}
static LLCachedControl<bool> audio_streaming_music(gSavedSettings, "AudioStreamingMusic", true);
@@ -960,7 +974,7 @@ void LLViewerMedia::setAllMediaEnabled(bool val)
}
else {
// This actually unloads the impl, as opposed to "stop"ping the media
- LLViewerParcelMedia::stop();
+ LLViewerParcelMedia::getInstance()->stop();
if (gAudiop)
{
LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
@@ -969,7 +983,6 @@ void LLViewerMedia::setAllMediaEnabled(bool val)
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::setAllMediaPaused(bool val)
{
// Set "tentative" autoplay first. We need to do this here or else
@@ -1010,7 +1023,7 @@ void LLViewerMedia::setAllMediaPaused(bool val)
{
if (!LLViewerMedia::isParcelMediaPlaying() && LLViewerMedia::hasParcelMedia())
{
- LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel());
+ LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel());
}
static LLCachedControl<bool> audio_streaming_music(gSavedSettings, "AudioStreamingMusic", true);
@@ -1032,7 +1045,7 @@ void LLViewerMedia::setAllMediaPaused(bool val)
}
else {
// This actually unloads the impl, as opposed to "stop"ping the media
- LLViewerParcelMedia::stop();
+ LLViewerParcelMedia::getInstance()->stop();
if (gAudiop)
{
LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
@@ -1041,19 +1054,25 @@ void LLViewerMedia::setAllMediaPaused(bool val)
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
bool LLViewerMedia::isParcelMediaPlaying()
{
- return (LLViewerMedia::hasParcelMedia() && LLViewerParcelMedia::getParcelMedia() && LLViewerParcelMedia::getParcelMedia()->hasMedia());
+ viewer_media_t media = LLViewerParcelMedia::getInstance()->getParcelMedia();
+ return (LLViewerMedia::hasParcelMedia() && media && media->hasMedia());
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
bool LLViewerMedia::isParcelAudioPlaying()
{
return (LLViewerMedia::hasParcelAudio() && gAudiop && LLAudioEngine::AUDIO_PLAYING == gAudiop->isInternetStreamPlaying());
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::authSubmitCallback(const LLSD& notification, const LLSD& response)
+{
+ LLViewerMedia::getInstance()->onAuthSubmit(notification, response);
+}
+
void LLViewerMedia::onAuthSubmit(const LLSD& notification, const LLSD& response)
{
LLViewerMediaImpl *impl = LLViewerMedia::getMediaImplFromTextureID(notification["payload"]["media_id"]);
@@ -1075,7 +1094,6 @@ void LLViewerMedia::onAuthSubmit(const LLSD& notification, const LLSD& response)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::clearAllCookies()
{
// Clear all cookies for all plugins
@@ -1092,7 +1110,6 @@ void LLViewerMedia::clearAllCookies()
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::clearAllCaches()
{
// Clear all plugins' caches
@@ -1106,7 +1123,6 @@ void LLViewerMedia::clearAllCaches()
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::setCookiesEnabled(bool enabled)
{
// Set the "cookies enabled" flag for all loaded plugins
@@ -1123,7 +1139,6 @@ void LLViewerMedia::setCookiesEnabled(bool enabled)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::setProxyConfig(bool enable, const std::string &host, int port)
{
// Set the proxy config for all loaded plugins
@@ -1140,10 +1155,6 @@ void LLViewerMedia::setProxyConfig(bool enable, const std::string &host, int por
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
-/////////////////////////////////////////////////////////////////////////////////////////
-//// static
-
LLSD LLViewerMedia::getHeaders()
{
LLSD headers = LLSD::emptyMap();
@@ -1151,14 +1162,13 @@ LLSD LLViewerMedia::getHeaders()
// *TODO: Should this be 'application/llsd+xml' ?
// *TODO: Should this even be set at all? This header is only not overridden in 'GET' methods.
headers[HTTP_OUT_HEADER_CONTENT_TYPE] = HTTP_CONTENT_XML;
- headers[HTTP_OUT_HEADER_COOKIE] = sOpenIDCookie;
+ headers[HTTP_OUT_HEADER_COOKIE] = mOpenIDCookie;
headers[HTTP_OUT_HEADER_USER_AGENT] = getCurrentUserAgent();
return headers;
}
/////////////////////////////////////////////////////////////////////////////////////////
- // static
bool LLViewerMedia::parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path, bool& httponly, bool& secure)
{
std::size_t name_pos = raw_cookie.find_first_of("=");
@@ -1181,13 +1191,14 @@ bool LLViewerMedia::parseRawCookie(const std::string raw_cookie, std::string& na
return false;
}
+/////////////////////////////////////////////////////////////////////////////////////////
LLCore::HttpHeaders::ptr_t LLViewerMedia::getHttpHeaders()
{
LLCore::HttpHeaders::ptr_t headers(new LLCore::HttpHeaders);
headers->append(HTTP_OUT_HEADER_ACCEPT, "*/*");
headers->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_XML);
- headers->append(HTTP_OUT_HEADER_COOKIE, sOpenIDCookie);
+ headers->append(HTTP_OUT_HEADER_COOKIE, mOpenIDCookie);
headers->append(HTTP_OUT_HEADER_USER_AGENT, getCurrentUserAgent());
return headers;
@@ -1195,10 +1206,9 @@ LLCore::HttpHeaders::ptr_t LLViewerMedia::getHttpHeaders()
/////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::setOpenIDCookie(const std::string& url)
{
- if(!sOpenIDCookie.empty())
+ if(!mOpenIDCookie.empty())
{
std::string profileUrl = getProfileURL("");
@@ -1207,7 +1217,7 @@ void LLViewerMedia::setOpenIDCookie(const std::string& url)
}
}
-/*static*/
+//static
void LLViewerMedia::getOpenIDCookieCoro(std::string url)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
@@ -1229,7 +1239,7 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
// The LLURL can give me the 'authority', which is of the form: [username[:password]@]hostname[:port]
// We want just the hostname for the cookie code, but LLURL doesn't seem to have a way to extract that.
// We therefore do it here.
- std::string authority = sOpenIDURL.mAuthority;
+ std::string authority = getInstance()->mOpenIDURL.mAuthority;
std::string::size_type hostStart = authority.find('@');
if (hostStart == std::string::npos)
{ // no username/password
@@ -1246,7 +1256,8 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
{ // no port
hostEnd = authority.size();
}
-
+
+ LLViewerMedia* inst = getInstance();
if (url.length())
{
LLMediaCtrl* media_instance = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
@@ -1258,8 +1269,8 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
std::string cookie_path = "";
bool httponly = true;
bool secure = true;
- if (parseRawCookie(sOpenIDCookie, cookie_name, cookie_value, cookie_path, httponly, secure) &&
- media_instance->getMediaPlugin())
+ if (inst->parseRawCookie(inst->mOpenIDCookie, cookie_name, cookie_value, cookie_path, httponly, secure) &&
+ media_instance->getMediaPlugin())
{
// MAINT-5711 - inexplicably, the CEF setCookie function will no longer set the cookie if the
// url and domain are not the same. This used to be my.sl.com and id.sl.com respectively and worked.
@@ -1268,7 +1279,7 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
// (Feels like there must be a less dirty way to construct a URL from component LLURL parts)
// MAINT-6392 - Rider: Do not change, however, the original URI requested, since it is used further
// down.
- std::string cefUrl(std::string(sOpenIDURL.mURI) + "://" + std::string(sOpenIDURL.mAuthority));
+ std::string cefUrl(std::string(inst->mOpenIDURL.mURI) + "://" + std::string(inst->mOpenIDURL.mAuthority));
media_instance->getMediaPlugin()->setCookie(cefUrl, cookie_name, cookie_value, cookie_host, cookie_path, httponly, secure);
}
@@ -1281,11 +1292,11 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
// Do a web profile get so we can store the cookie
httpHeaders->append(HTTP_OUT_HEADER_ACCEPT, "*/*");
- httpHeaders->append(HTTP_OUT_HEADER_COOKIE, sOpenIDCookie);
- httpHeaders->append(HTTP_OUT_HEADER_USER_AGENT, getCurrentUserAgent());
+ httpHeaders->append(HTTP_OUT_HEADER_COOKIE, inst->mOpenIDCookie);
+ httpHeaders->append(HTTP_OUT_HEADER_USER_AGENT, inst->getCurrentUserAgent());
LL_DEBUGS("MediaAuth") << "Requesting " << url << LL_ENDL;
- LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << LL_ENDL;
+ LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << inst->mOpenIDCookie << "]" << LL_ENDL;
LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts, httpHeaders);
@@ -1314,7 +1325,6 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::openIDSetup(const std::string &openidUrl, const std::string &openidToken)
{
LL_DEBUGS("MediaAuth") << "url = \"" << openidUrl << "\", token = \"" << openidToken << "\"" << LL_ENDL;
@@ -1323,7 +1333,6 @@ void LLViewerMedia::openIDSetup(const std::string &openidUrl, const std::string
boost::bind(&LLViewerMedia::openIDSetupCoro, openidUrl, openidToken));
}
-/*static*/
void LLViewerMedia::openIDSetupCoro(std::string openidUrl, std::string openidToken)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
@@ -1338,10 +1347,10 @@ void LLViewerMedia::openIDSetupCoro(std::string openidUrl, std::string openidTok
// post the token to the url
// the responder will need to extract the cookie(s).
// Save the OpenID URL for later -- we may need the host when adding the cookie.
- sOpenIDURL.init(openidUrl.c_str());
+ getInstance()->mOpenIDURL.init(openidUrl.c_str());
// We shouldn't ever do this twice, but just in case this code gets repurposed later, clear existing cookies.
- sOpenIDCookie.clear();
+ getInstance()->mOpenIDCookie.clear();
httpHeaders->append(HTTP_OUT_HEADER_ACCEPT, "*/*");
httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, "application/x-www-form-urlencoded");
@@ -1373,24 +1382,22 @@ void LLViewerMedia::openIDSetupCoro(std::string openidUrl, std::string openidTok
const std::string& cookie = resultHeaders[HTTP_IN_HEADER_SET_COOKIE].asString();
// *TODO: What about bad status codes? Does this destroy previous cookies?
- LLViewerMedia::openIDCookieResponse(openidUrl, cookie);
+ LLViewerMedia::getInstance()->openIDCookieResponse(openidUrl, cookie);
LL_DEBUGS("MediaAuth") << "OpenID cookie set." << LL_ENDL;
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::openIDCookieResponse(const std::string& url, const std::string &cookie)
{
LL_DEBUGS("MediaAuth") << "Cookie received: \"" << cookie << "\"" << LL_ENDL;
- sOpenIDCookie += cookie;
+ mOpenIDCookie += cookie;
setOpenIDCookie(url);
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::proxyWindowOpened(const std::string &target, const std::string &uuid)
{
if(uuid.empty())
@@ -1406,7 +1413,6 @@ void LLViewerMedia::proxyWindowOpened(const std::string &target, const std::stri
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::proxyWindowClosed(const std::string &uuid)
{
if(uuid.empty())
@@ -1422,28 +1428,26 @@ void LLViewerMedia::proxyWindowClosed(const std::string &uuid)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::createSpareBrowserMediaSource()
{
// If we don't have a spare browser media source, create one.
// However, if PluginAttachDebuggerToPlugins is set then don't spawn a spare
// SLPlugin process in order to not be confused by an unrelated gdb terminal
// popping up at the moment we start a media plugin.
- if (!sSpareBrowserMediaSource && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins"))
+ if (!mSpareBrowserMediaSource && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins"))
{
// The null owner will keep the browser plugin from fully initializing
// (specifically, it keeps LLPluginClassMedia from negotiating a size change,
// which keeps MediaPluginWebkit::initBrowserWindow from doing anything until we have some necessary data, like the background color)
- sSpareBrowserMediaSource = LLViewerMediaImpl::newSourceFromMediaType(HTTP_CONTENT_TEXT_HTML, NULL, 0, 0, 1.0);
+ mSpareBrowserMediaSource = LLViewerMediaImpl::newSourceFromMediaType(HTTP_CONTENT_TEXT_HTML, NULL, 0, 0, 1.0);
}
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
LLPluginClassMedia* LLViewerMedia::getSpareBrowserMediaSource()
{
- LLPluginClassMedia* result = sSpareBrowserMediaSource;
- sSpareBrowserMediaSource = NULL;
+ LLPluginClassMedia* result = mSpareBrowserMediaSource;
+ mSpareBrowserMediaSource = NULL;
return result;
};
@@ -1465,50 +1469,24 @@ bool LLViewerMedia::hasInWorldMedia()
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
bool LLViewerMedia::hasParcelMedia()
{
- return !LLViewerParcelMedia::getURL().empty();
+ return !LLViewerParcelMedia::getInstance()->getURL().empty();
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
bool LLViewerMedia::hasParcelAudio()
{
return !LLViewerMedia::getParcelAudioURL().empty();
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
std::string LLViewerMedia::getParcelAudioURL()
{
return LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL();
}
//////////////////////////////////////////////////////////////////////////////////////////
-// static
-void LLViewerMedia::initClass()
-{
- gIdleCallbacks.addFunction(LLViewerMedia::updateMedia, NULL);
- sTeleportFinishConnection = LLViewerParcelMgr::getInstance()->
- setTeleportFinishedCallback(boost::bind(&LLViewerMedia::onTeleportFinished));
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// static
-void LLViewerMedia::cleanupClass()
-{
- gIdleCallbacks.deleteFunction(LLViewerMedia::updateMedia, NULL);
- sTeleportFinishConnection.disconnect();
- if (sSpareBrowserMediaSource != NULL)
- {
- delete sSpareBrowserMediaSource;
- sSpareBrowserMediaSource = NULL;
- }
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::onTeleportFinished()
{
// On teleport, clear this setting (i.e. set it to true)
@@ -1517,9 +1495,7 @@ void LLViewerMedia::onTeleportFinished()
LLViewerMediaImpl::sMimeTypesFailed.clear();
}
-
//////////////////////////////////////////////////////////////////////////////////////////
-// static
void LLViewerMedia::setOnlyAudibleMediaTextureID(const LLUUID& texture_id)
{
sOnlyAudibleTextureID = texture_id;
@@ -1711,7 +1687,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
if ((plugin_basename == "media_plugin_cef") &&
!gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins") && !clean_browser)
{
- media_source = LLViewerMedia::getSpareBrowserMediaSource();
+ media_source = LLViewerMedia::getInstance()->getSpareBrowserMediaSource();
if(media_source)
{
media_source->setOwner(owner);
@@ -1787,7 +1763,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled || clean_browser);
// need to set agent string here before instance created
- media_source->setBrowserUserAgent(LLViewerMedia::getCurrentUserAgent());
+ media_source->setBrowserUserAgent(LLViewerMedia::getInstance()->getCurrentUserAgent());
media_source->setTarget(target);
@@ -1858,7 +1834,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
media_source->setDisableTimeout(gSavedSettings.getBOOL("DebugPluginDisableTimeout"));
media_source->setLoop(mMediaLoop);
media_source->setAutoScale(mMediaAutoScale);
- media_source->setBrowserUserAgent(LLViewerMedia::getCurrentUserAgent());
+ media_source->setBrowserUserAgent(LLViewerMedia::getInstance()->getCurrentUserAgent());
media_source->focus(mHasFocus);
media_source->setBackgroundColor(mBackgroundColor);
@@ -2091,7 +2067,7 @@ void LLViewerMediaImpl::updateVolume()
if(mMediaSource)
{
// always scale the volume by the global media volume
- F32 volume = mRequestedVolume * LLViewerMedia::getVolume();
+ F32 volume = mRequestedVolume * LLViewerMedia::getInstance()->getVolume();
if (mProximityCamera > 0)
{
@@ -3365,7 +3341,7 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
auth_request_params.substitutions = args;
auth_request_params.payload = LLSD().with("media_id", mTextureId);
- auth_request_params.functor.function = boost::bind(&LLViewerMedia::onAuthSubmit, _1, _2);
+ auth_request_params.functor.function = boost::bind(&LLViewerMedia::authSubmitCallback, _1, _2);
LLNotifications::instance().add(auth_request_params);
};
break;