diff options
4 files changed, 147 insertions, 13 deletions
diff --git a/OpenSim/Framework/Cache.cs b/OpenSim/Framework/Cache.cs index 780e262..7a1d682 100644 --- a/OpenSim/Framework/Cache.cs +++ b/OpenSim/Framework/Cache.cs | |||
@@ -173,6 +173,8 @@ namespace Opensim.Framework | |||
173 | public class Cache | 173 | public class Cache |
174 | { | 174 | { |
175 | private List<CacheItemBase> m_Index = new List<CacheItemBase>(); | 175 | private List<CacheItemBase> m_Index = new List<CacheItemBase>(); |
176 | private Dictionary<LLUUID, CacheItemBase> m_Lookup = | ||
177 | new Dictionary<LLUUID, CacheItemBase>(); | ||
176 | 178 | ||
177 | private CacheStrategy m_Strategy; | 179 | private CacheStrategy m_Strategy; |
178 | private CacheMedium m_Medium; | 180 | private CacheMedium m_Medium; |
@@ -267,6 +269,11 @@ namespace Opensim.Framework | |||
267 | 269 | ||
268 | m_Index.RemoveRange(newSize, Count - newSize); | 270 | m_Index.RemoveRange(newSize, Count - newSize); |
269 | m_Size = newSize; | 271 | m_Size = newSize; |
272 | |||
273 | m_Lookup.Clear(); | ||
274 | |||
275 | foreach (CacheItemBase item in m_Index) | ||
276 | m_Lookup[item.uuid] = item; | ||
270 | } | 277 | } |
271 | } | 278 | } |
272 | 279 | ||
@@ -284,12 +291,8 @@ namespace Opensim.Framework | |||
284 | 291 | ||
285 | lock (m_Index) | 292 | lock (m_Index) |
286 | { | 293 | { |
287 | item = m_Index.Find(delegate(CacheItemBase i) | 294 | if(m_Lookup.ContainsKey(index)) |
288 | { | 295 | item = m_Lookup[index]; |
289 | if (i.uuid == index) | ||
290 | return true; | ||
291 | return false; | ||
292 | }); | ||
293 | } | 296 | } |
294 | 297 | ||
295 | if (item == null) | 298 | if (item == null) |
@@ -337,7 +340,10 @@ namespace Opensim.Framework | |||
337 | { | 340 | { |
338 | CacheItemBase missing = new CacheItemBase(index); | 341 | CacheItemBase missing = new CacheItemBase(index); |
339 | if (!m_Index.Contains(missing)) | 342 | if (!m_Index.Contains(missing)) |
343 | { | ||
340 | m_Index.Add(missing); | 344 | m_Index.Add(missing); |
345 | m_Lookup[index] = missing; | ||
346 | } | ||
341 | } | 347 | } |
342 | } | 348 | } |
343 | return null; | 349 | return null; |
@@ -404,6 +410,7 @@ namespace Opensim.Framework | |||
404 | item.expires = DateTime.Now + m_DefaultTTL; | 410 | item.expires = DateTime.Now + m_DefaultTTL; |
405 | 411 | ||
406 | m_Index.Add(item); | 412 | m_Index.Add(item); |
413 | m_Lookup[index] = item; | ||
407 | } | 414 | } |
408 | item.Store(data); | 415 | item.Store(data); |
409 | } | 416 | } |
@@ -421,7 +428,10 @@ namespace Opensim.Framework | |||
421 | { | 428 | { |
422 | if (item.expires.Ticks == 0 || | 429 | if (item.expires.Ticks == 0 || |
423 | item.expires <= now) | 430 | item.expires <= now) |
431 | { | ||
424 | m_Index.Remove(item); | 432 | m_Index.Remove(item); |
433 | m_Lookup.Remove(item.uuid); | ||
434 | } | ||
425 | } | 435 | } |
426 | } | 436 | } |
427 | 437 | ||
@@ -450,12 +460,20 @@ namespace Opensim.Framework | |||
450 | foreach (CacheItemBase i in candidates) | 460 | foreach (CacheItemBase i in candidates) |
451 | { | 461 | { |
452 | if (doExpire(i.uuid)) | 462 | if (doExpire(i.uuid)) |
463 | { | ||
453 | m_Index.Remove(i); | 464 | m_Index.Remove(i); |
465 | m_Lookup.Remove(i.uuid); | ||
466 | } | ||
454 | } | 467 | } |
455 | } | 468 | } |
456 | else | 469 | else |
457 | { | 470 | { |
458 | m_Index.RemoveRange(target, Count - target); | 471 | m_Index.RemoveRange(target, Count - target); |
472 | |||
473 | m_Lookup.Clear(); | ||
474 | |||
475 | foreach (CacheItemBase item in m_Index) | ||
476 | m_Lookup[item.uuid] = item; | ||
459 | } | 477 | } |
460 | } | 478 | } |
461 | break; | 479 | break; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a6de186..d7633d8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6541,14 +6541,130 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6541 | 6541 | ||
6542 | public void llParcelMediaCommandList(LSL_Types.list commandList) | 6542 | public void llParcelMediaCommandList(LSL_Types.list commandList) |
6543 | { | 6543 | { |
6544 | m_host.AddScriptLPS(1); | 6544 | //TO DO: Implement the missing commands |
6545 | NotImplemented("llParcelMediaCommandList"); | 6545 | //PARCEL_MEDIA_COMMAND_STOP Stop the media stream and go back to the first frame. |
6546 | //PARCEL_MEDIA_COMMAND_PAUSE Pause the media stream (stop playing but stay on current frame). | ||
6547 | //PARCEL_MEDIA_COMMAND_PLAY Start the media stream playing from the current frame and stop when the end is reached. | ||
6548 | //PARCEL_MEDIA_COMMAND_LOOP Start the media stream playing from the current frame. When the end is reached, loop to the beginning and continue. | ||
6549 | //PARCEL_MEDIA_COMMAND_TEXTURE key uuid Use this to get or set the parcel's media texture. | ||
6550 | //PARCEL_MEDIA_COMMAND_URL string url Used to get or set the parcel's media url. | ||
6551 | //PARCEL_MEDIA_COMMAND_TIME float time Move a media stream to a specific time. | ||
6552 | //PARCEL_MEDIA_COMMAND_AGENT key uuid Applies the media command to the specified agent only. | ||
6553 | //PARCEL_MEDIA_COMMAND_UNLOAD Completely unloads the movie and restores the original texture. | ||
6554 | //PARCEL_MEDIA_COMMAND_AUTO_ALIGN integer boolean Sets the parcel option 'Auto scale content'. | ||
6555 | //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) | ||
6556 | //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) | ||
6557 | //PARCEL_MEDIA_COMMAND_DESC string desc Use this to get or set the parcel media description. (1.19.1 RC0 or later) | ||
6558 | //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) | ||
6559 | m_host.AddScriptLPS(1); | ||
6560 | for (int i = 0; i < commandList.Data.Length; i++) | ||
6561 | { | ||
6562 | switch ((ParcelMediaCommandEnum)commandList.Data[i]) | ||
6563 | { | ||
6564 | case ParcelMediaCommandEnum.Play: | ||
6565 | List<ScenePresence> scenePresencePlayList = World.GetScenePresences(); | ||
6566 | foreach (ScenePresence agent in scenePresencePlayList) | ||
6567 | { | ||
6568 | if (!agent.IsChildAgent) | ||
6569 | { | ||
6570 | agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0); | ||
6571 | } | ||
6572 | } | ||
6573 | break; | ||
6574 | case ParcelMediaCommandEnum.Stop: | ||
6575 | List<ScenePresence> scenePresenceStopList = World.GetScenePresences(); | ||
6576 | foreach (ScenePresence agent in scenePresenceStopList) | ||
6577 | { | ||
6578 | if (!agent.IsChildAgent) | ||
6579 | { | ||
6580 | agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Stop, 0); | ||
6581 | } | ||
6582 | } | ||
6583 | break; | ||
6584 | case ParcelMediaCommandEnum.Pause: | ||
6585 | List<ScenePresence> scenePresencePauseList = World.GetScenePresences(); | ||
6586 | foreach (ScenePresence agent in scenePresencePauseList) | ||
6587 | { | ||
6588 | if (!agent.IsChildAgent) | ||
6589 | { | ||
6590 | agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Pause, 0); | ||
6591 | } | ||
6592 | } | ||
6593 | break; | ||
6594 | |||
6595 | case ParcelMediaCommandEnum.Url: | ||
6596 | if ((i + 1) < commandList.Length) | ||
6597 | { | ||
6598 | if (commandList.Data[i + 1] is string) | ||
6599 | { | ||
6600 | //Set the new media URL only if the user is the owner of the land | ||
6601 | osSetParcelMediaURL(commandList.Data[i + 1].ToString()); | ||
6602 | |||
6603 | List<ScenePresence> scenePresenceList = World.GetScenePresences(); | ||
6604 | LandData landData = World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
6605 | //Send an update of the mediaURL to all the clients that are in the parcel | ||
6606 | foreach (ScenePresence agent in scenePresenceList) | ||
6607 | { | ||
6608 | if (!agent.IsChildAgent) | ||
6609 | { | ||
6610 | //Send parcel media update to the client | ||
6611 | agent.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, landData.MediaID, landData.MediaAutoScale, "", landData.Description, 0, 0, 1); | ||
6612 | } | ||
6613 | } | ||
6614 | |||
6615 | } | ||
6616 | i++; | ||
6617 | } | ||
6618 | break; | ||
6619 | default: | ||
6620 | ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; | ||
6621 | NotImplemented("llParcelMediaCommandList parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType(), commandList.Data[i].ToString()).ToString()); | ||
6622 | break; | ||
6623 | }//end switch | ||
6624 | |||
6625 | } | ||
6626 | |||
6627 | |||
6628 | //NotImplemented("llParcelMediaCommandList"); | ||
6546 | } | 6629 | } |
6547 | 6630 | ||
6548 | public void llParcelMediaQuery() | 6631 | public LSL_Types.list llParcelMediaQuery(LSL_Types.list aList) |
6549 | { | 6632 | { |
6550 | m_host.AddScriptLPS(1); | 6633 | m_host.AddScriptLPS(1); |
6551 | NotImplemented("llParcelMediaQuery"); | 6634 | LSL_Types.list list = new LSL_Types.list(); |
6635 | //TO DO: make the implementation for the missing commands | ||
6636 | //PARCEL_MEDIA_COMMAND_TEXTURE key uuid Use this to get or set the parcel's media texture. | ||
6637 | //PARCEL_MEDIA_COMMAND_URL string url Used to get or set the parcel's media url. | ||
6638 | //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) | ||
6639 | //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) | ||
6640 | //PARCEL_MEDIA_COMMAND_DESC string desc Use this to get or set the parcel media description. (1.19.1 RC0 or later) | ||
6641 | //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) | ||
6642 | for (int i = 0; i < aList.Data.Length; i++) | ||
6643 | { | ||
6644 | |||
6645 | if (aList.Data[i] != null) | ||
6646 | { | ||
6647 | switch((ParcelMediaCommandEnum)aList.Data[i]) | ||
6648 | { | ||
6649 | case ParcelMediaCommandEnum.Url: | ||
6650 | list.Add(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaURL); | ||
6651 | break; | ||
6652 | case ParcelMediaCommandEnum.Desc: | ||
6653 | list.Add(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).Description); | ||
6654 | break; | ||
6655 | case ParcelMediaCommandEnum.Texture: | ||
6656 | list.Add(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID); | ||
6657 | break; | ||
6658 | default: | ||
6659 | ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; | ||
6660 | NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); | ||
6661 | break; | ||
6662 | } | ||
6663 | |||
6664 | } | ||
6665 | } | ||
6666 | return list; | ||
6667 | |||
6552 | } | 6668 | } |
6553 | 6669 | ||
6554 | public LSL_Types.LSLInteger llModPow(int a, int b, int c) | 6670 | public LSL_Types.LSLInteger llModPow(int a, int b, int c) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 8eea756..61556a9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -583,7 +583,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
583 | void llLoadURL(string avatar_id, string message, string url); | 583 | void llLoadURL(string avatar_id, string message, string url); |
584 | //wiki: llParcelMediaCommandList(list commandList) | 584 | //wiki: llParcelMediaCommandList(list commandList) |
585 | void llParcelMediaCommandList(LSL_Types.list commandList); | 585 | void llParcelMediaCommandList(LSL_Types.list commandList); |
586 | void llParcelMediaQuery(); | 586 | LSL_Types.list llParcelMediaQuery(LSL_Types.list aList); |
587 | //wiki integer llModPow(integer a, integer b, integer c) | 587 | //wiki integer llModPow(integer a, integer b, integer c) |
588 | LSL_Types.LSLInteger llModPow(int a, int b, int c); | 588 | LSL_Types.LSLInteger llModPow(int a, int b, int c); |
589 | //wiki: integer llGetInventoryType(string name) | 589 | //wiki: integer llGetInventoryType(string name) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index e6966fc..5f0a1bc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -1564,9 +1564,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1564 | m_LSL_Functions.llParcelMediaCommandList(commandList); | 1564 | m_LSL_Functions.llParcelMediaCommandList(commandList); |
1565 | } | 1565 | } |
1566 | 1566 | ||
1567 | public void llParcelMediaQuery() | 1567 | public LSL_Types.list llParcelMediaQuery(LSL_Types.list aList) |
1568 | { | 1568 | { |
1569 | m_LSL_Functions.llParcelMediaQuery(); | 1569 | return m_LSL_Functions.llParcelMediaQuery(aList); |
1570 | } | 1570 | } |
1571 | 1571 | ||
1572 | public LSL_Types.LSLInteger llModPow(int a, int b, int c) | 1572 | public LSL_Types.LSLInteger llModPow(int a, int b, int c) |