summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorskolb <none@none>2009-12-09 09:31:37 -0800
committerskolb <none@none>2009-12-09 09:31:37 -0800
commit53d67dcb68a1650cd0bf4180e4403621dca2402c (patch)
tree0bc0e1fa120204255c8c34694b12f5ce1c4c8b37 /indra
parent2c0cea901712ffad012356278d72e3c3d844e5bc (diff)
parentce18034e6544364e39aef0ac1a315b7e9e5770fa (diff)
Merge viewer 2-0 into media
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llviewermedia.cpp51
-rw-r--r--indra/newview/llviewermedia.h5
2 files changed, 44 insertions, 12 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 952de00272..0aae1a093d 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;
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -827,7 +831,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 +860,7 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
mProximityDistance(0.0f),
mMimeTypeProbe(NULL),
mMediaAutoPlay(false),
+ mInNearbyMediaList(false),
mIsUpdated(false)
{
@@ -868,6 +872,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 +897,7 @@ LLViewerMediaImpl::~LLViewerMediaImpl()
LLViewerMediaTexture::removeMediaImplFromTexture(mTextureId) ;
+ setTextureID();
remove_media_impl(this);
}
@@ -2422,6 +2429,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*)
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index 713eb2710b..349a66867a 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -79,6 +79,8 @@ class LLViewerMedia
typedef std::vector<LLViewerMediaImpl*> impl_list;
+ typedef std::map<LLUUID, LLViewerMediaImpl*> impl_id_map;
+
// Special case early init for just web browser component
// so we can show login screen. See .cpp file for details. JC
@@ -287,6 +289,8 @@ public:
LLPluginClassMedia::EPriority getPriority() { return mPriority; };
void setLowPrioritySizeLimit(int size);
+
+ void setTextureID(LLUUID id = LLUUID::null);
typedef enum
{
@@ -348,6 +352,7 @@ public:
LLMimeDiscoveryResponder *mMimeTypeProbe;
bool mMediaAutoPlay;
std::string mMediaEntryURL;
+ bool mInNearbyMediaList; // used by LLFloaterNearbyMedia::refreshList() for performance reasons
private:
BOOL mIsUpdated ;