Media classes + A step toward restructuring Nearby Media floater
Several changes here: - Implemented support for "media classification": see http://docs.google.com/a/lindenlab.com/View?id=ddznhrqn_29vhnr2pg8 - Added settings for auto-playing of said classifications Nearby Media Floater: - On/Off buttons are now explicit...no more power buttons - Parcel Media and Parcel Audio are "lighter weight", with no more on/off - List now sorts with playing items at top, non-playing below - There is now a "Show" drop-down that filters the list by classification - Added checkboxes to the bottom to control auto-play settings More work is needed, so consider this a checkpointmeow-7.2.2
parent
b25972fc25
commit
b8a46c81ee
|
|
@ -4578,6 +4578,39 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>MediaShowOnOthers</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Whether or not to show media on other avatars</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>MediaShowOutsideParcel</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Whether or not to show media from outside the current parcel</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>MediaShowWithinParcel</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Whether or not to show media within the current parcel</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>MemoryLogFrequency</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@
|
|||
#include "llcallbacklist.h"
|
||||
#include "llparcel.h"
|
||||
#include "llaudioengine.h" // for gAudiop
|
||||
#include "llvoavatar.h"
|
||||
#include "llvoavatarself.h"
|
||||
#include "llviewerregion.h"
|
||||
|
||||
#include "llevent.h" // LLSimpleListener
|
||||
#include "llnotificationsutil.h"
|
||||
|
|
@ -62,6 +65,10 @@
|
|||
#include <boost/signals2.hpp>
|
||||
|
||||
/*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";
|
||||
|
||||
|
||||
// Move this to its own file.
|
||||
|
||||
|
|
@ -365,8 +372,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
|
|||
// The current media URL is not empty.
|
||||
// If (the media was already loaded OR the media was set to autoplay) AND this update didn't come from this agent,
|
||||
// do a navigate.
|
||||
bool auto_play = (media_impl->mMediaAutoPlay && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING));
|
||||
|
||||
bool auto_play = media_impl->isAutoPlayable();
|
||||
if((was_loaded || auto_play) && !update_from_self)
|
||||
{
|
||||
needs_navigate = url_changed;
|
||||
|
|
@ -390,7 +396,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
|
|||
media_impl->mMediaAutoPlay = media_entry->getAutoPlay();
|
||||
media_impl->mMediaEntryURL = media_entry->getCurrentURL();
|
||||
|
||||
if(media_impl->mMediaAutoPlay && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING))
|
||||
if(media_impl->isAutoPlayable())
|
||||
{
|
||||
needs_navigate = true;
|
||||
}
|
||||
|
|
@ -818,7 +824,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
|
|||
|
||||
impl_count_total++;
|
||||
}
|
||||
|
||||
|
||||
// Overrides if the window is minimized or we lost focus (taking care
|
||||
// not to accidentally "raise" the priority either)
|
||||
if (!gViewerWindow->getActive() /* viewer window minimized? */
|
||||
|
|
@ -846,7 +852,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pimpl->setPriority(new_priority);
|
||||
|
||||
if(pimpl->getUsedInUI())
|
||||
|
|
@ -940,6 +946,7 @@ bool LLViewerMedia::firstRunCallback(const LLSD& notification, const LLSD& respo
|
|||
{
|
||||
// user has elected to automatically play media.
|
||||
gSavedSettings.setBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING, TRUE);
|
||||
// XXX TODO: what to do about other AUTO_PLAY settings?
|
||||
gSavedSettings.setBOOL("AudioStreamingMusic", TRUE);
|
||||
gSavedSettings.setBOOL("AudioStreamingMedia", TRUE);
|
||||
|
||||
|
|
@ -959,6 +966,7 @@ bool LLViewerMedia::firstRunCallback(const LLSD& notification, const LLSD& respo
|
|||
else
|
||||
{
|
||||
gSavedSettings.setBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING, FALSE);
|
||||
// XXX TODO: what to do about other AUTO_PLAY settings?
|
||||
gSavedSettings.setBOOL("AudioStreamingMedia", FALSE);
|
||||
gSavedSettings.setBOOL("AudioStreamingMusic", FALSE);
|
||||
}
|
||||
|
|
@ -2111,6 +2119,21 @@ void LLViewerMediaImpl::scaleMouse(S32 *mouse_x, S32 *mouse_y)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool LLViewerMediaImpl::isMediaTimeBased()
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if(mMediaSource)
|
||||
{
|
||||
result = mMediaSource->pluginSupportsMediaTime();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool LLViewerMediaImpl::isMediaPlaying()
|
||||
{
|
||||
|
|
@ -2172,7 +2195,7 @@ void LLViewerMediaImpl::setDisabled(bool disabled)
|
|||
else
|
||||
{
|
||||
// We just (re)enabled this media. Do a navigate if auto-play is in order.
|
||||
if(mMediaAutoPlay && gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING))
|
||||
if(isAutoPlayable())
|
||||
{
|
||||
navigateTo(mMediaEntryURL, "", true, true);
|
||||
}
|
||||
|
|
@ -2199,6 +2222,12 @@ bool LLViewerMediaImpl::isForcedUnloaded() const
|
|||
}
|
||||
}
|
||||
|
||||
// If this media's class is not supposed to be shown, unload
|
||||
if (!shouldShowBasedOnClass())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2684,3 +2713,110 @@ void LLViewerMediaImpl::setTextureID(LLUUID id)
|
|||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
bool LLViewerMediaImpl::isAutoPlayable() const
|
||||
{
|
||||
return (mMediaAutoPlay && gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
bool LLViewerMediaImpl::shouldShowBasedOnClass() const
|
||||
{
|
||||
// If this is parcel media or in the UI, return true always
|
||||
if (getUsedInUI() || isParcelMedia()) return true;
|
||||
|
||||
bool attached_to_another_avatar = isAttachedToAnotherAvatar();
|
||||
bool inside_parcel = isInAgentParcel();
|
||||
|
||||
// llinfos << " hasFocus = " << hasFocus() <<
|
||||
// " others = " << (attached_to_another_avatar && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING)) <<
|
||||
// " within = " << (inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING)) <<
|
||||
// " outside = " << (!inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING)) << llendl;
|
||||
|
||||
// If it has focus, we should show it
|
||||
if (hasFocus())
|
||||
return true;
|
||||
|
||||
// If it is attached to an avatar and the pref is off, we shouldn't show it
|
||||
if (attached_to_another_avatar)
|
||||
return gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING);
|
||||
|
||||
if (inside_parcel)
|
||||
return gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING);
|
||||
else
|
||||
return gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
bool LLViewerMediaImpl::isAttachedToAnotherAvatar() const
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
std::list< LLVOVolume* >::const_iterator iter = mObjectList.begin();
|
||||
std::list< LLVOVolume* >::const_iterator end = mObjectList.end();
|
||||
for ( ; iter != end; iter++)
|
||||
{
|
||||
if (isObjectAttachedToAnotherAvatar(*iter))
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//static
|
||||
bool LLViewerMediaImpl::isObjectAttachedToAnotherAvatar(LLVOVolume *obj)
|
||||
{
|
||||
bool result = false;
|
||||
LLXform *xform = obj;
|
||||
// Walk up parent chain
|
||||
while (NULL != xform)
|
||||
{
|
||||
LLViewerObject *object = dynamic_cast<LLViewerObject*> (xform);
|
||||
if (NULL != object)
|
||||
{
|
||||
LLVOAvatar *avatar = object->asAvatar();
|
||||
if (NULL != avatar && avatar != gAgent.getAvatarObject())
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
xform = xform->getParent();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
bool LLViewerMediaImpl::isInAgentParcel() const
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
std::list< LLVOVolume* >::const_iterator iter = mObjectList.begin();
|
||||
std::list< LLVOVolume* >::const_iterator end = mObjectList.end();
|
||||
for ( ; iter != end; iter++)
|
||||
{
|
||||
LLVOVolume *object = *iter;
|
||||
if (LLViewerMediaImpl::isObjectInAgentParcel(object))
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// static
|
||||
bool LLViewerMediaImpl::isObjectInAgentParcel(LLVOVolume *obj)
|
||||
{
|
||||
return (LLViewerParcelMgr::getInstance()->inAgentParcel(obj->getPositionGlobal()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class LLViewerMediaImpl;
|
|||
class LLUUID;
|
||||
class LLViewerMediaTexture;
|
||||
class LLMediaEntry;
|
||||
class LLVOVolume ;
|
||||
class LLVOVolume;
|
||||
class LLMimeDiscoveryResponder;
|
||||
|
||||
typedef LLPointer<LLViewerMediaImpl> viewer_media_t;
|
||||
|
|
@ -76,7 +76,10 @@ class LLViewerMedia
|
|||
public:
|
||||
|
||||
// String to get/set media autoplay in gSavedSettings
|
||||
static const char *AUTO_PLAY_MEDIA_SETTING;
|
||||
static const char* AUTO_PLAY_MEDIA_SETTING;
|
||||
static const char* SHOW_MEDIA_ON_OTHERS_SETTING;
|
||||
static const char* SHOW_MEDIA_WITHIN_PARCEL_SETTING;
|
||||
static const char* SHOW_MEDIA_OUTSIDE_PARCEL_SETTING;
|
||||
|
||||
typedef std::vector<LLViewerMediaImpl*> impl_list;
|
||||
|
||||
|
|
@ -204,14 +207,16 @@ public:
|
|||
void updateImagesMediaStreams();
|
||||
LLUUID getMediaTextureID() const;
|
||||
|
||||
void suspendUpdates(bool suspend) { mSuspendUpdates = suspend; };
|
||||
void suspendUpdates(bool suspend) { mSuspendUpdates = suspend; }
|
||||
void setVisible(bool visible);
|
||||
bool getVisible() const { return mVisible; };
|
||||
bool getVisible() const { return mVisible; }
|
||||
bool isVisible() const { return mVisible; }
|
||||
|
||||
bool isMediaTimeBased();
|
||||
bool isMediaPlaying();
|
||||
bool isMediaPaused();
|
||||
bool hasMedia() const;
|
||||
bool isMediaFailed() const { return mMediaSourceFailed; };
|
||||
bool isMediaFailed() const { return mMediaSourceFailed; }
|
||||
void setMediaFailed(bool val) { mMediaSourceFailed = val; }
|
||||
void resetPreviousMediaState();
|
||||
|
||||
|
|
@ -227,10 +232,10 @@ public:
|
|||
// returns true if this instance could be playable based on autoplay setting, current load state, etc.
|
||||
bool isPlayable() const;
|
||||
|
||||
void setIsParcelMedia(bool is_parcel_media) { mIsParcelMedia = is_parcel_media; };
|
||||
bool isParcelMedia() const { return mIsParcelMedia; };
|
||||
void setIsParcelMedia(bool is_parcel_media) { mIsParcelMedia = is_parcel_media; }
|
||||
bool isParcelMedia() const { return mIsParcelMedia; }
|
||||
|
||||
ECursorType getLastSetCursor() { return mLastSetCursor; };
|
||||
ECursorType getLastSetCursor() { return mLastSetCursor; }
|
||||
|
||||
// utility function to create a ready-to-use media instance from a desired media type.
|
||||
static LLPluginClassMedia* newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height);
|
||||
|
|
@ -331,6 +336,18 @@ public:
|
|||
|
||||
void cancelMimeTypeProbe();
|
||||
|
||||
// Is this media attached to an avatar *not* self
|
||||
bool isAttachedToAnotherAvatar() const;
|
||||
|
||||
// Is this media in the agent's parcel?
|
||||
bool isInAgentParcel() const;
|
||||
|
||||
private:
|
||||
bool isAutoPlayable() const;
|
||||
bool shouldShowBasedOnClass() const;
|
||||
static bool isObjectAttachedToAnotherAvatar(LLVOVolume *obj);
|
||||
static bool isObjectInAgentParcel(LLVOVolume *obj);
|
||||
|
||||
private:
|
||||
// a single media url with some data and an impl.
|
||||
LLPluginClassMedia* mMediaSource;
|
||||
|
|
|
|||
Loading…
Reference in New Issue