Initial moap commit. /VERY/ WIP. Primarily committed to clean up unstaged changes. Do not run this, even if it may compile, as it will NOT work (for a myriad of reasons)!
This commit is contained in:
@@ -215,41 +215,57 @@ void LLViewerParcelMedia::play(LLParcel* parcel, bool filter)
|
||||
S32 media_width = parcel->getMediaWidth();
|
||||
S32 media_height = parcel->getMediaHeight();
|
||||
|
||||
// Debug print
|
||||
// LL_DEBUGS("Media") << "Play media type : " << mime_type << ", url : " << media_url << LL_ENDL;
|
||||
|
||||
if (!sMediaImpl || (sMediaImpl &&
|
||||
(sMediaImpl->getMediaURL() != media_url ||
|
||||
sMediaImpl->getMimeType() != mime_type ||
|
||||
sMediaImpl->getMediaTextureID() != placeholder_texture_id)))
|
||||
if(sMediaImpl)
|
||||
{
|
||||
if (sMediaImpl)
|
||||
// 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)
|
||||
{
|
||||
// Delete the old media impl first so they don't fight over the texture.
|
||||
sMediaImpl->stop();
|
||||
LL_DEBUGS("Media") << "playing with existing url " << media_url << LL_ENDL;
|
||||
|
||||
sMediaImpl->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)
|
||||
// {
|
||||
// sMediaImpl->navigateTo(media_url, mime_type, true);
|
||||
// }
|
||||
else
|
||||
{
|
||||
// Since the texture id is different, we need to generate a new impl
|
||||
|
||||
LL_DEBUGS("Media") << "new media impl with mime type " << mime_type << ", url " << media_url << LL_ENDL;
|
||||
|
||||
// There is no media impl, or it has just been deprecated, make a new one
|
||||
sMediaImpl = LLViewerMedia::newMediaImpl(media_url, placeholder_texture_id,
|
||||
media_width, media_height, media_auto_scale,
|
||||
media_loop, mime_type);
|
||||
// Delete the old one first so they don't fight over the texture.
|
||||
sMediaImpl = NULL;
|
||||
|
||||
// A new impl will be created below.
|
||||
}
|
||||
|
||||
// The url, mime type and texture are now the same, call play again
|
||||
if (sMediaImpl->getMediaURL() == media_url
|
||||
&& sMediaImpl->getMimeType() == mime_type
|
||||
&& sMediaImpl->getMediaTextureID() == placeholder_texture_id)
|
||||
{
|
||||
LL_DEBUGS("Media") << "playing with existing url " << media_url << LL_ENDL;
|
||||
|
||||
sMediaImpl->play();
|
||||
}
|
||||
|
||||
LLFirstUse::useMedia();
|
||||
// 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)
|
||||
{
|
||||
LL_DEBUGS("Media") << "new media impl with mime type " << mime_type << ", url " << media_url << LL_ENDL;
|
||||
|
||||
LLViewerParcelMediaAutoPlay::playStarted();
|
||||
// There is no media impl, make a new one
|
||||
sMediaImpl = LLViewerMedia::newMediaImpl(
|
||||
placeholder_texture_id,
|
||||
media_width,
|
||||
media_height,
|
||||
media_auto_scale,
|
||||
media_loop);
|
||||
sMediaImpl->setIsParcelMedia(true);
|
||||
sMediaImpl->navigateTo(media_url, mime_type, true);
|
||||
}
|
||||
|
||||
LLFirstUse::useMedia();
|
||||
|
||||
LLViewerParcelMediaAutoPlay::playStarted();
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -327,6 +343,33 @@ std::string LLViewerParcelMedia::getMimeType()
|
||||
return sMediaImpl.notNull() ? sMediaImpl->getMimeType() : LLMIMETypes::getDefaultMimeType();
|
||||
}
|
||||
|
||||
//static
|
||||
std::string LLViewerParcelMedia::getURL()
|
||||
{
|
||||
std::string url;
|
||||
if(sMediaImpl.notNull())
|
||||
url = sMediaImpl->getMediaURL();
|
||||
|
||||
if(stricmp(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaType().c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0)
|
||||
{
|
||||
if (url.empty())
|
||||
url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaCurrentURL();
|
||||
|
||||
if (url.empty())
|
||||
url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaURL();
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
//static
|
||||
std::string LLViewerParcelMedia::getName()
|
||||
{
|
||||
if(sMediaImpl.notNull())
|
||||
return sMediaImpl->getName();
|
||||
return "";
|
||||
}
|
||||
|
||||
viewer_media_t LLViewerParcelMedia::getParcelMedia()
|
||||
{
|
||||
return sMediaImpl;
|
||||
|
||||
Reference in New Issue
Block a user