One more module converted: J2KDecoderModule.

integration
Diva Canto 2012-11-10 08:10:43 -08:00
parent 86b22604fa
commit 791c4d5b9f
2 changed files with 33 additions and 10 deletions

View File

@ -45,7 +45,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
{
public delegate void J2KDecodeDelegate(UUID assetID);
public class J2KDecoderModule : IRegionModule, IJ2KDecoder
public class J2KDecoderModule : ISharedRegionModule, IJ2KDecoder
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -56,26 +56,21 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
/// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary>
private IImprovedAssetCache m_cache;
/// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary>
private UUID m_CreatorID = UUID.Zero;
private Scene m_scene;
#region IRegionModule
#region ISharedRegionModule
private bool m_useCSJ2K = true;
public string Name { get { return "J2KDecoderModule"; } }
public bool IsSharedModule { get { return true; } }
public J2KDecoderModule()
{
}
public void Initialise(Scene scene, IConfigSource source)
public void Initialise(IConfigSource source)
{
if (m_scene == null)
m_scene = scene;
scene.RegisterModuleInterface<IJ2KDecoder>(this);
IConfig startupConfig = source.Configs["Startup"];
if (startupConfig != null)
{
@ -83,6 +78,24 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
}
}
public void AddRegion(Scene scene)
{
if (m_scene == null)
{
m_scene = scene;
m_CreatorID = scene.RegionInfo.RegionID;
}
scene.RegisterModuleInterface<IJ2KDecoder>(this);
}
public void RemoveRegion(Scene scene)
{
if (m_scene == scene)
m_scene = null;
}
public void PostInitialise()
{
m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
@ -92,6 +105,15 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
{
}
public void RegionLoaded(Scene scene)
{
}
public Type ReplaceableInterface
{
get { return null; }
}
#endregion IRegionModule
#region IJ2KDecoder
@ -279,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
{
string assetID = "j2kCache_" + AssetId.ToString();
AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_scene.RegionInfo.RegionID.ToString());
AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_CreatorID.ToString());
layerDecodeAsset.Local = true;
layerDecodeAsset.Temporary = true;

View File

@ -43,6 +43,7 @@
<RegionModule id="MapSearchModule" type="OpenSim.Region.CoreModules.World.WorldMap.MapSearchModule"/>
<RegionModule id="VegetationModule" type="OpenSim.Region.CoreModules.Avatar.Vegetation.VegetationModule"/>
<RegionModule id="IPBanModule" type="OpenSim.Region.CoreModules.Agent.IPBan.IPBanModule"/>
<RegionModule id="J2KDecoderModule" type="OpenSim.Region.CoreModules.Agent.TextureSender.J2KDecoderModule"/>
<!-- Service connectors OUT modules -->
<RegionModule id="LocalAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.LocalAssetServicesConnector" />
<RegionModule id="RemoteAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.RemoteAssetServicesConnector" />