From db2481e62a9a6f232a7b656d639566c4c8866ace Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Wed, 13 Aug 2008 10:29:27 +0000 Subject: From: Omar Vera Ustariz This patch implements a subset of the llParcelMediaCommandList() function. --- .../Common/BuiltIn_Commands_BaseClass.cs | 4 +- .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 124 ++++++++++++++++++++- .../Common/LSL_BuiltIn_Commands_Interface.cs | 2 +- 3 files changed, 123 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Common') diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs index 53533ec..d59da96 100644 --- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs @@ -1714,9 +1714,9 @@ namespace OpenSim.Region.ScriptEngine.Common 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) diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 440540e..d2a15aa 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -6758,14 +6758,130 @@ namespace OpenSim.Region.ScriptEngine.Common public void llParcelMediaCommandList(LSL_Types.list commandList) { - m_host.AddScriptLPS(1); - NotImplemented("llParcelMediaCommandList"); + //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); + for (int i = 0; i < commandList.Data.Length; i++) + { + switch ((ParcelMediaCommandEnum)commandList.Data[i]) + { + case ParcelMediaCommandEnum.Play: + List scenePresencePlayList = World.GetScenePresences(); + foreach (ScenePresence agent in scenePresencePlayList) + { + if (!agent.IsChildAgent) + { + agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0); + } + } + break; + case ParcelMediaCommandEnum.Stop: + List scenePresenceStopList = World.GetScenePresences(); + foreach (ScenePresence agent in scenePresenceStopList) + { + if (!agent.IsChildAgent) + { + agent.ControllingClient.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Stop, 0); + } + } + break; + case ParcelMediaCommandEnum.Pause: + List 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 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) diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index 3acbf97..9e3742c 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs @@ -586,7 +586,7 @@ namespace OpenSim.Region.ScriptEngine.Common 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) -- cgit v1.1