diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-06-21 21:31:40 +0300 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-06-21 21:31:40 +0300 |
commit | 30cc3ff01f39952b6138fad4095ea032d4b832a4 (patch) | |
tree | 28442fb641cb11bf0576aa23c750d74bf413a254 /indra/newview | |
parent | 8369276a4967185985cb5957b22cda6897e2df29 (diff) |
DRTVWR-493 LLViewerParcelMedia to singleton
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llpanelnearbymedia.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 3 | ||||
-rw-r--r-- | indra/newview/lltoolpie.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llviewermedia.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llviewerparcelmedia.cpp | 112 | ||||
-rw-r--r-- | indra/newview/llviewerparcelmedia.h | 87 | ||||
-rw-r--r-- | indra/newview/llviewerparcelmediaautoplay.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewerparcelmgr.cpp | 2 |
9 files changed, 131 insertions, 129 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index dd79ad5280..a574588b1a 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2042,7 +2042,6 @@ bool LLAppViewer::cleanup() //Note: //SUBSYSTEM_CLEANUP(LLViewerMedia) has to be put before gTextureList.shutdown() //because some new image might be generated during cleaning up media. --bao - SUBSYSTEM_CLEANUP(LLViewerParcelMedia); gTextureList.shutdown(); // shutdown again in case a callback added something LLUIImageList::getInstance()->cleanUp(); diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index a85e9e3882..2dca55514d 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -567,7 +567,7 @@ void LLPanelNearByMedia::refreshParcelItems() if (NULL != mParcelMediaItem) { std::string name, url, tooltip; - getNameAndUrlHelper(LLViewerParcelMedia::getParcelMedia(), name, url, ""); + getNameAndUrlHelper(LLViewerParcelMedia::getInstance()->getParcelMedia(), name, url, ""); if (name.empty() || name == url) { tooltip = url; @@ -576,13 +576,13 @@ void LLPanelNearByMedia::refreshParcelItems() { tooltip = name + " : " + url; } - LLViewerMediaImpl *impl = LLViewerParcelMedia::getParcelMedia(); + LLViewerMediaImpl *impl = LLViewerParcelMedia::getInstance()->getParcelMedia(); updateListItem(mParcelMediaItem, mParcelMediaName, tooltip, -2, // Proximity closer than anything else, before Parcel Audio impl == NULL || impl->isMediaDisabled(), - impl != NULL && !LLViewerParcelMedia::getURL().empty(), + impl != NULL && !LLViewerParcelMedia::getInstance()->getURL().empty(), impl != NULL && impl->isMediaTimeBased() && impl->isMediaPlaying(), MEDIA_CLASS_ALL, "parcel media"); @@ -790,14 +790,14 @@ void LLPanelNearByMedia::onClickEnableParcelMedia() { if ( ! LLViewerMedia::getInstance()->isParcelMediaPlaying() ) { - LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); + LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel()); } } void LLPanelNearByMedia::onClickDisableParcelMedia() { // This actually unloads the impl, as opposed to "stop"ping the media - LLViewerParcelMedia::stop(); + LLViewerParcelMedia::getInstance()->stop(); } void LLPanelNearByMedia::onCheckItem(LLUICtrl* ctrl, const LLUUID &row_id) @@ -855,22 +855,22 @@ void LLPanelNearByMedia::onZoomMedia(void* user_data) void LLPanelNearByMedia::onClickParcelMediaPlay() { - LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); + LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel()); } void LLPanelNearByMedia::onClickParcelMediaStop() { - if (LLViewerParcelMedia::getParcelMedia()) + if (LLViewerParcelMedia::getInstance()->getParcelMedia()) { // This stops the media playing, as opposed to unloading it like // LLViewerParcelMedia::stop() does - LLViewerParcelMedia::getParcelMedia()->stop(); + LLViewerParcelMedia::getInstance()->getParcelMedia()->stop(); } } void LLPanelNearByMedia::onClickParcelMediaPause() { - LLViewerParcelMedia::pause(); + LLViewerParcelMedia::getInstance()->pause(); } void LLPanelNearByMedia::onClickParcelAudioPlay() @@ -1008,7 +1008,7 @@ void LLPanelNearByMedia::updateControls() showDisabledControls(); } else { - LLViewerMediaImpl* impl = LLViewerParcelMedia::getParcelMedia(); + LLViewerMediaImpl* impl = LLViewerParcelMedia::getInstance()->getParcelMedia(); if (NULL == impl) { // Just means it hasn't started yet @@ -1119,7 +1119,7 @@ void LLPanelNearByMedia::onClickSelectedMediaPlay() if (selected_media_id != PARCEL_AUDIO_LIST_ITEM_UUID) { LLViewerMediaImpl *impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? - ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); + ((LLViewerMediaImpl*)LLViewerParcelMedia::getInstance()->getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); if (NULL != impl) { if (impl->isMediaTimeBased() && impl->isMediaPaused()) @@ -1130,7 +1130,7 @@ void LLPanelNearByMedia::onClickSelectedMediaPlay() } else if (impl->isParcelMedia()) { - LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); + LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel()); } } } @@ -1165,7 +1165,7 @@ void LLPanelNearByMedia::onClickSelectedMediaMute() } else { LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? - ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); + ((LLViewerMediaImpl*)LLViewerParcelMedia::getInstance()->getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); if (NULL != impl) { F32 volume = impl->getVolume(); @@ -1196,7 +1196,7 @@ void LLPanelNearByMedia::onCommitSelectedMediaVolume() } else { LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? - ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); + ((LLViewerMediaImpl*)LLViewerParcelMedia::getInstance()->getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); if (NULL != impl) { impl->setVolume(mVolumeSlider->getValueF32()); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index d3be7c64f8..8be453ad6c 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2806,9 +2806,6 @@ void LLStartUp::multimediaInit() std::string msg = LLTrans::getString("LoginInitializingMultimedia"); set_startup_status(0.42f, msg.c_str(), gAgent.mMOTD.c_str()); display_startup(); - - // LLViewerMedia::initClass(); - LLViewerParcelMedia::initClass(); } void LLStartUp::fontInit() diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 82111cb78a..63e84ccbbd 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -1457,19 +1457,19 @@ static void handle_click_action_play() LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!parcel) return; - LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getStatus(); + LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getInstance()->getStatus(); switch(status) { case LLViewerMediaImpl::MEDIA_PLAYING: - LLViewerParcelMedia::pause(); + LLViewerParcelMedia::getInstance()->pause(); break; case LLViewerMediaImpl::MEDIA_PAUSED: - LLViewerParcelMedia::start(); + LLViewerParcelMedia::getInstance()->start(); break; default: - LLViewerParcelMedia::play(parcel); + LLViewerParcelMedia::getInstance()->play(parcel); break; } } @@ -1706,7 +1706,7 @@ static ECursorType cursor_from_parcel_media(U8 click_action) open_cursor = UI_CURSOR_TOOLMEDIAOPEN; - LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getStatus(); + LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getInstance()->getStatus(); switch(status) { case LLViewerMediaImpl::MEDIA_PLAYING: diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 1e218eef12..857799889b 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -952,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); @@ -974,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(); @@ -1023,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); @@ -1045,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(); @@ -1056,7 +1056,8 @@ void LLViewerMedia::setAllMediaPaused(bool val) ////////////////////////////////////////////////////////////////////////////////////////// bool LLViewerMedia::isParcelMediaPlaying() { - return (LLViewerMedia::hasParcelMedia() && LLViewerParcelMedia::getParcelMedia() && LLViewerParcelMedia::getParcelMedia()->hasMedia()); + viewer_media_t media = LLViewerParcelMedia::getInstance()->getParcelMedia(); + return (LLViewerMedia::hasParcelMedia() && media && media->hasMedia()); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1470,7 +1471,7 @@ bool LLViewerMedia::hasInWorldMedia() ////////////////////////////////////////////////////////////////////////////////////////// bool LLViewerMedia::hasParcelMedia() { - return !LLViewerParcelMedia::getURL().empty(); + return !LLViewerParcelMedia::getInstance()->getURL().empty(); } ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index cbc276b7e2..30291d1a93 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -45,31 +45,23 @@ #include "llviewertexture.h" #include "llcorehttputil.h" -// Static Variables -S32 LLViewerParcelMedia::sMediaParcelLocalID = 0; -LLUUID LLViewerParcelMedia::sMediaRegionID; -viewer_media_t LLViewerParcelMedia::sMediaImpl; - - -// static -void LLViewerParcelMedia::initClass() +LLViewerParcelMedia::LLViewerParcelMedia(): +mMediaParcelLocalID(0) { LLMessageSystem* msg = gMessageSystem; - msg->setHandlerFunc("ParcelMediaCommandMessage", processParcelMediaCommandMessage ); - msg->setHandlerFunc("ParcelMediaUpdate", processParcelMediaUpdate ); + msg->setHandlerFunc("ParcelMediaCommandMessage", parcelMediaCommandMessageHandler ); + msg->setHandlerFunc("ParcelMediaUpdate", parcelMediaUpdateHandler ); LLViewerParcelMediaAutoPlay::initClass(); } -//static -void LLViewerParcelMedia::cleanupClass() +LLViewerParcelMedia::~LLViewerParcelMedia() { // This needs to be destroyed before global destructor time. - sMediaImpl = NULL; + mMediaImpl = NULL; } ////////////////////////////////////////////////////////////////////////////////////////// -// static void LLViewerParcelMedia::update(LLParcel* parcel) { if (/*LLViewerMedia::hasMedia()*/ true) @@ -79,7 +71,7 @@ void LLViewerParcelMedia::update(LLParcel* parcel) { if(!gAgent.getRegion()) { - sMediaRegionID = LLUUID() ; + mMediaRegionID = LLUUID() ; stop() ; LL_DEBUGS("Media") << "no agent region, bailing out." << LL_ENDL; return ; @@ -89,11 +81,11 @@ void LLViewerParcelMedia::update(LLParcel* parcel) S32 parcelid = parcel->getLocalID(); LLUUID regionid = gAgent.getRegion()->getRegionID(); - if (parcelid != sMediaParcelLocalID || regionid != sMediaRegionID) + if (parcelid != mMediaParcelLocalID || regionid != mMediaRegionID) { LL_DEBUGS("Media") << "New parcel, parcel id = " << parcelid << ", region id = " << regionid << LL_ENDL; - sMediaParcelLocalID = parcelid; - sMediaRegionID = regionid; + mMediaParcelLocalID = parcelid; + mMediaRegionID = regionid; } std::string mediaUrl = std::string ( parcel->getMediaURL () ); @@ -108,19 +100,19 @@ void LLViewerParcelMedia::update(LLParcel* parcel) LLStringUtil::trim(mediaUrl); // If no parcel media is playing, nothing left to do - if(sMediaImpl.isNull()) + if(mMediaImpl.isNull()) { return; } // Media is playing...has something changed? - else if (( sMediaImpl->getMediaURL() != mediaUrl ) - || ( sMediaImpl->getMediaTextureID() != parcel->getMediaID() ) - || ( sMediaImpl->getMimeType() != parcel->getMediaType() )) + else if (( mMediaImpl->getMediaURL() != mediaUrl ) + || ( mMediaImpl->getMediaTextureID() != parcel->getMediaID() ) + || ( mMediaImpl->getMimeType() != parcel->getMediaType() )) { // Only play if the media types are the same. - if(sMediaImpl->getMimeType() == parcel->getMediaType()) + if(mMediaImpl->getMimeType() == parcel->getMediaType()) { play(parcel); } @@ -176,30 +168,30 @@ void LLViewerParcelMedia::play(LLParcel* parcel) S32 media_width = parcel->getMediaWidth(); S32 media_height = parcel->getMediaHeight(); - if(sMediaImpl) + if(mMediaImpl) { // If the url and mime type are the same, call play again - if(sMediaImpl->getMediaURL() == media_url - && sMediaImpl->getMimeType() == mime_type - && sMediaImpl->getMediaTextureID() == placeholder_texture_id) + if(mMediaImpl->getMediaURL() == media_url + && mMediaImpl->getMimeType() == mime_type + && mMediaImpl->getMediaTextureID() == placeholder_texture_id) { LL_DEBUGS("Media") << "playing with existing url " << media_url << LL_ENDL; - sMediaImpl->play(); + mMediaImpl->play(); } // Else if the texture id's are the same, navigate and rediscover type // MBW -- This causes other state from the previous parcel (texture size, autoscale, and looping) to get re-used incorrectly. // It's also not really necessary -- just creating a new instance is fine. -// else if(sMediaImpl->getMediaTextureID() == placeholder_texture_id) +// else if(mMediaImpl->getMediaTextureID() == placeholder_texture_id) // { -// sMediaImpl->navigateTo(media_url, mime_type, true); +// mMediaImpl->navigateTo(media_url, mime_type, true); // } else { // Since the texture id is different, we need to generate a new impl // Delete the old one first so they don't fight over the texture. - sMediaImpl = NULL; + mMediaImpl = NULL; // A new impl will be created below. } @@ -208,19 +200,19 @@ void LLViewerParcelMedia::play(LLParcel* parcel) // Don't ever try to play if the media type is set to "none/none" if(stricmp(mime_type.c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0) { - if(!sMediaImpl) + if(!mMediaImpl) { LL_DEBUGS("Media") << "new media impl with mime type " << mime_type << ", url " << media_url << LL_ENDL; // There is no media impl, make a new one - sMediaImpl = LLViewerMedia::getInstance()->newMediaImpl( + mMediaImpl = LLViewerMedia::getInstance()->newMediaImpl( placeholder_texture_id, media_width, media_height, media_auto_scale, media_loop); - sMediaImpl->setIsParcelMedia(true); - sMediaImpl->navigateTo(media_url, mime_type, true); + mMediaImpl->setIsParcelMedia(true); + mMediaImpl->navigateTo(media_url, mime_type, true); } //LLFirstUse::useMedia(); @@ -232,7 +224,7 @@ void LLViewerParcelMedia::play(LLParcel* parcel) // static void LLViewerParcelMedia::stop() { - if(sMediaImpl.isNull()) + if(mMediaImpl.isNull()) { return; } @@ -241,27 +233,27 @@ void LLViewerParcelMedia::stop() LLViewerMediaFocus::getInstance()->clearFocus(); // This will unload & kill the media instance. - sMediaImpl = NULL; + mMediaImpl = NULL; } // static void LLViewerParcelMedia::pause() { - if(sMediaImpl.isNull()) + if(mMediaImpl.isNull()) { return; } - sMediaImpl->pause(); + mMediaImpl->pause(); } // static void LLViewerParcelMedia::start() { - if(sMediaImpl.isNull()) + if(mMediaImpl.isNull()) { return; } - sMediaImpl->start(); + mMediaImpl->start(); //LLFirstUse::useMedia(); @@ -271,17 +263,17 @@ void LLViewerParcelMedia::start() // static void LLViewerParcelMedia::seek(F32 time) { - if(sMediaImpl.isNull()) + if(mMediaImpl.isNull()) { return; } - sMediaImpl->seek(time); + mMediaImpl->seek(time); } // static void LLViewerParcelMedia::focus(bool focus) { - sMediaImpl->focus(focus); + mMediaImpl->focus(focus); } // static @@ -289,9 +281,9 @@ LLPluginClassMediaOwner::EMediaStatus LLViewerParcelMedia::getStatus() { LLPluginClassMediaOwner::EMediaStatus result = LLPluginClassMediaOwner::MEDIA_NONE; - if(sMediaImpl.notNull() && sMediaImpl->hasMedia()) + if(mMediaImpl.notNull() && mMediaImpl->hasMedia()) { - result = sMediaImpl->getMediaPlugin()->getStatus(); + result = mMediaImpl->getMediaPlugin()->getStatus(); } return result; @@ -300,15 +292,15 @@ LLPluginClassMediaOwner::EMediaStatus LLViewerParcelMedia::getStatus() // static std::string LLViewerParcelMedia::getMimeType() { - return sMediaImpl.notNull() ? sMediaImpl->getMimeType() : LLMIMETypes::getDefaultMimeType(); + return mMediaImpl.notNull() ? mMediaImpl->getMimeType() : LLMIMETypes::getDefaultMimeType(); } //static std::string LLViewerParcelMedia::getURL() { std::string url; - if(sMediaImpl.notNull()) - url = sMediaImpl->getMediaURL(); + if(mMediaImpl.notNull()) + url = mMediaImpl->getMediaURL(); if(stricmp(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaType().c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0) { @@ -325,19 +317,24 @@ std::string LLViewerParcelMedia::getURL() //static std::string LLViewerParcelMedia::getName() { - if(sMediaImpl.notNull()) - return sMediaImpl->getName(); + if(mMediaImpl.notNull()) + return mMediaImpl->getName(); return ""; } viewer_media_t LLViewerParcelMedia::getParcelMedia() { - return sMediaImpl; + return mMediaImpl; } ////////////////////////////////////////////////////////////////////////////////////////// // static -void LLViewerParcelMedia::processParcelMediaCommandMessage( LLMessageSystem *msg, void ** ) +void LLViewerParcelMedia::parcelMediaCommandMessageHandler(LLMessageSystem *msg, void **) +{ + getInstance()->processParcelMediaCommandMessage(msg); +} + +void LLViewerParcelMedia::processParcelMediaCommandMessage( LLMessageSystem *msg) { // extract the agent id // LLUUID agent_id; @@ -392,7 +389,7 @@ void LLViewerParcelMedia::processParcelMediaCommandMessage( LLMessageSystem *msg if (flags & (1<<PARCEL_MEDIA_COMMAND_TIME)) { - if(sMediaImpl.isNull()) + if(mMediaImpl.isNull()) { LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); play(parcel); @@ -403,7 +400,12 @@ void LLViewerParcelMedia::processParcelMediaCommandMessage( LLMessageSystem *msg ////////////////////////////////////////////////////////////////////////////////////////// // static -void LLViewerParcelMedia::processParcelMediaUpdate( LLMessageSystem *msg, void ** ) +void LLViewerParcelMedia::parcelMediaUpdateHandler(LLMessageSystem *msg, void **) +{ + getInstance()->processParcelMediaUpdate(msg); +} + +void LLViewerParcelMedia::processParcelMediaUpdate( LLMessageSystem *msg) { LLUUID media_id; std::string media_url; diff --git a/indra/newview/llviewerparcelmedia.h b/indra/newview/llviewerparcelmedia.h index 534f65b419..779a65bdf8 100644 --- a/indra/newview/llviewerparcelmedia.h +++ b/indra/newview/llviewerparcelmedia.h @@ -37,50 +37,53 @@ class LLViewerParcelMediaNavigationObserver; // This class understands land parcels, network traffic, LSL media // transport commands, and talks to the LLViewerMedia class to actually // do playback. It allows us to remove code from LLViewerParcelMgr. -class LLViewerParcelMedia : public LLViewerMediaObserver +class LLViewerParcelMedia : public LLViewerMediaObserver, public LLSingleton<LLViewerParcelMedia> { + LLSINGLETON(LLViewerParcelMedia); + ~LLViewerParcelMedia(); LOG_CLASS(LLViewerParcelMedia); - public: - static void initClass(); - static void cleanupClass(); - - static void update(LLParcel* parcel); - // called when the agent's parcel has a new URL, or the agent has - // walked on to a new parcel with media - - static void play(LLParcel* parcel); - // user clicked play button in media transport controls - - static void stop(); - // user clicked stop button in media transport controls - - static void pause(); - static void start(); - // restart after pause - no need for all the setup - - static void focus(bool focus); - - static void seek(F32 time); - // jump to timecode time - - static LLPluginClassMediaOwner::EMediaStatus getStatus(); - static std::string getMimeType(); - static std::string getURL(); - static std::string getName(); - static viewer_media_t getParcelMedia(); - - static void processParcelMediaCommandMessage( LLMessageSystem *msg, void ** ); - static void processParcelMediaUpdate( LLMessageSystem *msg, void ** ); - static void sendMediaNavigateMessage(const std::string& url); - - // inherited from LLViewerMediaObserver - virtual void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); - - public: - static S32 sMediaParcelLocalID; - static LLUUID sMediaRegionID; - // HACK: this will change with Media on a Prim - static viewer_media_t sMediaImpl; +public: + void update(LLParcel* parcel); + // called when the agent's parcel has a new URL, or the agent has + // walked on to a new parcel with media + + void play(LLParcel* parcel); + // user clicked play button in media transport controls + + void stop(); + // user clicked stop button in media transport controls + + void pause(); + void start(); + // restart after pause - no need for all the setup + + void focus(bool focus); + + void seek(F32 time); + // jump to timecode time + + LLPluginClassMediaOwner::EMediaStatus getStatus(); + std::string getMimeType(); + std::string getURL(); + std::string getName(); + viewer_media_t getParcelMedia(); + bool hasParcelMedia() { return mMediaImpl.notNull(); } + + static void parcelMediaCommandMessageHandler( LLMessageSystem *msg, void ** ); + static void parcelMediaUpdateHandler( LLMessageSystem *msg, void ** ); + void sendMediaNavigateMessage(const std::string& url); + + // inherited from LLViewerMediaObserver + virtual void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); + +private: + void processParcelMediaCommandMessage(LLMessageSystem *msg); + void processParcelMediaUpdate(LLMessageSystem *msg); + + S32 mMediaParcelLocalID; + LLUUID mMediaRegionID; + // HACK: this will change with Media on a Prim + viewer_media_t mMediaImpl; }; diff --git a/indra/newview/llviewerparcelmediaautoplay.cpp b/indra/newview/llviewerparcelmediaautoplay.cpp index 57ee583eae..d38a434d6c 100644 --- a/indra/newview/llviewerparcelmediaautoplay.cpp +++ b/indra/newview/llviewerparcelmediaautoplay.cpp @@ -122,7 +122,7 @@ BOOL LLViewerParcelMediaAutoPlay::tick() (mTimeInParcel > AUTOPLAY_TIME) && // and if we've been here for so many seconds (!this_media_url.empty()) && // and if the parcel has media (stricmp(this_media_type.c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0) && - (LLViewerParcelMedia::sMediaImpl.isNull())) // and if the media is not already playing + (!LLViewerParcelMedia::getInstance()->hasParcelMedia())) // and if the media is not already playing { if (this_media_texture_id.notNull()) // and if the media texture is good { @@ -144,7 +144,7 @@ BOOL LLViewerParcelMediaAutoPlay::tick() if (gSavedSettings.getBOOL("ParcelMediaAutoPlayEnable")) { // and last but not least, only play when autoplay is enabled - LLViewerParcelMedia::play(this_parcel); + LLViewerParcelMedia::getInstance()->play(this_parcel); } } diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 416d5d8e2e..6cc88d0c0b 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -1822,7 +1822,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use else { // Check for video - LLViewerParcelMedia::update(parcel); + LLViewerParcelMedia::getInstance()->update(parcel); // Then check for music if (gAudiop) |