mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Move to file scoped namespaces.
This commit is contained in:
57
DVD/AACS.cs
57
DVD/AACS.cs
@@ -32,36 +32,35 @@
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class AACS
|
||||
{
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class AACS
|
||||
public struct HDLeadInCopyright
|
||||
{
|
||||
public struct HDLeadInCopyright
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to 2052 HD DVD Lead-In Copyright Information</summary>
|
||||
public byte[] CopyrightInformation;
|
||||
}
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to 2052 HD DVD Lead-In Copyright Information</summary>
|
||||
public byte[] CopyrightInformation;
|
||||
}
|
||||
}
|
||||
57
DVD/ADIP.cs
57
DVD/ADIP.cs
@@ -32,36 +32,35 @@
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class ADIP
|
||||
{
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class ADIP
|
||||
public struct ADIPInformation
|
||||
{
|
||||
public struct ADIPInformation
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to 259 ADIP, defined in DVD standards</summary>
|
||||
public byte[] ADIP;
|
||||
}
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to 259 ADIP, defined in DVD standards</summary>
|
||||
public byte[] ADIP;
|
||||
}
|
||||
}
|
||||
57
DVD/BCA.cs
57
DVD/BCA.cs
@@ -32,36 +32,35 @@
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class BCA
|
||||
{
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class BCA
|
||||
public struct BurstCuttingArea
|
||||
{
|
||||
public struct BurstCuttingArea
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to end Burst cutting area contents, 12 to 188 bytes</summary>
|
||||
public byte[] BCA;
|
||||
}
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to end Burst cutting area contents, 12 to 188 bytes</summary>
|
||||
public byte[] BCA;
|
||||
}
|
||||
}
|
||||
83
DVD/CPRM.cs
83
DVD/CPRM.cs
@@ -32,48 +32,47 @@
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
{
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class CPRM
|
||||
{
|
||||
public struct DiscMediaIdentifier
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to end Disc Media Identifier for CPRM</summary>
|
||||
public byte[] MediaIdentifier;
|
||||
}
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
public struct DiscMediaKeyBlock
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to end Disc Media Key Block for CPRM</summary>
|
||||
public byte[] MediaKeyBlock;
|
||||
}
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class CPRM
|
||||
{
|
||||
public struct DiscMediaIdentifier
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to end Disc Media Identifier for CPRM</summary>
|
||||
public byte[] MediaIdentifier;
|
||||
}
|
||||
|
||||
public struct DiscMediaKeyBlock
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to end Disc Media Key Block for CPRM</summary>
|
||||
public byte[] MediaKeyBlock;
|
||||
}
|
||||
}
|
||||
523
DVD/CSS&CPRM.cs
523
DVD/CSS&CPRM.cs
@@ -34,319 +34,318 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
|
||||
public static class CSS_CPRM
|
||||
{
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
|
||||
public static class CSS_CPRM
|
||||
public static LeadInCopyright? DecodeLeadInCopyright(byte[] response)
|
||||
{
|
||||
public static LeadInCopyright? DecodeLeadInCopyright(byte[] response)
|
||||
{
|
||||
if(response?.Length != 8)
|
||||
return null;
|
||||
if(response?.Length != 8)
|
||||
return null;
|
||||
|
||||
return new LeadInCopyright
|
||||
{
|
||||
DataLength = (ushort)((response[0] << 8) + response[1]),
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
CopyrightType = (CopyrightType)response[4],
|
||||
RegionInformation = response[5],
|
||||
Reserved3 = response[6],
|
||||
Reserved4 = response[7]
|
||||
};
|
||||
return new LeadInCopyright
|
||||
{
|
||||
DataLength = (ushort)((response[0] << 8) + response[1]),
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
CopyrightType = (CopyrightType)response[4],
|
||||
RegionInformation = response[5],
|
||||
Reserved3 = response[6],
|
||||
Reserved4 = response[7]
|
||||
};
|
||||
}
|
||||
|
||||
public static RegionalPlaybackControlState? DecodeRegionalPlaybackControlState(byte[] response)
|
||||
{
|
||||
if(response?.Length != 8)
|
||||
return null;
|
||||
|
||||
return new RegionalPlaybackControlState
|
||||
{
|
||||
DataLength = (ushort)((response[0] << 8) + response[1]),
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
TypeCode_VendorResetsAvailable_UserControlledChangesAvailable = response[4],
|
||||
RegionMask = response[5],
|
||||
RPCScheme = response[6],
|
||||
Reserved3 = response[7]
|
||||
};
|
||||
}
|
||||
|
||||
public static string PrettifyRegionalPlaybackControlState(RegionalPlaybackControlState? rpc)
|
||||
{
|
||||
if(rpc == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static RegionalPlaybackControlState? DecodeRegionalPlaybackControlState(byte[] response)
|
||||
{
|
||||
if(response?.Length != 8)
|
||||
return null;
|
||||
RegionalPlaybackControlState decoded = rpc.Value;
|
||||
var sb = new StringBuilder();
|
||||
|
||||
return new RegionalPlaybackControlState
|
||||
{
|
||||
DataLength = (ushort)((response[0] << 8) + response[1]),
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
TypeCode_VendorResetsAvailable_UserControlledChangesAvailable = response[4],
|
||||
RegionMask = response[5],
|
||||
RPCScheme = response[6],
|
||||
Reserved3 = response[7]
|
||||
};
|
||||
var typeCode =
|
||||
(TypeCode)((decoded.TypeCode_VendorResetsAvailable_UserControlledChangesAvailable & 0xc0) >> 6);
|
||||
|
||||
int vendorResets = (decoded.TypeCode_VendorResetsAvailable_UserControlledChangesAvailable & 0x38) >> 3;
|
||||
|
||||
int userControlledChanges = decoded.TypeCode_VendorResetsAvailable_UserControlledChangesAvailable & 0x7;
|
||||
|
||||
switch(typeCode)
|
||||
{
|
||||
case TypeCode.None:
|
||||
sb.AppendLine("No drive region setting.");
|
||||
|
||||
break;
|
||||
case TypeCode.Set:
|
||||
sb.AppendLine("Drive region is set.");
|
||||
|
||||
break;
|
||||
case TypeCode.LastChance:
|
||||
sb.AppendLine("Drive region is set, with additional restrictions required to make a change.");
|
||||
|
||||
break;
|
||||
case TypeCode.Perm:
|
||||
sb.AppendLine("Drive region has been set permanently, but may be reset by the vendor if necessary.");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
public static string PrettifyRegionalPlaybackControlState(RegionalPlaybackControlState? rpc)
|
||||
sb.AppendLine($"Drive has {vendorResets} vendor resets available.");
|
||||
sb.AppendLine($"Drive has {userControlledChanges} user controlled changes available.");
|
||||
|
||||
if(decoded.RegionMask == 0xFF)
|
||||
sb.AppendLine("Drive has no region set.");
|
||||
else if(decoded.RegionMask == 0x00)
|
||||
sb.AppendLine("Drive is region free.");
|
||||
else
|
||||
{
|
||||
if(rpc == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
sb.Append("Drive has the following regions set:");
|
||||
|
||||
RegionalPlaybackControlState decoded = rpc.Value;
|
||||
var sb = new StringBuilder();
|
||||
if((decoded.RegionMask & 0x01) != 0x01)
|
||||
sb.Append(" 1");
|
||||
|
||||
var typeCode =
|
||||
(TypeCode)((decoded.TypeCode_VendorResetsAvailable_UserControlledChangesAvailable & 0xc0) >> 6);
|
||||
if((decoded.RegionMask & 0x02) != 0x02)
|
||||
sb.Append(" 2");
|
||||
|
||||
int vendorResets = (decoded.TypeCode_VendorResetsAvailable_UserControlledChangesAvailable & 0x38) >> 3;
|
||||
if((decoded.RegionMask & 0x04) != 0x04)
|
||||
sb.Append(" 3");
|
||||
|
||||
int userControlledChanges = decoded.TypeCode_VendorResetsAvailable_UserControlledChangesAvailable & 0x7;
|
||||
if((decoded.RegionMask & 0x08) != 0x08)
|
||||
sb.Append(" 4");
|
||||
|
||||
switch(typeCode)
|
||||
{
|
||||
case TypeCode.None:
|
||||
sb.AppendLine("No drive region setting.");
|
||||
if((decoded.RegionMask & 0x10) != 0x10)
|
||||
sb.Append(" 5");
|
||||
|
||||
break;
|
||||
case TypeCode.Set:
|
||||
sb.AppendLine("Drive region is set.");
|
||||
if((decoded.RegionMask & 0x20) != 0x20)
|
||||
sb.Append(" 6");
|
||||
|
||||
break;
|
||||
case TypeCode.LastChance:
|
||||
sb.AppendLine("Drive region is set, with additional restrictions required to make a change.");
|
||||
if((decoded.RegionMask & 0x40) != 0x40)
|
||||
sb.Append(" 7");
|
||||
|
||||
break;
|
||||
case TypeCode.Perm:
|
||||
sb.AppendLine("Drive region has been set permanently, but may be reset by the vendor if necessary.");
|
||||
if((decoded.RegionMask & 0x80) != 0x80)
|
||||
sb.Append(" 8");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
sb.AppendLine("");
|
||||
|
||||
sb.AppendLine($"Drive has {vendorResets} vendor resets available.");
|
||||
sb.AppendLine($"Drive has {userControlledChanges} user controlled changes available.");
|
||||
switch(decoded.RPCScheme)
|
||||
{
|
||||
case 0x00:
|
||||
sb.AppendLine("The Logical Unit does not enforce Region Playback Controls (RPC).");
|
||||
|
||||
if(decoded.RegionMask == 0xFF)
|
||||
sb.AppendLine("Drive has no region set.");
|
||||
else if(decoded.RegionMask == 0x00)
|
||||
sb.AppendLine("Drive is region free.");
|
||||
else
|
||||
{
|
||||
sb.Append("Drive has the following regions set:");
|
||||
break;
|
||||
case 0x01:
|
||||
sb.AppendLine("The Logical Unit shall adhere to the specification and all requirements of the CSS license agreement concerning RPC.");
|
||||
|
||||
if((decoded.RegionMask & 0x01) != 0x01)
|
||||
sb.Append(" 1");
|
||||
break;
|
||||
default:
|
||||
sb.AppendLine("The Logical Unit uses an unknown region enforcement scheme.");
|
||||
|
||||
if((decoded.RegionMask & 0x02) != 0x02)
|
||||
sb.Append(" 2");
|
||||
break;
|
||||
}
|
||||
|
||||
if((decoded.RegionMask & 0x04) != 0x04)
|
||||
sb.Append(" 3");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
if((decoded.RegionMask & 0x08) != 0x08)
|
||||
sb.Append(" 4");
|
||||
public static string PrettifyRegionalPlaybackControlState(byte[] response) =>
|
||||
PrettifyRegionalPlaybackControlState(DecodeRegionalPlaybackControlState(response));
|
||||
|
||||
if((decoded.RegionMask & 0x10) != 0x10)
|
||||
sb.Append(" 5");
|
||||
public static string PrettifyLeadInCopyright(LeadInCopyright? cmi)
|
||||
{
|
||||
if(cmi == null)
|
||||
return null;
|
||||
|
||||
if((decoded.RegionMask & 0x20) != 0x20)
|
||||
sb.Append(" 6");
|
||||
LeadInCopyright decoded = cmi.Value;
|
||||
var sb = new StringBuilder();
|
||||
|
||||
if((decoded.RegionMask & 0x40) != 0x40)
|
||||
sb.Append(" 7");
|
||||
switch(decoded.CopyrightType)
|
||||
{
|
||||
case CopyrightType.NoProtection:
|
||||
sb.AppendLine("Disc has no encryption.");
|
||||
|
||||
if((decoded.RegionMask & 0x80) != 0x80)
|
||||
sb.Append(" 8");
|
||||
}
|
||||
break;
|
||||
case CopyrightType.CSS:
|
||||
sb.AppendLine("Disc is encrypted using CSS or CPPM.");
|
||||
|
||||
sb.AppendLine("");
|
||||
break;
|
||||
case CopyrightType.CPRM:
|
||||
sb.AppendLine("Disc is encrypted using CPRM.");
|
||||
|
||||
switch(decoded.RPCScheme)
|
||||
{
|
||||
case 0x00:
|
||||
sb.AppendLine("The Logical Unit does not enforce Region Playback Controls (RPC).");
|
||||
break;
|
||||
case CopyrightType.AACS:
|
||||
sb.AppendLine("Disc is encrypted using AACS.");
|
||||
|
||||
break;
|
||||
case 0x01:
|
||||
sb.AppendLine("The Logical Unit shall adhere to the specification and all requirements of the CSS license agreement concerning RPC.");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Disc is encrypted using unknown algorithm with ID {0}.", decoded.CopyrightType);
|
||||
|
||||
break;
|
||||
default:
|
||||
sb.AppendLine("The Logical Unit uses an unknown region enforcement scheme.");
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(decoded.CopyrightType == 0)
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string PrettifyRegionalPlaybackControlState(byte[] response) =>
|
||||
PrettifyRegionalPlaybackControlState(DecodeRegionalPlaybackControlState(response));
|
||||
|
||||
public static string PrettifyLeadInCopyright(LeadInCopyright? cmi)
|
||||
if(decoded.RegionInformation == 0xFF)
|
||||
sb.AppendLine("Disc cannot be played in any region at all.");
|
||||
else if(decoded.RegionInformation == 0x00)
|
||||
sb.AppendLine("Disc can be played in any region.");
|
||||
else
|
||||
{
|
||||
if(cmi == null)
|
||||
return null;
|
||||
sb.Append("Disc can be played in the following regions:");
|
||||
|
||||
LeadInCopyright decoded = cmi.Value;
|
||||
var sb = new StringBuilder();
|
||||
if((decoded.RegionInformation & 0x01) != 0x01)
|
||||
sb.Append(" 1");
|
||||
|
||||
switch(decoded.CopyrightType)
|
||||
{
|
||||
case CopyrightType.NoProtection:
|
||||
sb.AppendLine("Disc has no encryption.");
|
||||
if((decoded.RegionInformation & 0x02) != 0x02)
|
||||
sb.Append(" 2");
|
||||
|
||||
break;
|
||||
case CopyrightType.CSS:
|
||||
sb.AppendLine("Disc is encrypted using CSS or CPPM.");
|
||||
if((decoded.RegionInformation & 0x04) != 0x04)
|
||||
sb.Append(" 3");
|
||||
|
||||
break;
|
||||
case CopyrightType.CPRM:
|
||||
sb.AppendLine("Disc is encrypted using CPRM.");
|
||||
if((decoded.RegionInformation & 0x08) != 0x08)
|
||||
sb.Append(" 4");
|
||||
|
||||
break;
|
||||
case CopyrightType.AACS:
|
||||
sb.AppendLine("Disc is encrypted using AACS.");
|
||||
if((decoded.RegionInformation & 0x10) != 0x10)
|
||||
sb.Append(" 5");
|
||||
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Disc is encrypted using unknown algorithm with ID {0}.", decoded.CopyrightType);
|
||||
if((decoded.RegionInformation & 0x20) != 0x20)
|
||||
sb.Append(" 6");
|
||||
|
||||
break;
|
||||
}
|
||||
if((decoded.RegionInformation & 0x40) != 0x40)
|
||||
sb.Append(" 7");
|
||||
|
||||
if(decoded.CopyrightType == 0)
|
||||
return sb.ToString();
|
||||
|
||||
if(decoded.RegionInformation == 0xFF)
|
||||
sb.AppendLine("Disc cannot be played in any region at all.");
|
||||
else if(decoded.RegionInformation == 0x00)
|
||||
sb.AppendLine("Disc can be played in any region.");
|
||||
else
|
||||
{
|
||||
sb.Append("Disc can be played in the following regions:");
|
||||
|
||||
if((decoded.RegionInformation & 0x01) != 0x01)
|
||||
sb.Append(" 1");
|
||||
|
||||
if((decoded.RegionInformation & 0x02) != 0x02)
|
||||
sb.Append(" 2");
|
||||
|
||||
if((decoded.RegionInformation & 0x04) != 0x04)
|
||||
sb.Append(" 3");
|
||||
|
||||
if((decoded.RegionInformation & 0x08) != 0x08)
|
||||
sb.Append(" 4");
|
||||
|
||||
if((decoded.RegionInformation & 0x10) != 0x10)
|
||||
sb.Append(" 5");
|
||||
|
||||
if((decoded.RegionInformation & 0x20) != 0x20)
|
||||
sb.Append(" 6");
|
||||
|
||||
if((decoded.RegionInformation & 0x40) != 0x40)
|
||||
sb.Append(" 7");
|
||||
|
||||
if((decoded.RegionInformation & 0x80) != 0x80)
|
||||
sb.Append(" 8");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
if((decoded.RegionInformation & 0x80) != 0x80)
|
||||
sb.Append(" 8");
|
||||
}
|
||||
|
||||
public static string PrettifyLeadInCopyright(byte[] response) =>
|
||||
PrettifyLeadInCopyright(DecodeLeadInCopyright(response));
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public struct LeadInCopyright
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 Copy protection system type</summary>
|
||||
public CopyrightType CopyrightType;
|
||||
/// <summary>Byte 5 Bitmask of regions where this disc is playable</summary>
|
||||
public byte RegionInformation;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 7 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
}
|
||||
public static string PrettifyLeadInCopyright(byte[] response) =>
|
||||
PrettifyLeadInCopyright(DecodeLeadInCopyright(response));
|
||||
|
||||
public struct DiscKey
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to 2052 Disc key for CSS, Album Identifier for CPPM</summary>
|
||||
public byte[] Key;
|
||||
}
|
||||
public struct LeadInCopyright
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 Copy protection system type</summary>
|
||||
public CopyrightType CopyrightType;
|
||||
/// <summary>Byte 5 Bitmask of regions where this disc is playable</summary>
|
||||
public byte RegionInformation;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 7 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
}
|
||||
|
||||
public struct TitleKey
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 CPM</summary>
|
||||
public byte CMI;
|
||||
/// <summary>Bytes 5 to 10 Title key for CSS</summary>
|
||||
public byte[] Key;
|
||||
/// <summary>Byte 11 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 12 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
}
|
||||
public struct DiscKey
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to 2052 Disc key for CSS, Album Identifier for CPPM</summary>
|
||||
public byte[] Key;
|
||||
}
|
||||
|
||||
public struct AuthenticationSuccessFlag
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 5 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved5;
|
||||
/// <summary>Byte 7 Reserved and ASF</summary>
|
||||
public byte ASF;
|
||||
}
|
||||
public struct TitleKey
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 CPM</summary>
|
||||
public byte CMI;
|
||||
/// <summary>Bytes 5 to 10 Title key for CSS</summary>
|
||||
public byte[] Key;
|
||||
/// <summary>Byte 11 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 12 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
}
|
||||
|
||||
public struct RegionalPlaybackControlState
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 Type Code and # of Vendor Resets Available and # of User Controlled Changes Available</summary>
|
||||
public byte TypeCode_VendorResetsAvailable_UserControlledChangesAvailable;
|
||||
/// <summary>Byte 5 Region Mask</summary>
|
||||
public byte RegionMask;
|
||||
/// <summary>Byte 6 RPC Scheme</summary>
|
||||
public byte RPCScheme;
|
||||
/// <summary>Byte 7 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
}
|
||||
public struct AuthenticationSuccessFlag
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 5 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved5;
|
||||
/// <summary>Byte 7 Reserved and ASF</summary>
|
||||
public byte ASF;
|
||||
}
|
||||
|
||||
enum TypeCode
|
||||
{
|
||||
None = 0, Set = 1, LastChance = 2,
|
||||
Perm = 3
|
||||
}
|
||||
public struct RegionalPlaybackControlState
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 Type Code and # of Vendor Resets Available and # of User Controlled Changes Available</summary>
|
||||
public byte TypeCode_VendorResetsAvailable_UserControlledChangesAvailable;
|
||||
/// <summary>Byte 5 Region Mask</summary>
|
||||
public byte RegionMask;
|
||||
/// <summary>Byte 6 RPC Scheme</summary>
|
||||
public byte RPCScheme;
|
||||
/// <summary>Byte 7 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
}
|
||||
|
||||
enum TypeCode
|
||||
{
|
||||
None = 0, Set = 1, LastChance = 2,
|
||||
Perm = 3
|
||||
}
|
||||
}
|
||||
247
DVD/Cartridge.cs
247
DVD/Cartridge.cs
@@ -33,143 +33,142 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
|
||||
public static class Cartridge
|
||||
{
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
|
||||
public static class Cartridge
|
||||
public static MediumStatus? Decode(byte[] response)
|
||||
{
|
||||
public static MediumStatus? Decode(byte[] response)
|
||||
{
|
||||
if(response?.Length != 8)
|
||||
return null;
|
||||
if(response?.Length != 8)
|
||||
return null;
|
||||
|
||||
return new MediumStatus
|
||||
{
|
||||
DataLength = (ushort)((response[0] << 8) + response[1]),
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
Cartridge = (response[4] & 0x80) == 0x80,
|
||||
OUT = (response[4] & 0x40) == 0x40,
|
||||
Reserved3 = (byte)((response[4] & 0x30) >> 4),
|
||||
MSWI = (response[4] & 0x08) == 0x08,
|
||||
CWP = (response[4] & 0x04) == 0x04,
|
||||
PWP = (response[4] & 0x02) == 0x02,
|
||||
Reserved4 = (response[4] & 0x01) == 0x01,
|
||||
DiscType = response[5],
|
||||
Reserved5 = response[6],
|
||||
RAMSWI = response[7]
|
||||
};
|
||||
return new MediumStatus
|
||||
{
|
||||
DataLength = (ushort)((response[0] << 8) + response[1]),
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
Cartridge = (response[4] & 0x80) == 0x80,
|
||||
OUT = (response[4] & 0x40) == 0x40,
|
||||
Reserved3 = (byte)((response[4] & 0x30) >> 4),
|
||||
MSWI = (response[4] & 0x08) == 0x08,
|
||||
CWP = (response[4] & 0x04) == 0x04,
|
||||
PWP = (response[4] & 0x02) == 0x02,
|
||||
Reserved4 = (response[4] & 0x01) == 0x01,
|
||||
DiscType = response[5],
|
||||
Reserved5 = response[6],
|
||||
RAMSWI = response[7]
|
||||
};
|
||||
}
|
||||
|
||||
public static string Prettify(MediumStatus? status)
|
||||
{
|
||||
if(status == null)
|
||||
return null;
|
||||
|
||||
MediumStatus decoded = status.Value;
|
||||
var sb = new StringBuilder();
|
||||
|
||||
if(decoded.PWP)
|
||||
sb.AppendLine("Disc surface is set to write protected status");
|
||||
|
||||
if(decoded.Cartridge)
|
||||
{
|
||||
sb.AppendLine("Disc comes in a cartridge");
|
||||
|
||||
if(decoded.OUT)
|
||||
sb.AppendLine("Disc has been extracted from the cartridge");
|
||||
|
||||
if(decoded.CWP)
|
||||
sb.AppendLine("Cartridge is set to write protected");
|
||||
}
|
||||
|
||||
public static string Prettify(MediumStatus? status)
|
||||
switch(decoded.DiscType)
|
||||
{
|
||||
if(status == null)
|
||||
return null;
|
||||
case 0:
|
||||
sb.AppendLine("Disc shall not be written without a cartridge");
|
||||
|
||||
MediumStatus decoded = status.Value;
|
||||
var sb = new StringBuilder();
|
||||
break;
|
||||
case 0x10:
|
||||
sb.AppendLine("Disc may be written without a cartridge");
|
||||
|
||||
if(decoded.PWP)
|
||||
sb.AppendLine("Disc surface is set to write protected status");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Unknown disc type id {0}", decoded.DiscType).AppendLine();
|
||||
|
||||
if(decoded.Cartridge)
|
||||
{
|
||||
sb.AppendLine("Disc comes in a cartridge");
|
||||
|
||||
if(decoded.OUT)
|
||||
sb.AppendLine("Disc has been extracted from the cartridge");
|
||||
|
||||
if(decoded.CWP)
|
||||
sb.AppendLine("Cartridge is set to write protected");
|
||||
}
|
||||
|
||||
switch(decoded.DiscType)
|
||||
{
|
||||
case 0:
|
||||
sb.AppendLine("Disc shall not be written without a cartridge");
|
||||
|
||||
break;
|
||||
case 0x10:
|
||||
sb.AppendLine("Disc may be written without a cartridge");
|
||||
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Unknown disc type id {0}", decoded.DiscType).AppendLine();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if(!decoded.MSWI)
|
||||
return sb.ToString();
|
||||
|
||||
switch(decoded.RAMSWI)
|
||||
{
|
||||
case 0: break;
|
||||
case 1:
|
||||
sb.AppendLine("Disc is write inhibited because it has been extracted from the cartridge");
|
||||
|
||||
break;
|
||||
case 0xFF:
|
||||
sb.AppendLine("Disc is write inhibited for an unspecified reason");
|
||||
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Disc has unknown reason {0} for write inhibition", decoded.RAMSWI).AppendLine();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(!decoded.MSWI)
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string Prettify(byte[] response) => Prettify(Decode(response));
|
||||
|
||||
public struct MediumStatus
|
||||
switch(decoded.RAMSWI)
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4, bit 7 Medium is in a cartridge</summary>
|
||||
public bool Cartridge;
|
||||
/// <summary>Byte 4, bit 6 Medium has been taken out/inserted in a cartridge</summary>
|
||||
public bool OUT;
|
||||
/// <summary>Byte 4, bits 5 to 4 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 4, bit 3 Media is write protected by reason stablished in RAMSWI</summary>
|
||||
public bool MSWI;
|
||||
/// <summary>Byte 4, bit 2 Media is write protected by cartridge</summary>
|
||||
public bool CWP;
|
||||
/// <summary>Byte 4, bit 1 Media is persistently write protected</summary>
|
||||
public bool PWP;
|
||||
/// <summary>Byte 4, bit 0 Reserved</summary>
|
||||
public bool Reserved4;
|
||||
/// <summary>Byte 5 Writable status depending on cartridge</summary>
|
||||
public byte DiscType;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved5;
|
||||
/// <summary>
|
||||
/// Byte 7 Reason of specific write protection, only defined 0x01 as "bare disc wp", and 0xFF as unspecified. Rest
|
||||
/// reserved.
|
||||
/// </summary>
|
||||
public byte RAMSWI;
|
||||
case 0: break;
|
||||
case 1:
|
||||
sb.AppendLine("Disc is write inhibited because it has been extracted from the cartridge");
|
||||
|
||||
break;
|
||||
case 0xFF:
|
||||
sb.AppendLine("Disc is write inhibited for an unspecified reason");
|
||||
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Disc has unknown reason {0} for write inhibition", decoded.RAMSWI).AppendLine();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string Prettify(byte[] response) => Prettify(Decode(response));
|
||||
|
||||
public struct MediumStatus
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4, bit 7 Medium is in a cartridge</summary>
|
||||
public bool Cartridge;
|
||||
/// <summary>Byte 4, bit 6 Medium has been taken out/inserted in a cartridge</summary>
|
||||
public bool OUT;
|
||||
/// <summary>Byte 4, bits 5 to 4 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 4, bit 3 Media is write protected by reason stablished in RAMSWI</summary>
|
||||
public bool MSWI;
|
||||
/// <summary>Byte 4, bit 2 Media is write protected by cartridge</summary>
|
||||
public bool CWP;
|
||||
/// <summary>Byte 4, bit 1 Media is persistently write protected</summary>
|
||||
public bool PWP;
|
||||
/// <summary>Byte 4, bit 0 Reserved</summary>
|
||||
public bool Reserved4;
|
||||
/// <summary>Byte 5 Writable status depending on cartridge</summary>
|
||||
public byte DiscType;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved5;
|
||||
/// <summary>
|
||||
/// Byte 7 Reason of specific write protection, only defined 0x01 as "bare disc wp", and 0xFF as unspecified. Rest
|
||||
/// reserved.
|
||||
/// </summary>
|
||||
public byte RAMSWI;
|
||||
}
|
||||
}
|
||||
367
DVD/DDS.cs
367
DVD/DDS.cs
@@ -34,218 +34,217 @@ using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 272: 120 mm DVD Rewritable Disk (DVD-RAM)
|
||||
// ECMA 330: 120 mm (4,7 Gbytes per side) and 80 mm (1,46 Gbytes per side) DVD Rewritable Disk (DVD-RAM)
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
|
||||
public static class DDS
|
||||
{
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 272: 120 mm DVD Rewritable Disk (DVD-RAM)
|
||||
// ECMA 330: 120 mm (4,7 Gbytes per side) and 80 mm (1,46 Gbytes per side) DVD Rewritable Disk (DVD-RAM)
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
|
||||
public static class DDS
|
||||
public static DiscDefinitionStructure? Decode(byte[] response)
|
||||
{
|
||||
public static DiscDefinitionStructure? Decode(byte[] response)
|
||||
if(response?.Length != 2052)
|
||||
return null;
|
||||
|
||||
var dds = new DiscDefinitionStructure
|
||||
{
|
||||
if(response?.Length != 2052)
|
||||
return null;
|
||||
Identifier = (ushort)((response[4] << 8) + response[5])
|
||||
};
|
||||
|
||||
var dds = new DiscDefinitionStructure
|
||||
if(dds.Identifier != 0x0A0A)
|
||||
return null;
|
||||
|
||||
// Common to both DVD-RAM versions
|
||||
dds.DataLength = (ushort)((response[0] << 8) + response[1]);
|
||||
dds.Reserved1 = response[2];
|
||||
dds.Reserved2 = response[3];
|
||||
dds.Reserved3 = response[6];
|
||||
dds.InProcess |= (response[7] & 0x80) == 0x80;
|
||||
dds.UserCertification |= (response[7] & 0x02) == 0x02;
|
||||
dds.ManufacturerCertification |= (response[7] & 0x01) == 0x01;
|
||||
|
||||
dds.UpdateCount = (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
|
||||
|
||||
dds.Groups = (ushort)((response[12] << 8) + response[13]);
|
||||
|
||||
// ECMA-272
|
||||
if(dds.Groups == 24)
|
||||
{
|
||||
dds.PartialCertification |= (response[7] & 0x40) == 0x40;
|
||||
dds.FormattingOnlyAGroup |= (response[7] & 0x20) == 0x20;
|
||||
dds.Reserved4 = (byte)((response[7] & 0x1C) >> 2);
|
||||
dds.Reserved = new byte[6];
|
||||
Array.Copy(response, 14, dds.Reserved, 0, 6);
|
||||
dds.GroupCertificationFlags = new GroupCertificationFlag[24];
|
||||
|
||||
for(int i = 0; i < 24; i++)
|
||||
{
|
||||
Identifier = (ushort)((response[4] << 8) + response[5])
|
||||
};
|
||||
|
||||
if(dds.Identifier != 0x0A0A)
|
||||
return null;
|
||||
|
||||
// Common to both DVD-RAM versions
|
||||
dds.DataLength = (ushort)((response[0] << 8) + response[1]);
|
||||
dds.Reserved1 = response[2];
|
||||
dds.Reserved2 = response[3];
|
||||
dds.Reserved3 = response[6];
|
||||
dds.InProcess |= (response[7] & 0x80) == 0x80;
|
||||
dds.UserCertification |= (response[7] & 0x02) == 0x02;
|
||||
dds.ManufacturerCertification |= (response[7] & 0x01) == 0x01;
|
||||
|
||||
dds.UpdateCount = (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
|
||||
|
||||
dds.Groups = (ushort)((response[12] << 8) + response[13]);
|
||||
|
||||
// ECMA-272
|
||||
if(dds.Groups == 24)
|
||||
{
|
||||
dds.PartialCertification |= (response[7] & 0x40) == 0x40;
|
||||
dds.FormattingOnlyAGroup |= (response[7] & 0x20) == 0x20;
|
||||
dds.Reserved4 = (byte)((response[7] & 0x1C) >> 2);
|
||||
dds.Reserved = new byte[6];
|
||||
Array.Copy(response, 14, dds.Reserved, 0, 6);
|
||||
dds.GroupCertificationFlags = new GroupCertificationFlag[24];
|
||||
|
||||
for(int i = 0; i < 24; i++)
|
||||
{
|
||||
dds.GroupCertificationFlags[i].InProcess |= (response[20 + i] & 0x80) == 0x80;
|
||||
dds.GroupCertificationFlags[i].PartialCertification |= (response[20 + i] & 0x40) == 0x40;
|
||||
dds.GroupCertificationFlags[i].Reserved1 = (byte)((response[20 + i] & 0x3C) >> 2);
|
||||
dds.GroupCertificationFlags[i].UserCertification |= (response[20 + i] & 0x02) == 0x02;
|
||||
dds.GroupCertificationFlags[i].Reserved2 |= (response[20 + i] & 0x01) == 0x01;
|
||||
}
|
||||
dds.GroupCertificationFlags[i].InProcess |= (response[20 + i] & 0x80) == 0x80;
|
||||
dds.GroupCertificationFlags[i].PartialCertification |= (response[20 + i] & 0x40) == 0x40;
|
||||
dds.GroupCertificationFlags[i].Reserved1 = (byte)((response[20 + i] & 0x3C) >> 2);
|
||||
dds.GroupCertificationFlags[i].UserCertification |= (response[20 + i] & 0x02) == 0x02;
|
||||
dds.GroupCertificationFlags[i].Reserved2 |= (response[20 + i] & 0x01) == 0x01;
|
||||
}
|
||||
|
||||
// ECMA-330
|
||||
if(dds.Groups != 1)
|
||||
return dds;
|
||||
|
||||
{
|
||||
dds.Reserved4 = (byte)((response[7] & 0x7C) >> 2);
|
||||
dds.Reserved = new byte[68];
|
||||
Array.Copy(response, 16, dds.Reserved, 0, 68);
|
||||
dds.Zones = (ushort)((response[14] << 8) + response[15]);
|
||||
dds.SpareAreaFirstPSN = (uint)((response[85] << 16) + (response[86] << 8) + response[87]);
|
||||
dds.SpareAreaLastPSN = (uint)((response[89] << 16) + (response[90] << 8) + response[91]);
|
||||
dds.LSN0Location = (uint)((response[93] << 16) + (response[94] << 8) + response[95]);
|
||||
dds.StartLSNForZone = new uint[dds.Zones];
|
||||
|
||||
for(int i = 0; i < dds.Zones; i++)
|
||||
dds.StartLSNForZone[i] = (uint)((response[260 + (i * 4) + 1] << 16) +
|
||||
(response[260 + (i * 4) + 2] << 8) + response[260 + (i * 4) + 3]);
|
||||
}
|
||||
|
||||
return dds;
|
||||
}
|
||||
|
||||
public static string Prettify(DiscDefinitionStructure? dds)
|
||||
// ECMA-330
|
||||
if(dds.Groups != 1)
|
||||
return dds;
|
||||
|
||||
{
|
||||
if(dds == null)
|
||||
return null;
|
||||
dds.Reserved4 = (byte)((response[7] & 0x7C) >> 2);
|
||||
dds.Reserved = new byte[68];
|
||||
Array.Copy(response, 16, dds.Reserved, 0, 68);
|
||||
dds.Zones = (ushort)((response[14] << 8) + response[15]);
|
||||
dds.SpareAreaFirstPSN = (uint)((response[85] << 16) + (response[86] << 8) + response[87]);
|
||||
dds.SpareAreaLastPSN = (uint)((response[89] << 16) + (response[90] << 8) + response[91]);
|
||||
dds.LSN0Location = (uint)((response[93] << 16) + (response[94] << 8) + response[95]);
|
||||
dds.StartLSNForZone = new uint[dds.Zones];
|
||||
|
||||
DiscDefinitionStructure decoded = dds.Value;
|
||||
var sb = new StringBuilder();
|
||||
for(int i = 0; i < dds.Zones; i++)
|
||||
dds.StartLSNForZone[i] = (uint)((response[260 + (i * 4) + 1] << 16) +
|
||||
(response[260 + (i * 4) + 2] << 8) + response[260 + (i * 4) + 3]);
|
||||
}
|
||||
|
||||
if(decoded.InProcess)
|
||||
{
|
||||
sb.AppendLine("Formatting in progress.");
|
||||
return dds;
|
||||
}
|
||||
|
||||
if(decoded.Groups == 24)
|
||||
{
|
||||
if(decoded.PartialCertification)
|
||||
sb.AppendLine("Formatting is only using partial certification");
|
||||
public static string Prettify(DiscDefinitionStructure? dds)
|
||||
{
|
||||
if(dds == null)
|
||||
return null;
|
||||
|
||||
if(decoded.FormattingOnlyAGroup)
|
||||
sb.AppendLine("Only a group is being formatted");
|
||||
}
|
||||
}
|
||||
DiscDefinitionStructure decoded = dds.Value;
|
||||
var sb = new StringBuilder();
|
||||
|
||||
if(decoded.UserCertification)
|
||||
sb.AppendLine("Disc has been certified by an user");
|
||||
|
||||
if(decoded.ManufacturerCertification)
|
||||
sb.AppendLine("Disc has been certified by a manufacturer");
|
||||
|
||||
sb.AppendFormat("DDS has been updated {0} times", decoded.UpdateCount).AppendLine();
|
||||
if(decoded.InProcess)
|
||||
{
|
||||
sb.AppendLine("Formatting in progress.");
|
||||
|
||||
if(decoded.Groups == 24)
|
||||
for(int i = 0; i < decoded.GroupCertificationFlags.Length; i++)
|
||||
{
|
||||
if(decoded.PartialCertification)
|
||||
sb.AppendLine("Formatting is only using partial certification");
|
||||
|
||||
if(decoded.FormattingOnlyAGroup)
|
||||
sb.AppendLine("Only a group is being formatted");
|
||||
}
|
||||
}
|
||||
|
||||
if(decoded.UserCertification)
|
||||
sb.AppendLine("Disc has been certified by an user");
|
||||
|
||||
if(decoded.ManufacturerCertification)
|
||||
sb.AppendLine("Disc has been certified by a manufacturer");
|
||||
|
||||
sb.AppendFormat("DDS has been updated {0} times", decoded.UpdateCount).AppendLine();
|
||||
|
||||
if(decoded.Groups == 24)
|
||||
for(int i = 0; i < decoded.GroupCertificationFlags.Length; i++)
|
||||
{
|
||||
if(decoded.GroupCertificationFlags[i].InProcess)
|
||||
{
|
||||
if(decoded.GroupCertificationFlags[i].InProcess)
|
||||
{
|
||||
sb.AppendFormat("Group {0} is being formatted", i).AppendLine();
|
||||
sb.AppendFormat("Group {0} is being formatted", i).AppendLine();
|
||||
|
||||
if(decoded.GroupCertificationFlags[i].PartialCertification)
|
||||
sb.AppendFormat("Group {0} is being certified partially", i).AppendLine();
|
||||
}
|
||||
|
||||
if(decoded.GroupCertificationFlags[i].UserCertification)
|
||||
sb.AppendFormat("Group {0} has been certified by an user", i).AppendLine();
|
||||
if(decoded.GroupCertificationFlags[i].PartialCertification)
|
||||
sb.AppendFormat("Group {0} is being certified partially", i).AppendLine();
|
||||
}
|
||||
|
||||
if(decoded.Groups != 1)
|
||||
return sb.ToString();
|
||||
|
||||
{
|
||||
sb.AppendFormat("Disc has {0} zones", decoded.Zones).AppendLine();
|
||||
|
||||
sb.AppendFormat("Primary Spare Area stats at PSN {0:X}h and ends at PSN {1:X}h, inclusively",
|
||||
decoded.SpareAreaFirstPSN, decoded.SpareAreaLastPSN).AppendLine();
|
||||
|
||||
sb.AppendFormat("LSN 0 is at PSN {0:X}h", decoded.LSN0Location).AppendLine();
|
||||
|
||||
for(int i = 0; i < decoded.StartLSNForZone.Length; i++)
|
||||
sb.AppendFormat("Zone {0} starts at LSN {1}", i, decoded.StartLSNForZone[i]).AppendLine();
|
||||
if(decoded.GroupCertificationFlags[i].UserCertification)
|
||||
sb.AppendFormat("Group {0} has been certified by an user", i).AppendLine();
|
||||
}
|
||||
|
||||
if(decoded.Groups != 1)
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string Prettify(byte[] response) => Prettify(Decode(response));
|
||||
|
||||
public struct DiscDefinitionStructure
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
sb.AppendFormat("Disc has {0} zones", decoded.Zones).AppendLine();
|
||||
|
||||
/// <summary>Bytes 4 to 5 DDS Identifier = 0x0A0A</summary>
|
||||
public ushort Identifier;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 7, bit 7 If set, formatting is in process</summary>
|
||||
public bool InProcess;
|
||||
/// <summary>Byte 7, bit 6 If set, formatting is using partial certification Only in ECMA-272</summary>
|
||||
public bool PartialCertification;
|
||||
/// <summary>Byte 7, bit 5 If set, only a group is being formatted Only in ECMA-272</summary>
|
||||
public bool FormattingOnlyAGroup;
|
||||
/// <summary>Byte 7, bits 4 to 2 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Byte 7, bit 1 If set, disk has been certified by a user</summary>
|
||||
public bool UserCertification;
|
||||
/// <summary>Byte 7, bit 0 If set, disk has been certified by a manufacturer</summary>
|
||||
public bool ManufacturerCertification;
|
||||
/// <summary>Bytes 8 to 11 How many times the DDS has been updated</summary>
|
||||
public uint UpdateCount;
|
||||
/// <summary>Bytes 12 to 13 How many groups the disk has 24 for ECMA-272 1 for ECMA-330</summary>
|
||||
public ushort Groups;
|
||||
/// <summary>Bytes 14 to 15 How many zones the disk has Only in ECMA-330</summary>
|
||||
public ushort Zones;
|
||||
/// <summary>Bytes 14 to 19 in ECMA-272 Bytes 16 to 83 in ECMA-330 Reserved</summary>
|
||||
public byte[] Reserved;
|
||||
/// <summary>Bytes 20 to 43 Group certification flags</summary>
|
||||
public GroupCertificationFlag[] GroupCertificationFlags;
|
||||
sb.AppendFormat("Primary Spare Area stats at PSN {0:X}h and ends at PSN {1:X}h, inclusively",
|
||||
decoded.SpareAreaFirstPSN, decoded.SpareAreaLastPSN).AppendLine();
|
||||
|
||||
/// <summary>Bytes 85 to 87 Location of first sector in the Primary Spare Area</summary>
|
||||
public uint SpareAreaFirstPSN;
|
||||
/// <summary>Bytes 89 to 91 Location of first sector in the Primary Spare Area</summary>
|
||||
public uint SpareAreaLastPSN;
|
||||
/// <summary>Bytes 93 to 95 PSN for LSN 0</summary>
|
||||
public uint LSN0Location;
|
||||
/// <summary>The starting LSN of each zone</summary>
|
||||
public uint[] StartLSNForZone;
|
||||
sb.AppendFormat("LSN 0 is at PSN {0:X}h", decoded.LSN0Location).AppendLine();
|
||||
|
||||
for(int i = 0; i < decoded.StartLSNForZone.Length; i++)
|
||||
sb.AppendFormat("Zone {0} starts at LSN {1}", i, decoded.StartLSNForZone[i]).AppendLine();
|
||||
}
|
||||
|
||||
public struct GroupCertificationFlag
|
||||
{
|
||||
/// <summary>Bit 7 If set, formatting of this group is in process</summary>
|
||||
public bool InProcess;
|
||||
/// <summary>Bit 6 If set, formatting is using partial certification</summary>
|
||||
public bool PartialCertification;
|
||||
/// <summary>Bits 5 to 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Bit 1 If set, this group has been certified by user</summary>
|
||||
public bool UserCertification;
|
||||
/// <summary>Bit 0 Reserved</summary>
|
||||
public bool Reserved2;
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string Prettify(byte[] response) => Prettify(Decode(response));
|
||||
|
||||
public struct DiscDefinitionStructure
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
|
||||
/// <summary>Bytes 4 to 5 DDS Identifier = 0x0A0A</summary>
|
||||
public ushort Identifier;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 7, bit 7 If set, formatting is in process</summary>
|
||||
public bool InProcess;
|
||||
/// <summary>Byte 7, bit 6 If set, formatting is using partial certification Only in ECMA-272</summary>
|
||||
public bool PartialCertification;
|
||||
/// <summary>Byte 7, bit 5 If set, only a group is being formatted Only in ECMA-272</summary>
|
||||
public bool FormattingOnlyAGroup;
|
||||
/// <summary>Byte 7, bits 4 to 2 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Byte 7, bit 1 If set, disk has been certified by a user</summary>
|
||||
public bool UserCertification;
|
||||
/// <summary>Byte 7, bit 0 If set, disk has been certified by a manufacturer</summary>
|
||||
public bool ManufacturerCertification;
|
||||
/// <summary>Bytes 8 to 11 How many times the DDS has been updated</summary>
|
||||
public uint UpdateCount;
|
||||
/// <summary>Bytes 12 to 13 How many groups the disk has 24 for ECMA-272 1 for ECMA-330</summary>
|
||||
public ushort Groups;
|
||||
/// <summary>Bytes 14 to 15 How many zones the disk has Only in ECMA-330</summary>
|
||||
public ushort Zones;
|
||||
/// <summary>Bytes 14 to 19 in ECMA-272 Bytes 16 to 83 in ECMA-330 Reserved</summary>
|
||||
public byte[] Reserved;
|
||||
/// <summary>Bytes 20 to 43 Group certification flags</summary>
|
||||
public GroupCertificationFlag[] GroupCertificationFlags;
|
||||
|
||||
/// <summary>Bytes 85 to 87 Location of first sector in the Primary Spare Area</summary>
|
||||
public uint SpareAreaFirstPSN;
|
||||
/// <summary>Bytes 89 to 91 Location of first sector in the Primary Spare Area</summary>
|
||||
public uint SpareAreaLastPSN;
|
||||
/// <summary>Bytes 93 to 95 PSN for LSN 0</summary>
|
||||
public uint LSN0Location;
|
||||
/// <summary>The starting LSN of each zone</summary>
|
||||
public uint[] StartLSNForZone;
|
||||
}
|
||||
|
||||
public struct GroupCertificationFlag
|
||||
{
|
||||
/// <summary>Bit 7 If set, formatting of this group is in process</summary>
|
||||
public bool InProcess;
|
||||
/// <summary>Bit 6 If set, formatting is using partial certification</summary>
|
||||
public bool PartialCertification;
|
||||
/// <summary>Bits 5 to 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Bit 1 If set, this group has been certified by user</summary>
|
||||
public bool UserCertification;
|
||||
/// <summary>Bit 0 Reserved</summary>
|
||||
public bool Reserved2;
|
||||
}
|
||||
}
|
||||
57
DVD/DMI.cs
57
DVD/DMI.cs
@@ -32,36 +32,35 @@
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class DMI
|
||||
{
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class DMI
|
||||
public struct DiscManufacturingInformation
|
||||
{
|
||||
public struct DiscManufacturingInformation
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to 2052 Disc Manufacturing Information</summary>
|
||||
public byte[] DMI;
|
||||
}
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to 2052 Disc Manufacturing Information</summary>
|
||||
public byte[] DMI;
|
||||
}
|
||||
}
|
||||
273
DVD/Enums.cs
273
DVD/Enums.cs
@@ -32,151 +32,150 @@
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
#region Public enumerations
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DiskCategory : byte
|
||||
{
|
||||
#region Public enumerations
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DiskCategory : byte
|
||||
{
|
||||
/// <summary>DVD-ROM. Version 1 is ECMA-267 and ECMA-268.</summary>
|
||||
DVDROM = 0,
|
||||
/// <summary>DVD-RAM. Version 1 is ECMA-272. Version 6 is ECMA-330.</summary>
|
||||
DVDRAM = 1,
|
||||
/// <summary>DVD-R. Version 1 is ECMA-279. Version 5 is ECMA-359. Version 6 is ECMA-382.</summary>
|
||||
DVDR = 2,
|
||||
/// <summary>DVD-RW. Version 2 is ECMA-338. Version 3 is ECMA-384.</summary>
|
||||
DVDRW = 3,
|
||||
/// <summary>HD DVD-ROM</summary>
|
||||
HDDVDROM = 4,
|
||||
/// <summary>HD DVD-RAM</summary>
|
||||
HDDVDRAM = 5,
|
||||
/// <summary>HD DVD-R</summary>
|
||||
HDDVDR = 6,
|
||||
/// <summary>HD DVD-RW</summary>
|
||||
HDDVDRW = 7,
|
||||
/// <summary>UMD. Version 0 is ECMA-365.</summary>
|
||||
UMD = 8,
|
||||
/// <summary>DVD+RW. Version 1 is ECMA-274. Version 2 is ECMA-337. Version 3 is ECMA-371.</summary>
|
||||
DVDPRW = 9,
|
||||
/// <summary>DVD+R. Version 1 is ECMA-349.</summary>
|
||||
DVDPR = 10,
|
||||
/// <summary>DVD+RW DL. Version 1 is ECMA-374.</summary>
|
||||
DVDPRWDL = 13,
|
||||
/// <summary>DVD+R DL. Version 1 is ECMA-364.</summary>
|
||||
DVDPRDL = 14,
|
||||
/// <summary>According to standards this value is reserved. It's used by Nintendo GODs and WODs.</summary>
|
||||
Nintendo = 15
|
||||
}
|
||||
/// <summary>DVD-ROM. Version 1 is ECMA-267 and ECMA-268.</summary>
|
||||
DVDROM = 0,
|
||||
/// <summary>DVD-RAM. Version 1 is ECMA-272. Version 6 is ECMA-330.</summary>
|
||||
DVDRAM = 1,
|
||||
/// <summary>DVD-R. Version 1 is ECMA-279. Version 5 is ECMA-359. Version 6 is ECMA-382.</summary>
|
||||
DVDR = 2,
|
||||
/// <summary>DVD-RW. Version 2 is ECMA-338. Version 3 is ECMA-384.</summary>
|
||||
DVDRW = 3,
|
||||
/// <summary>HD DVD-ROM</summary>
|
||||
HDDVDROM = 4,
|
||||
/// <summary>HD DVD-RAM</summary>
|
||||
HDDVDRAM = 5,
|
||||
/// <summary>HD DVD-R</summary>
|
||||
HDDVDR = 6,
|
||||
/// <summary>HD DVD-RW</summary>
|
||||
HDDVDRW = 7,
|
||||
/// <summary>UMD. Version 0 is ECMA-365.</summary>
|
||||
UMD = 8,
|
||||
/// <summary>DVD+RW. Version 1 is ECMA-274. Version 2 is ECMA-337. Version 3 is ECMA-371.</summary>
|
||||
DVDPRW = 9,
|
||||
/// <summary>DVD+R. Version 1 is ECMA-349.</summary>
|
||||
DVDPR = 10,
|
||||
/// <summary>DVD+RW DL. Version 1 is ECMA-374.</summary>
|
||||
DVDPRWDL = 13,
|
||||
/// <summary>DVD+R DL. Version 1 is ECMA-364.</summary>
|
||||
DVDPRDL = 14,
|
||||
/// <summary>According to standards this value is reserved. It's used by Nintendo GODs and WODs.</summary>
|
||||
Nintendo = 15
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum MaximumRateField : byte
|
||||
{
|
||||
/// <summary>2.52 Mbps</summary>
|
||||
TwoMbps = 0x00,
|
||||
/// <summary>5.04 Mbps</summary>
|
||||
FiveMbps = 0x01,
|
||||
/// <summary>10.08 Mbps</summary>
|
||||
TenMbps = 0x02,
|
||||
/// <summary>20.16 Mbps</summary>
|
||||
TwentyMbps = 0x03,
|
||||
/// <summary>30.24 Mbps</summary>
|
||||
ThirtyMbps = 0x04, Unspecified = 0x0F
|
||||
}
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum MaximumRateField : byte
|
||||
{
|
||||
/// <summary>2.52 Mbps</summary>
|
||||
TwoMbps = 0x00,
|
||||
/// <summary>5.04 Mbps</summary>
|
||||
FiveMbps = 0x01,
|
||||
/// <summary>10.08 Mbps</summary>
|
||||
TenMbps = 0x02,
|
||||
/// <summary>20.16 Mbps</summary>
|
||||
TwentyMbps = 0x03,
|
||||
/// <summary>30.24 Mbps</summary>
|
||||
ThirtyMbps = 0x04, Unspecified = 0x0F
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum LayerTypeFieldMask : byte
|
||||
{
|
||||
Embossed = 0x01, Recordable = 0x02, Rewritable = 0x04,
|
||||
Reserved = 0x08
|
||||
}
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum LayerTypeFieldMask : byte
|
||||
{
|
||||
Embossed = 0x01, Recordable = 0x02, Rewritable = 0x04,
|
||||
Reserved = 0x08
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum LinearDensityField : byte
|
||||
{
|
||||
/// <summary>0.267 μm/bit</summary>
|
||||
TwoSix = 0x00,
|
||||
/// <summary>0.293 μm/bit</summary>
|
||||
TwoNine = 0x01,
|
||||
/// <summary>0.409 to 0.435 μm/bit</summary>
|
||||
FourZero = 0x02,
|
||||
/// <summary>0.280 to 0.291 μm/bit</summary>
|
||||
TwoEight = 0x04,
|
||||
/// <summary>0.153 μm/bit</summary>
|
||||
OneFive = 0x05,
|
||||
/// <summary>0.130 to 0.140 μm/bit</summary>
|
||||
OneThree = 0x06,
|
||||
/// <summary>0.353 μm/bit</summary>
|
||||
ThreeFive = 0x08
|
||||
}
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum LinearDensityField : byte
|
||||
{
|
||||
/// <summary>0.267 μm/bit</summary>
|
||||
TwoSix = 0x00,
|
||||
/// <summary>0.293 μm/bit</summary>
|
||||
TwoNine = 0x01,
|
||||
/// <summary>0.409 to 0.435 μm/bit</summary>
|
||||
FourZero = 0x02,
|
||||
/// <summary>0.280 to 0.291 μm/bit</summary>
|
||||
TwoEight = 0x04,
|
||||
/// <summary>0.153 μm/bit</summary>
|
||||
OneFive = 0x05,
|
||||
/// <summary>0.130 to 0.140 μm/bit</summary>
|
||||
OneThree = 0x06,
|
||||
/// <summary>0.353 μm/bit</summary>
|
||||
ThreeFive = 0x08
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum TrackDensityField : byte
|
||||
{
|
||||
/// <summary>0.74 μm/track</summary>
|
||||
Seven = 0x00,
|
||||
/// <summary>0.80 μm/track</summary>
|
||||
Eight = 0x01,
|
||||
/// <summary>0.615 μm/track</summary>
|
||||
Six = 0x02,
|
||||
/// <summary>0.40 μm/track</summary>
|
||||
Four = 0x03,
|
||||
/// <summary>0.34 μm/track</summary>
|
||||
Three = 0x04
|
||||
}
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum TrackDensityField : byte
|
||||
{
|
||||
/// <summary>0.74 μm/track</summary>
|
||||
Seven = 0x00,
|
||||
/// <summary>0.80 μm/track</summary>
|
||||
Eight = 0x01,
|
||||
/// <summary>0.615 μm/track</summary>
|
||||
Six = 0x02,
|
||||
/// <summary>0.40 μm/track</summary>
|
||||
Four = 0x03,
|
||||
/// <summary>0.34 μm/track</summary>
|
||||
Three = 0x04
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum CopyrightType : byte
|
||||
{
|
||||
/// <summary>There is no copy protection</summary>
|
||||
NoProtection = 0x00,
|
||||
/// <summary>Copy protection is CSS/CPPM</summary>
|
||||
CSS = 0x01,
|
||||
/// <summary>Copy protection is CPRM</summary>
|
||||
CPRM = 0x02,
|
||||
/// <summary>Copy protection is AACS</summary>
|
||||
AACS = 0x10
|
||||
}
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum CopyrightType : byte
|
||||
{
|
||||
/// <summary>There is no copy protection</summary>
|
||||
NoProtection = 0x00,
|
||||
/// <summary>Copy protection is CSS/CPPM</summary>
|
||||
CSS = 0x01,
|
||||
/// <summary>Copy protection is CPRM</summary>
|
||||
CPRM = 0x02,
|
||||
/// <summary>Copy protection is AACS</summary>
|
||||
AACS = 0x10
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum WPDiscTypes : byte
|
||||
{
|
||||
/// <summary>Should not write without a cartridge</summary>
|
||||
DoNotWrite = 0x00,
|
||||
/// <summary>Can write without a cartridge</summary>
|
||||
CanWrite = 0x01, Reserved1 = 0x02, Reserved2 = 0x03
|
||||
}
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum WPDiscTypes : byte
|
||||
{
|
||||
/// <summary>Should not write without a cartridge</summary>
|
||||
DoNotWrite = 0x00,
|
||||
/// <summary>Can write without a cartridge</summary>
|
||||
CanWrite = 0x01, Reserved1 = 0x02, Reserved2 = 0x03
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DVDSize
|
||||
{
|
||||
/// <summary>120 mm</summary>
|
||||
OneTwenty = 0,
|
||||
/// <summary>80 mm</summary>
|
||||
Eighty = 1
|
||||
}
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DVDSize
|
||||
{
|
||||
/// <summary>120 mm</summary>
|
||||
OneTwenty = 0,
|
||||
/// <summary>80 mm</summary>
|
||||
Eighty = 1
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DVDRAMDiscType
|
||||
{
|
||||
/// <summary>Shall not be recorded without a case</summary>
|
||||
Cased = 0,
|
||||
/// <summary>May be recorded without a case or within one</summary>
|
||||
Uncased = 1
|
||||
}
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DVDRAMDiscType
|
||||
{
|
||||
/// <summary>Shall not be recorded without a case</summary>
|
||||
Cased = 0,
|
||||
/// <summary>May be recorded without a case or within one</summary>
|
||||
Uncased = 1
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DVDLayerStructure
|
||||
{
|
||||
Unspecified = 0, InvertedStack = 1, TwoP = 2,
|
||||
Reserved = 3
|
||||
}
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DVDLayerStructure
|
||||
{
|
||||
Unspecified = 0, InvertedStack = 1, TwoP = 2,
|
||||
Reserved = 3
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DVDRecordingSpeed
|
||||
{
|
||||
None = 0, Two = 0, Four = 0x10,
|
||||
Six = 0x20, Eight = 0x30, Ten = 0x40,
|
||||
Twelve = 0x50
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DVDRecordingSpeed
|
||||
{
|
||||
None = 0, Two = 0, Four = 0x10,
|
||||
Six = 0x20, Eight = 0x30, Ten = 0x40,
|
||||
Twelve = 0x50
|
||||
}
|
||||
#endregion
|
||||
195
DVD/Layers.cs
195
DVD/Layers.cs
@@ -32,108 +32,107 @@
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class Layers
|
||||
{
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class Layers
|
||||
public struct LayerCapacity
|
||||
{
|
||||
public struct LayerCapacity
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4, bit 7 If set, L0 capacity is immutable</summary>
|
||||
public bool InitStatus;
|
||||
/// <summary>Byte 4, bits 6 to 0 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 5 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved5;
|
||||
/// <summary>Byte 7 Reserved</summary>
|
||||
public byte Reserved6;
|
||||
/// <summary>Byte 8 to 11 L0 Data Area Capacity</summary>
|
||||
public uint Capacity;
|
||||
}
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4, bit 7 If set, L0 capacity is immutable</summary>
|
||||
public bool InitStatus;
|
||||
/// <summary>Byte 4, bits 6 to 0 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 5 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved5;
|
||||
/// <summary>Byte 7 Reserved</summary>
|
||||
public byte Reserved6;
|
||||
/// <summary>Byte 8 to 11 L0 Data Area Capacity</summary>
|
||||
public uint Capacity;
|
||||
}
|
||||
|
||||
public struct MiddleZoneStartAddress
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length = 10</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4, bit 7 If set, L0 shifter middle area is immutable</summary>
|
||||
public bool InitStatus;
|
||||
/// <summary>Byte 4, bits 6 to 0 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 5 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved5;
|
||||
/// <summary>Byte 7 Reserved</summary>
|
||||
public byte Reserved6;
|
||||
/// <summary>Byte 8 to 11 Start LBA of Shifted Middle Area on L0</summary>
|
||||
public uint ShiftedMiddleAreaStartAddress;
|
||||
}
|
||||
public struct MiddleZoneStartAddress
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length = 10</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4, bit 7 If set, L0 shifter middle area is immutable</summary>
|
||||
public bool InitStatus;
|
||||
/// <summary>Byte 4, bits 6 to 0 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 5 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved5;
|
||||
/// <summary>Byte 7 Reserved</summary>
|
||||
public byte Reserved6;
|
||||
/// <summary>Byte 8 to 11 Start LBA of Shifted Middle Area on L0</summary>
|
||||
public uint ShiftedMiddleAreaStartAddress;
|
||||
}
|
||||
|
||||
public struct JumpIntervalSize
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length = 10</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 5 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved5;
|
||||
/// <summary>Byte 7 Reserved</summary>
|
||||
public byte Reserved6;
|
||||
/// <summary>Byte 8 to 11 Jump Interval size for the Regular Interval Layer Jump</summary>
|
||||
public uint Size;
|
||||
}
|
||||
public struct JumpIntervalSize
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length = 10</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 5 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved5;
|
||||
/// <summary>Byte 7 Reserved</summary>
|
||||
public byte Reserved6;
|
||||
/// <summary>Byte 8 to 11 Jump Interval size for the Regular Interval Layer Jump</summary>
|
||||
public uint Size;
|
||||
}
|
||||
|
||||
public struct ManualLayerJumpAddress
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length = 10</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 5 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved5;
|
||||
/// <summary>Byte 7 Reserved</summary>
|
||||
public byte Reserved6;
|
||||
/// <summary>Byte 8 to 11 LBA for the manual layer jump</summary>
|
||||
public uint LBA;
|
||||
}
|
||||
public struct ManualLayerJumpAddress
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length = 10</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 5 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Byte 6 Reserved</summary>
|
||||
public byte Reserved5;
|
||||
/// <summary>Byte 7 Reserved</summary>
|
||||
public byte Reserved6;
|
||||
/// <summary>Byte 8 to 11 LBA for the manual layer jump</summary>
|
||||
public uint LBA;
|
||||
}
|
||||
}
|
||||
2797
DVD/PFI.cs
2797
DVD/PFI.cs
File diff suppressed because it is too large
Load Diff
1043
DVD/PRI.cs
1043
DVD/PRI.cs
File diff suppressed because it is too large
Load Diff
95
DVD/RMD.cs
95
DVD/RMD.cs
@@ -32,54 +32,53 @@
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
{
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class RMD
|
||||
{
|
||||
public struct LastBorderOutRMD
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to end RMD in last recorded Border-out</summary>
|
||||
public byte[] RMD;
|
||||
}
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
public struct HDMediumStatus
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4, bits 7 to 1 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 4, bit 0 Test Zone has been extended</summary>
|
||||
public bool ExtendedTestZone;
|
||||
/// <summary>Byte 5 Number of remaining RMDs in RDZ</summary>
|
||||
public byte RemainingRMDs;
|
||||
/// <summary>Bytes 6 to 7 Number of remaining RMDs in current RMZ</summary>
|
||||
public ushort CurrentRemainingRMDs;
|
||||
}
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class RMD
|
||||
{
|
||||
public struct LastBorderOutRMD
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to end RMD in last recorded Border-out</summary>
|
||||
public byte[] RMD;
|
||||
}
|
||||
|
||||
public struct HDMediumStatus
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4, bits 7 to 1 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 4, bit 0 Test Zone has been extended</summary>
|
||||
public bool ExtendedTestZone;
|
||||
/// <summary>Byte 5 Number of remaining RMDs in RDZ</summary>
|
||||
public byte RemainingRMDs;
|
||||
/// <summary>Bytes 6 to 7 Number of remaining RMDs in current RMZ</summary>
|
||||
public ushort CurrentRemainingRMDs;
|
||||
}
|
||||
}
|
||||
123
DVD/Spare.cs
123
DVD/Spare.cs
@@ -33,77 +33,76 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
|
||||
public static class Spare
|
||||
{
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
|
||||
public static class Spare
|
||||
public static SpareAreaInformation? Decode(byte[] response)
|
||||
{
|
||||
public static SpareAreaInformation? Decode(byte[] response)
|
||||
if(response?.Length != 16)
|
||||
return null;
|
||||
|
||||
return new SpareAreaInformation
|
||||
{
|
||||
if(response?.Length != 16)
|
||||
return null;
|
||||
DataLength = (ushort)((response[0] << 8) + response[1]),
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
UnusedPrimaryBlocks =
|
||||
(uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]),
|
||||
UnusedSupplementaryBlocks =
|
||||
(uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]),
|
||||
AllocatedSupplementaryBlocks =
|
||||
(uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15])
|
||||
};
|
||||
}
|
||||
|
||||
return new SpareAreaInformation
|
||||
{
|
||||
DataLength = (ushort)((response[0] << 8) + response[1]),
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
UnusedPrimaryBlocks =
|
||||
(uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]),
|
||||
UnusedSupplementaryBlocks =
|
||||
(uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]),
|
||||
AllocatedSupplementaryBlocks =
|
||||
(uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15])
|
||||
};
|
||||
}
|
||||
public static string Prettify(SpareAreaInformation? sai)
|
||||
{
|
||||
if(sai == null)
|
||||
return null;
|
||||
|
||||
public static string Prettify(SpareAreaInformation? sai)
|
||||
{
|
||||
if(sai == null)
|
||||
return null;
|
||||
SpareAreaInformation decoded = sai.Value;
|
||||
var sb = new StringBuilder();
|
||||
|
||||
SpareAreaInformation decoded = sai.Value;
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendFormat("{0} unused primary spare blocks", decoded.UnusedPrimaryBlocks).AppendLine();
|
||||
sb.AppendFormat("{0} unused supplementary spare blocks", decoded.UnusedSupplementaryBlocks).AppendLine();
|
||||
|
||||
sb.AppendFormat("{0} unused primary spare blocks", decoded.UnusedPrimaryBlocks).AppendLine();
|
||||
sb.AppendFormat("{0} unused supplementary spare blocks", decoded.UnusedSupplementaryBlocks).AppendLine();
|
||||
sb.AppendFormat("{0} allocated supplementary spare blocks", decoded.AllocatedSupplementaryBlocks).
|
||||
AppendLine();
|
||||
|
||||
sb.AppendFormat("{0} allocated supplementary spare blocks", decoded.AllocatedSupplementaryBlocks).
|
||||
AppendLine();
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
public static string Prettify(byte[] response) => Prettify(Decode(response));
|
||||
|
||||
public static string Prettify(byte[] response) => Prettify(Decode(response));
|
||||
|
||||
public struct SpareAreaInformation
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to 7 Data length</summary>
|
||||
public uint UnusedPrimaryBlocks;
|
||||
/// <summary>Bytes 8 to 11 Data length</summary>
|
||||
public uint UnusedSupplementaryBlocks;
|
||||
/// <summary>Bytes 12 to 15 Data length</summary>
|
||||
public uint AllocatedSupplementaryBlocks;
|
||||
}
|
||||
public struct SpareAreaInformation
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Bytes 4 to 7 Data length</summary>
|
||||
public uint UnusedPrimaryBlocks;
|
||||
/// <summary>Bytes 8 to 11 Data length</summary>
|
||||
public uint UnusedSupplementaryBlocks;
|
||||
/// <summary>Bytes 12 to 15 Data length</summary>
|
||||
public uint AllocatedSupplementaryBlocks;
|
||||
}
|
||||
}
|
||||
89
DVD/UDI.cs
89
DVD/UDI.cs
@@ -32,52 +32,51 @@
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Aaru.Decoders.DVD
|
||||
namespace Aaru.Decoders.DVD;
|
||||
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class UDI
|
||||
{
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
// T10/1048-D revision 10a
|
||||
// T10/1228-D revision 7.0c
|
||||
// T10/1228-D revision 11a
|
||||
// T10/1363-D revision 10g
|
||||
// T10/1545-D revision 1d
|
||||
// T10/1545-D revision 5
|
||||
// T10/1545-D revision 5a
|
||||
// T10/1675-D revision 2c
|
||||
// T10/1675-D revision 4
|
||||
// T10/1836-D revision 2g
|
||||
// ECMA 365
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static class UDI
|
||||
public struct UniqueDiscIdentifier
|
||||
{
|
||||
public struct UniqueDiscIdentifier
|
||||
{
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 5 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Bytes 6 to 7 Random number</summary>
|
||||
public ushort RandomNumber;
|
||||
/// <summary>Byte 8 to 11 Year</summary>
|
||||
public uint Year;
|
||||
/// <summary>Byte 12 to 13 Month</summary>
|
||||
public ushort Month;
|
||||
/// <summary>Byte 14 to 15 Day</summary>
|
||||
public ushort Day;
|
||||
/// <summary>Byte 16 to 17 Hour</summary>
|
||||
public ushort Hour;
|
||||
/// <summary>Byte 18 to 19 Minute</summary>
|
||||
public ushort Minute;
|
||||
/// <summary>Byte 20 to 21 Second</summary>
|
||||
public ushort Second;
|
||||
}
|
||||
/// <summary>Bytes 0 to 1 Data length</summary>
|
||||
public ushort DataLength;
|
||||
/// <summary>Byte 2 Reserved</summary>
|
||||
public byte Reserved1;
|
||||
/// <summary>Byte 3 Reserved</summary>
|
||||
public byte Reserved2;
|
||||
/// <summary>Byte 4 Reserved</summary>
|
||||
public byte Reserved3;
|
||||
/// <summary>Byte 5 Reserved</summary>
|
||||
public byte Reserved4;
|
||||
/// <summary>Bytes 6 to 7 Random number</summary>
|
||||
public ushort RandomNumber;
|
||||
/// <summary>Byte 8 to 11 Year</summary>
|
||||
public uint Year;
|
||||
/// <summary>Byte 12 to 13 Month</summary>
|
||||
public ushort Month;
|
||||
/// <summary>Byte 14 to 15 Day</summary>
|
||||
public ushort Day;
|
||||
/// <summary>Byte 16 to 17 Hour</summary>
|
||||
public ushort Hour;
|
||||
/// <summary>Byte 18 to 19 Minute</summary>
|
||||
public ushort Minute;
|
||||
/// <summary>Byte 20 to 21 Second</summary>
|
||||
public ushort Second;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user