diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2019-11-12 02:37:15 +0200 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2019-11-12 02:37:15 +0200 |
commit | 5f731d84cb5823bdc4cae5be288f2de2ffb9f5f9 (patch) | |
tree | 04ddffec7d5a004150aefd5fdbf247863e2a8926 /indra/newview/llviewermedia.cpp | |
parent | 4aa9dfec746f28696a195fe81aed9b6ef0791954 (diff) | |
parent | e96d0d5e304324e6ab0c469773fb7110a65fc3f1 (diff) |
Downstream merge from 494-maint-wassail
Diffstat (limited to 'indra/newview/llviewermedia.cpp')
-rw-r--r-- | indra/newview/llviewermedia.cpp | 199 |
1 files changed, 88 insertions, 111 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 0fcc88556f..99b54f66d3 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -78,11 +78,6 @@ #include <boost/bind.hpp> // for SkinFolder listener #include <boost/signals2.hpp> -/*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 +186,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 +195,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 +220,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 +229,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 +389,6 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s } ////////////////////////////////////////////////////////////////////////////////////////// -// static LLViewerMediaImpl* LLViewerMedia::getMediaImplFromTextureID(const LLUUID& texture_id) { LLViewerMediaImpl* result = NULL; @@ -384,7 +404,6 @@ LLViewerMediaImpl* LLViewerMedia::getMediaImplFromTextureID(const LLUUID& textur } ////////////////////////////////////////////////////////////////////////////////////////// -// static std::string LLViewerMedia::getCurrentUserAgent() { // Don't use user-visible string to avoid @@ -411,7 +430,6 @@ std::string LLViewerMedia::getCurrentUserAgent() } ////////////////////////////////////////////////////////////////////////////////////////// -// static void LLViewerMedia::updateBrowserUserAgent() { std::string user_agent = getCurrentUserAgent(); @@ -431,7 +449,6 @@ void LLViewerMedia::updateBrowserUserAgent() } ////////////////////////////////////////////////////////////////////////////////////////// -// static bool LLViewerMedia::handleSkinCurrentChanged(const LLSD& /*newvalue*/) { // gSavedSettings is already updated when this function is called. @@ -440,7 +457,6 @@ bool LLViewerMedia::handleSkinCurrentChanged(const LLSD& /*newvalue*/) } ////////////////////////////////////////////////////////////////////////////////////////// -// static bool LLViewerMedia::textureHasMedia(const LLUUID& texture_id) { impl_list::iterator iter = sViewerMediaImplList.begin(); @@ -458,7 +474,6 @@ bool LLViewerMedia::textureHasMedia(const LLUUID& texture_id) } ////////////////////////////////////////////////////////////////////////////////////////// -// static void LLViewerMedia::setVolume(F32 volume) { if(volume != sGlobalVolume || sForceUpdate) @@ -478,14 +493,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 +513,6 @@ void LLViewerMedia::muteListChanged() } ////////////////////////////////////////////////////////////////////////////////////////// -// static bool LLViewerMedia::isInterestingEnough(const LLVOVolume *object, const F64 &object_interest) { bool result = false; @@ -535,6 +547,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 +642,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 +660,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 +677,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 +872,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 +917,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 +953,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 +975,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 +984,6 @@ void LLViewerMedia::setAllMediaEnabled(bool val) } ////////////////////////////////////////////////////////////////////////////////////////// -// static void LLViewerMedia::setAllMediaPaused(bool val) { // Set "tentative" autoplay first. We need to do this here or else @@ -1012,7 +1026,7 @@ void LLViewerMedia::setAllMediaPaused(bool val) { if (!LLViewerMedia::isParcelMediaPlaying() && LLViewerMedia::hasParcelMedia()) { - LLViewerParcelMedia::play(agent_parcel); + LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel()); } static LLCachedControl<bool> audio_streaming_music(gSavedSettings, "AudioStreamingMusic", true); @@ -1034,7 +1048,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(); @@ -1049,19 +1063,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"]); @@ -1083,7 +1103,6 @@ void LLViewerMedia::onAuthSubmit(const LLSD& notification, const LLSD& response) } ///////////////////////////////////////////////////////////////////////////////////////// -// static void LLViewerMedia::clearAllCookies() { // Clear all cookies for all plugins @@ -1100,7 +1119,6 @@ void LLViewerMedia::clearAllCookies() } ///////////////////////////////////////////////////////////////////////////////////////// -// static void LLViewerMedia::clearAllCaches() { // Clear all plugins' caches @@ -1114,7 +1132,6 @@ void LLViewerMedia::clearAllCaches() } ///////////////////////////////////////////////////////////////////////////////////////// -// static void LLViewerMedia::setCookiesEnabled(bool enabled) { // Set the "cookies enabled" flag for all loaded plugins @@ -1131,7 +1148,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 @@ -1148,10 +1164,6 @@ void LLViewerMedia::setProxyConfig(bool enable, const std::string &host, int por } ///////////////////////////////////////////////////////////////////////////////////////// -// static -///////////////////////////////////////////////////////////////////////////////////////// -//// static - LLSD LLViewerMedia::getHeaders() { LLSD headers = LLSD::emptyMap(); @@ -1159,14 +1171,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("="); @@ -1189,13 +1200,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; @@ -1203,10 +1215,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(""); @@ -1215,7 +1226,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); @@ -1237,7 +1248,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 @@ -1254,7 +1265,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"); @@ -1266,8 +1278,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. @@ -1276,7 +1288,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); } @@ -1289,11 +1301,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); @@ -1322,7 +1334,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; @@ -1331,7 +1342,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); @@ -1346,10 +1356,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"); @@ -1381,24 +1391,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()) @@ -1414,7 +1422,6 @@ void LLViewerMedia::proxyWindowOpened(const std::string &target, const std::stri } ///////////////////////////////////////////////////////////////////////////////////////// -// static void LLViewerMedia::proxyWindowClosed(const std::string &uuid) { if(uuid.empty()) @@ -1430,28 +1437,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; }; @@ -1473,50 +1478,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) @@ -1525,9 +1504,7 @@ void LLViewerMedia::onTeleportFinished() LLViewerMediaImpl::sMimeTypesFailed.clear(); } - ////////////////////////////////////////////////////////////////////////////////////////// -// static void LLViewerMedia::setOnlyAudibleMediaTextureID(const LLUUID& texture_id) { sOnlyAudibleTextureID = texture_id; @@ -1719,7 +1696,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); @@ -1795,7 +1772,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); @@ -1866,7 +1843,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); @@ -2099,7 +2076,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) { @@ -3373,7 +3350,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; |