aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs42
1 files changed, 32 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index a1a2501..2879154 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
45{ 45{
46 public delegate void J2KDecodeDelegate(UUID assetID); 46 public delegate void J2KDecodeDelegate(UUID assetID);
47 47
48 public class J2KDecoderModule : IRegionModule, IJ2KDecoder 48 public class J2KDecoderModule : ISharedRegionModule, IJ2KDecoder
49 { 49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 51
@@ -56,26 +56,21 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
56 /// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary> 56 /// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary>
57 private IImprovedAssetCache m_cache; 57 private IImprovedAssetCache m_cache;
58 /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary> 58 /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary>
59 private UUID m_CreatorID = UUID.Zero;
59 private Scene m_scene; 60 private Scene m_scene;
60 61
61 #region IRegionModule 62 #region ISharedRegionModule
62 63
63 private bool m_useCSJ2K = true; 64 private bool m_useCSJ2K = true;
64 65
65 public string Name { get { return "J2KDecoderModule"; } } 66 public string Name { get { return "J2KDecoderModule"; } }
66 public bool IsSharedModule { get { return true; } }
67 67
68 public J2KDecoderModule() 68 public J2KDecoderModule()
69 { 69 {
70 } 70 }
71 71
72 public void Initialise(Scene scene, IConfigSource source) 72 public void Initialise(IConfigSource source)
73 { 73 {
74 if (m_scene == null)
75 m_scene = scene;
76
77 scene.RegisterModuleInterface<IJ2KDecoder>(this);
78
79 IConfig startupConfig = source.Configs["Startup"]; 74 IConfig startupConfig = source.Configs["Startup"];
80 if (startupConfig != null) 75 if (startupConfig != null)
81 { 76 {
@@ -83,6 +78,24 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
83 } 78 }
84 } 79 }
85 80
81 public void AddRegion(Scene scene)
82 {
83 if (m_scene == null)
84 {
85 m_scene = scene;
86 m_CreatorID = scene.RegionInfo.RegionID;
87 }
88
89 scene.RegisterModuleInterface<IJ2KDecoder>(this);
90
91 }
92
93 public void RemoveRegion(Scene scene)
94 {
95 if (m_scene == scene)
96 m_scene = null;
97 }
98
86 public void PostInitialise() 99 public void PostInitialise()
87 { 100 {
88 m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); 101 m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
@@ -92,6 +105,15 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
92 { 105 {
93 } 106 }
94 107
108 public void RegionLoaded(Scene scene)
109 {
110 }
111
112 public Type ReplaceableInterface
113 {
114 get { return null; }
115 }
116
95 #endregion IRegionModule 117 #endregion IRegionModule
96 118
97 #region IJ2KDecoder 119 #region IJ2KDecoder
@@ -279,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
279 { 301 {
280 string assetID = "j2kCache_" + AssetId.ToString(); 302 string assetID = "j2kCache_" + AssetId.ToString();
281 303
282 AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_scene.RegionInfo.RegionID.ToString()); 304 AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_CreatorID.ToString());
283 layerDecodeAsset.Local = true; 305 layerDecodeAsset.Local = true;
284 layerDecodeAsset.Temporary = true; 306 layerDecodeAsset.Temporary = true;
285 307