Port the llParcelMediaQuery forward to the new Shared/ directory
Add a Dictionary for faster lookup of cached items.0.6.0-stable
parent
db2481e62a
commit
4b6097756f
|
@ -173,6 +173,8 @@ namespace Opensim.Framework
|
|||
public class Cache
|
||||
{
|
||||
private List<CacheItemBase> m_Index = new List<CacheItemBase>();
|
||||
private Dictionary<LLUUID, CacheItemBase> m_Lookup =
|
||||
new Dictionary<LLUUID, CacheItemBase>();
|
||||
|
||||
private CacheStrategy m_Strategy;
|
||||
private CacheMedium m_Medium;
|
||||
|
@ -267,6 +269,11 @@ namespace Opensim.Framework
|
|||
|
||||
m_Index.RemoveRange(newSize, Count - newSize);
|
||||
m_Size = newSize;
|
||||
|
||||
m_Lookup.Clear();
|
||||
|
||||
foreach (CacheItemBase item in m_Index)
|
||||
m_Lookup[item.uuid] = item;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,12 +291,8 @@ namespace Opensim.Framework
|
|||
|
||||
lock (m_Index)
|
||||
{
|
||||
item = m_Index.Find(delegate(CacheItemBase i)
|
||||
{
|
||||
if (i.uuid == index)
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
if(m_Lookup.ContainsKey(index))
|
||||
item = m_Lookup[index];
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
|
@ -337,7 +340,10 @@ namespace Opensim.Framework
|
|||
{
|
||||
CacheItemBase missing = new CacheItemBase(index);
|
||||
if (!m_Index.Contains(missing))
|
||||
{
|
||||
m_Index.Add(missing);
|
||||
m_Lookup[index] = missing;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -404,6 +410,7 @@ namespace Opensim.Framework
|
|||
item.expires = DateTime.Now + m_DefaultTTL;
|
||||
|
||||
m_Index.Add(item);
|
||||
m_Lookup[index] = item;
|
||||
}
|
||||
item.Store(data);
|
||||
}
|
||||
|
@ -421,7 +428,10 @@ namespace Opensim.Framework
|
|||
{
|
||||
if (item.expires.Ticks == 0 ||
|
||||
item.expires <= now)
|
||||
{
|
||||
m_Index.Remove(item);
|
||||
m_Lookup.Remove(item.uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,12 +460,20 @@ namespace Opensim.Framework
|
|||
foreach (CacheItemBase i in candidates)
|
||||
{
|
||||
if (doExpire(i.uuid))
|
||||
{
|
||||
m_Index.Remove(i);
|
||||
m_Lookup.Remove(i.uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Index.RemoveRange(target, Count - target);
|
||||
|
||||
m_Lookup.Clear();
|
||||
|
||||
foreach (CacheItemBase item in m_Index)
|
||||
m_Lookup[item.uuid] = item;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -6541,14 +6541,130 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
public void llParcelMediaCommandList(LSL_Types.list commandList)
|
||||
{
|
||||
//TO DO: Implement the missing commands
|
||||
//PARCEL_MEDIA_COMMAND_STOP Stop the media stream and go back to the first frame.
|
||||
//PARCEL_MEDIA_COMMAND_PAUSE Pause the media stream (stop playing but stay on current frame).
|
||||
//PARCEL_MEDIA_COMMAND_PLAY Start the media stream playing from the current frame and stop when the end is reached.
|
||||
//PARCEL_MEDIA_COMMAND_LOOP Start the media stream playing from the current frame. When the end is reached, loop to the beginning and continue.
|
||||
//PARCEL_MEDIA_COMMAND_TEXTURE key uuid Use this to get or set the parcel's media texture.
|
||||
//PARCEL_MEDIA_COMMAND_URL string url Used to get or set the parcel's media url.
|
||||
//PARCEL_MEDIA_COMMAND_TIME float time Move a media stream to a specific time.
|
||||
//PARCEL_MEDIA_COMMAND_AGENT key uuid Applies the media command to the specified agent only.
|
||||
//PARCEL_MEDIA_COMMAND_UNLOAD Completely unloads the movie and restores the original texture.
|
||||
//PARCEL_MEDIA_COMMAND_AUTO_ALIGN integer boolean Sets the parcel option 'Auto scale content'.
|
||||
//PARCEL_MEDIA_COMMAND_TYPE string mime_type Use this to get or set the parcel media MIME type (e.g. "text/html"). (1.19.1 RC0 or later)
|
||||
//PARCEL_MEDIA_COMMAND_SIZE integer x, integer y Use this to get or set the parcel media pixel resolution. (1.19.1 RC0 or later)
|
||||
//PARCEL_MEDIA_COMMAND_DESC string desc Use this to get or set the parcel media description. (1.19.1 RC0 or later)
|
||||
//PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later)
|
||||
m_host.AddScriptLPS(1);
|
||||
NotImplemented("llParcelMediaCommandList");
|
||||
for (int i = 0; i < commandList.Data.Length; i++)
|
||||
{
|
||||
switch ((ParcelMediaCommandEnum)commandList.Data[i])
|
||||
{
|
||||
case ParcelMediaCommandEnum.Play:
|
||||
List<ScenePresence> scenePresencePlayList = World.GetScenePresences();
|
||||
foreach (ScenePresence agent in scenePresencePlayList)
|
||||
{
|
||||
if (!agent.IsChildAgent)
|
||||
{
|
||||
agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ParcelMediaCommandEnum.Stop:
|
||||
List<ScenePresence> scenePresenceStopList = World.GetScenePresences();
|
||||
foreach (ScenePresence agent in scenePresenceStopList)
|
||||
{
|
||||
if (!agent.IsChildAgent)
|
||||
{
|
||||
agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Stop, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ParcelMediaCommandEnum.Pause:
|
||||
List<ScenePresence> scenePresencePauseList = World.GetScenePresences();
|
||||
foreach (ScenePresence agent in scenePresencePauseList)
|
||||
{
|
||||
if (!agent.IsChildAgent)
|
||||
{
|
||||
agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Pause, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ParcelMediaCommandEnum.Url:
|
||||
if ((i + 1) < commandList.Length)
|
||||
{
|
||||
if (commandList.Data[i + 1] is string)
|
||||
{
|
||||
//Set the new media URL only if the user is the owner of the land
|
||||
osSetParcelMediaURL(commandList.Data[i + 1].ToString());
|
||||
|
||||
List<ScenePresence> scenePresenceList = World.GetScenePresences();
|
||||
LandData landData = World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
|
||||
//Send an update of the mediaURL to all the clients that are in the parcel
|
||||
foreach (ScenePresence agent in scenePresenceList)
|
||||
{
|
||||
if (!agent.IsChildAgent)
|
||||
{
|
||||
//Send parcel media update to the client
|
||||
agent.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, landData.MediaID, landData.MediaAutoScale, "", landData.Description, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url;
|
||||
NotImplemented("llParcelMediaCommandList parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType(), commandList.Data[i].ToString()).ToString());
|
||||
break;
|
||||
}//end switch
|
||||
|
||||
}
|
||||
|
||||
|
||||
//NotImplemented("llParcelMediaCommandList");
|
||||
}
|
||||
|
||||
public void llParcelMediaQuery()
|
||||
public LSL_Types.list llParcelMediaQuery(LSL_Types.list aList)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
NotImplemented("llParcelMediaQuery");
|
||||
LSL_Types.list list = new LSL_Types.list();
|
||||
//TO DO: make the implementation for the missing commands
|
||||
//PARCEL_MEDIA_COMMAND_TEXTURE key uuid Use this to get or set the parcel's media texture.
|
||||
//PARCEL_MEDIA_COMMAND_URL string url Used to get or set the parcel's media url.
|
||||
//PARCEL_MEDIA_COMMAND_TYPE string mime_type Use this to get or set the parcel media MIME type (e.g. "text/html"). (1.19.1 RC0 or later)
|
||||
//PARCEL_MEDIA_COMMAND_SIZE integer x, integer y Use this to get or set the parcel media pixel resolution. (1.19.1 RC0 or later)
|
||||
//PARCEL_MEDIA_COMMAND_DESC string desc Use this to get or set the parcel media description. (1.19.1 RC0 or later)
|
||||
//PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later)
|
||||
for (int i = 0; i < aList.Data.Length; i++)
|
||||
{
|
||||
|
||||
if (aList.Data[i] != null)
|
||||
{
|
||||
switch((ParcelMediaCommandEnum)aList.Data[i])
|
||||
{
|
||||
case ParcelMediaCommandEnum.Url:
|
||||
list.Add(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaURL);
|
||||
break;
|
||||
case ParcelMediaCommandEnum.Desc:
|
||||
list.Add(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).Description);
|
||||
break;
|
||||
case ParcelMediaCommandEnum.Texture:
|
||||
list.Add(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID);
|
||||
break;
|
||||
default:
|
||||
ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url;
|
||||
NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
public LSL_Types.LSLInteger llModPow(int a, int b, int c)
|
||||
|
|
|
@ -583,7 +583,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
void llLoadURL(string avatar_id, string message, string url);
|
||||
//wiki: llParcelMediaCommandList(list commandList)
|
||||
void llParcelMediaCommandList(LSL_Types.list commandList);
|
||||
void llParcelMediaQuery();
|
||||
LSL_Types.list llParcelMediaQuery(LSL_Types.list aList);
|
||||
//wiki integer llModPow(integer a, integer b, integer c)
|
||||
LSL_Types.LSLInteger llModPow(int a, int b, int c);
|
||||
//wiki: integer llGetInventoryType(string name)
|
||||
|
|
|
@ -1564,9 +1564,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
m_LSL_Functions.llParcelMediaCommandList(commandList);
|
||||
}
|
||||
|
||||
public void llParcelMediaQuery()
|
||||
public LSL_Types.list llParcelMediaQuery(LSL_Types.list aList)
|
||||
{
|
||||
m_LSL_Functions.llParcelMediaQuery();
|
||||
return m_LSL_Functions.llParcelMediaQuery(aList);
|
||||
}
|
||||
|
||||
public LSL_Types.LSLInteger llModPow(int a, int b, int c)
|
||||
|
|
Loading…
Reference in New Issue