diff options
Diffstat (limited to 'indra/newview/llviewermedia.cpp')
-rw-r--r-- | indra/newview/llviewermedia.cpp | 82 |
1 files changed, 69 insertions, 13 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index ef8f63484e..7c5b360b92 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -172,6 +172,11 @@ public: completeAny(status, "text/html"); } else + if(status == 403) + { + completeAny(status, "text/html"); + } + else if(status == 404) { // 404 is content not found - sites often have bespoke 404 pages so @@ -240,6 +245,7 @@ public: bool mInitialized; }; static LLViewerMedia::impl_list sViewerMediaImplList; +static LLViewerMedia::impl_id_map sViewerMediaTextureIDMap; static LLTimer sMediaCreateTimer; static const F32 LLVIEWERMEDIA_CREATE_DELAY = 1.0f; static F32 sGlobalVolume = 1.0f; @@ -297,7 +303,7 @@ viewer_media_t LLViewerMedia::newMediaImpl( else { media_impl->unload(); - media_impl->mTextureId = texture_id; + media_impl->setTextureID(texture_id); media_impl->mMediaWidth = media_width; media_impl->mMediaHeight = media_height; media_impl->mMediaAutoScale = media_auto_scale; @@ -412,18 +418,16 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s // static LLViewerMediaImpl* LLViewerMedia::getMediaImplFromTextureID(const LLUUID& texture_id) { - impl_list::iterator iter = sViewerMediaImplList.begin(); - impl_list::iterator end = sViewerMediaImplList.end(); - - for(; iter != end; iter++) + LLViewerMediaImpl* result = NULL; + + // Look up the texture ID in the texture id->impl map. + impl_id_map::iterator iter = sViewerMediaTextureIDMap.find(texture_id); + if(iter != sViewerMediaTextureIDMap.end()) { - LLViewerMediaImpl* media_impl = *iter; - if(media_impl->getMediaTextureID() == texture_id) - { - return media_impl; - } + result = iter->second; } - return NULL; + + return result; } ////////////////////////////////////////////////////////////////////////////////////////// @@ -554,6 +558,20 @@ bool LLViewerMedia::getInWorldMediaDisabled() return sInWorldMediaDisabled; } +////////////////////////////////////////////////////////////////////////////////////////// +// static +bool LLViewerMedia::isInterestingEnough(const LLUUID &object_id, const F64 &object_interest) +{ + if (LLViewerMediaFocus::getInstance()->getFocusedObjectID() == object_id) + { + return true; + } + else { + // XXX HACK + return object_interest > 1023;// INTEREST_THRESHHOLD; + } +} + LLViewerMedia::impl_list &LLViewerMedia::getPriorityList() { return sViewerMediaImplList; @@ -626,7 +644,22 @@ bool LLViewerMedia::priorityComparitor(const LLViewerMediaImpl* i1, const LLView static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMediaImpl* i2) { - return (i1->getProximityDistance() < i2->getProximityDistance()); + if(i1->getProximityDistance() < i2->getProximityDistance()) + { + return true; + } + else if(i1->getProximityDistance() > i2->getProximityDistance()) + { + return false; + } + else + { + // Both objects have the same distance. This most likely means they're two faces of the same object. + // They may also be faces on different objects with exactly the same distance (like HUD objects). + // We don't actually care what the sort order is for this case, as long as it's stable and doesn't change when you enable/disable media. + // Comparing the impl pointers gives a completely arbitrary ordering, but it will be stable. + return (i1 < i2); + } } ////////////////////////////////////////////////////////////////////////////////////////// @@ -827,7 +860,6 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id, : mMediaSource( NULL ), mMovieImageHasMips(false), - mTextureId(texture_id), mMediaWidth(media_width), mMediaHeight(media_height), mMediaAutoScale(media_auto_scale), @@ -857,6 +889,7 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id, mProximityDistance(0.0f), mMimeTypeProbe(NULL), mMediaAutoPlay(false), + mInNearbyMediaList(false), mIsUpdated(false) { @@ -868,6 +901,8 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id, } add_media_impl(this); + + setTextureID(texture_id); // connect this media_impl to the media texture, creating it if it doesn't exist.0 // This is necessary because we need to be able to use getMaxVirtualSize() even if the media plugin is not loaded. @@ -891,6 +926,7 @@ LLViewerMediaImpl::~LLViewerMediaImpl() LLViewerMediaTexture::removeMediaImplFromTexture(mTextureId) ; + setTextureID(); remove_media_impl(this); } @@ -2421,6 +2457,26 @@ LLVOVolume *LLViewerMediaImpl::getSomeObject() return result; } +void LLViewerMediaImpl::setTextureID(LLUUID id) +{ + if(id != mTextureId) + { + if(mTextureId.notNull()) + { + // Remove this item's entry from the map + sViewerMediaTextureIDMap.erase(mTextureId); + } + + if(id.notNull()) + { + sViewerMediaTextureIDMap.insert(LLViewerMedia::impl_id_map::value_type(id, this)); + } + + mTextureId = id; + } +} + + ////////////////////////////////////////////////////////////////////////////////////////// //static void LLViewerMedia::toggleMusicPlay(void*) |