29 using System.Collections.Generic;
31 using System.Reflection;
37 using OpenMetaverse.Imaging;
38 using OpenSim.Framework;
39 using OpenSim.Framework.Console;
40 using OpenSim.Region.Framework.Interfaces;
41 using OpenSim.Region.Framework.Scenes;
51 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"J2KDecoderCommandModule")]
56 private Scene m_scene;
58 public string Name {
get {
return "Asset Information Module"; } }
60 public Type ReplaceableInterface {
get {
return null; } }
94 MainConsole.Instance.Commands.AddCommand(
99 "Do JPEG2000 decoding of an asset.",
100 "This is for debugging purposes. The asset id given must contain JPEG2000 data.",
104 void HandleDecode(
string module,
string[] args)
108 MainConsole.Instance.Output(
"Usage is j2k decode <ID>");
113 string rawAssetId = args[2];
115 if (!
UUID.TryParse(rawAssetId, out assetId))
117 MainConsole.Instance.OutputFormat(
"ERROR: {0} is not a valid ID format", rawAssetId);
121 AssetBase asset = m_scene.AssetService.Get(assetId.ToString());
124 MainConsole.Instance.OutputFormat(
"ERROR: No asset found with ID {0}", assetId);
128 if (asset.Type != (sbyte)AssetType.Texture)
130 MainConsole.Instance.OutputFormat(
"ERROR: Asset {0} is not a texture type", assetId);
137 MainConsole.Instance.OutputFormat(
"ERROR: No IJ2KDecoder module available");
141 OpenJPEG.J2KLayerInfo[] layers;
143 if (decoder.
Decode(assetId, asset.Data, out layers, out components))
145 MainConsole.Instance.OutputFormat(
146 "Successfully decoded asset {0} with {1} layers and {2} components",
147 assetId, layers.Length, components);
151 MainConsole.Instance.OutputFormat(
"Decode of asset {0} failed", assetId);
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
bool Decode(UUID assetID, byte[] j2kData)
Provides a synchronous decode so that caller can be assured that this executes before the next line ...
Commands for the J2KDecoder module. For debugging purposes.
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
Asset class. All Assets are reference by this class or a class derived from this class ...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
Interactive OpenSim region server