Code reformat.

This commit is contained in:
2019-11-25 00:54:38 +00:00
parent a5c650440d
commit d864bfab6c
116 changed files with 16544 additions and 19331 deletions

View File

@@ -35,47 +35,23 @@ using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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
/// 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
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class AACS
{
public struct HDLeadInCopyright
{
/// <summary>
/// Bytes 0 to 1
/// Data length
/// </summary>
/// <summary>Bytes 0 to 1 Data length</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Bytes 4 to 2052
/// HD DVD Lead-In Copyright Information
/// </summary>
/// <summary>Bytes 4 to 2052 HD DVD Lead-In Copyright Information</summary>
public byte[] CopyrightInformation;
}
}

View File

@@ -35,47 +35,23 @@ using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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
/// 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
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class ADIP
{
public struct ADIPInformation
{
/// <summary>
/// Bytes 0 to 1
/// Data length
/// </summary>
/// <summary>Bytes 0 to 1 Data length</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Bytes 4 to 259
/// ADIP, defined in DVD standards
/// </summary>
/// <summary>Bytes 4 to 259 ADIP, defined in DVD standards</summary>
public byte[] ADIP;
}
}

View File

@@ -35,47 +35,23 @@ using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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
/// 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
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class BCA
{
public struct BurstCuttingArea
{
/// <summary>
/// Bytes 0 to 1
/// Data length
/// </summary>
/// <summary>Bytes 0 to 1 Data length</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Bytes 4 to end
/// Burst cutting area contents, 12 to 188 bytes
/// </summary>
/// <summary>Bytes 4 to end Burst cutting area contents, 12 to 188 bytes</summary>
public byte[] BCA;
}
}

View File

@@ -35,71 +35,35 @@ using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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
/// 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
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[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>
/// <summary>Bytes 0 to 1 Data length</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Bytes 4 to end
/// Disc Media Identifier for CPRM
/// </summary>
/// <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>
/// <summary>Bytes 0 to 1 Data length</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Bytes 4 to end
/// Disc Media Key Block for CPRM
/// </summary>
/// <summary>Bytes 4 to end Disc Media Key Block for CPRM</summary>
public byte[] MediaKeyBlock;
}
}

View File

@@ -36,147 +36,94 @@ using System.Text;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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
/// 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
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "NotAccessedField.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class CSS_CPRM
{
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 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 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],
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]
Reserved3 = response[6], Reserved4 = response[7]
};
}
public static string PrettifyLeadInCopyright(LeadInCopyright? cmi)
{
if(cmi == null) return null;
if(cmi == null)
return null;
LeadInCopyright decoded = cmi.Value;
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
switch(decoded.CopyrightType)
{
case CopyrightType.NoProtection:
sb.AppendLine("Disc has no encryption.");
break;
case CopyrightType.CSS:
sb.AppendLine("Disc is encrypted using CSS or CPPM.");
break;
case CopyrightType.CPRM:
sb.AppendLine("Disc is encrypted using CPRM.");
break;
case CopyrightType.AACS:
sb.AppendLine("Disc is encrypted using AACS.");
break;
default:
sb.AppendFormat("Disc is encrypted using unknown algorithm with ID {0}.", decoded.CopyrightType);
break;
}
if(decoded.CopyrightType == 0) return sb.ToString();
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.");
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(" 0");
if((decoded.RegionInformation & 0x02) != 0x02) sb.Append(" 1");
if((decoded.RegionInformation & 0x04) != 0x04) sb.Append(" 2");
if((decoded.RegionInformation & 0x08) != 0x08) sb.Append(" 3");
if((decoded.RegionInformation & 0x10) != 0x10) sb.Append(" 4");
if((decoded.RegionInformation & 0x20) != 0x20) sb.Append(" 5");
if((decoded.RegionInformation & 0x40) != 0x40) sb.Append(" 6");
if((decoded.RegionInformation & 0x80) != 0x80) sb.Append(" 7");
if((decoded.RegionInformation & 0x01) != 0x01)
sb.Append(" 0");
if((decoded.RegionInformation & 0x02) != 0x02)
sb.Append(" 1");
if((decoded.RegionInformation & 0x04) != 0x04)
sb.Append(" 2");
if((decoded.RegionInformation & 0x08) != 0x08)
sb.Append(" 3");
if((decoded.RegionInformation & 0x10) != 0x10)
sb.Append(" 4");
if((decoded.RegionInformation & 0x20) != 0x20)
sb.Append(" 5");
if((decoded.RegionInformation & 0x40) != 0x40)
sb.Append(" 6");
if((decoded.RegionInformation & 0x80) != 0x80)
sb.Append(" 7");
}
return sb.ToString();
@@ -184,5 +131,35 @@ namespace DiscImageChef.Decoders.DVD
public static string PrettifyLeadInCopyright(byte[] response) =>
PrettifyLeadInCopyright(DecodeLeadInCopyright(response));
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 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;
}
}
}

View File

@@ -36,159 +36,88 @@ using System.Text;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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
/// 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
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "NotAccessedField.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class Cartridge
{
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;
}
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],
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;
if(status == null)
return null;
MediumStatus decoded = status.Value;
StringBuilder sb = new StringBuilder();
MediumStatus decoded = status.Value;
var sb = new StringBuilder();
if(decoded.PWP) sb.AppendLine("Disc surface is set to write protected status");
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");
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();
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;
}
@@ -196,5 +125,38 @@ namespace DiscImageChef.Decoders.DVD
}
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;
}
}
}

View File

@@ -37,176 +37,28 @@ using System.Text;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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)
/// 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)
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "NotAccessedField.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class DDS
{
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;
}
public static DiscDefinitionStructure? Decode(byte[] response)
{
if(response?.Length != 2052) return null;
if(response?.Length != 2052)
return null;
DiscDefinitionStructure dds =
new DiscDefinitionStructure {Identifier = (ushort)((response[4] << 8) + response[5])};
var dds = new DiscDefinitionStructure
{
Identifier = (ushort)((response[4] << 8) + response[5])
};
if(dds.Identifier != 0x0A0A) return null;
if(dds.Identifier != 0x0A0A)
return null;
// Common to both DVD-RAM versions
dds.DataLength = (ushort)((response[0] << 8) + response[1]);
@@ -216,8 +68,10 @@ namespace DiscImageChef.Decoders.DVD
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]);
@@ -230,6 +84,7 @@ namespace DiscImageChef.Decoders.DVD
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;
@@ -241,7 +96,8 @@ namespace DiscImageChef.Decoders.DVD
}
// ECMA-330
if(dds.Groups != 1) return dds;
if(dds.Groups != 1)
return dds;
{
dds.Reserved4 = (byte)((response[7] & 0x7C) >> 2);
@@ -263,23 +119,31 @@ namespace DiscImageChef.Decoders.DVD
public static string Prettify(DiscDefinitionStructure? dds)
{
if(dds == null) return null;
if(dds == null)
return null;
DiscDefinitionStructure decoded = dds.Value;
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
if(decoded.InProcess)
{
sb.AppendLine("Formatting in progress.");
if(decoded.Groups == 24)
{
if(decoded.PartialCertification) sb.AppendLine("Formatting is only using partial certification");
if(decoded.FormattingOnlyAGroup) sb.AppendLine("Only a group is being formatted");
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");
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();
@@ -289,6 +153,7 @@ namespace DiscImageChef.Decoders.DVD
if(decoded.GroupCertificationFlags[i].InProcess)
{
sb.AppendFormat("Group {0} is being formatted", i).AppendLine();
if(decoded.GroupCertificationFlags[i].PartialCertification)
sb.AppendFormat("Group {0} is being certified partially", i).AppendLine();
}
@@ -297,12 +162,15 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendFormat("Group {0} has been certified by an user", i).AppendLine();
}
if(decoded.Groups != 1) return sb.ToString();
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++)
@@ -313,5 +181,65 @@ namespace DiscImageChef.Decoders.DVD
}
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;
}
}
}

View File

@@ -35,47 +35,23 @@ using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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
/// 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
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class DMI
{
public struct DiscManufacturingInformation
{
/// <summary>
/// Bytes 0 to 1
/// Data length
/// </summary>
/// <summary>Bytes 0 to 1 Data length</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Bytes 4 to 2052
/// Disc Manufacturing Information
/// </summary>
/// <summary>Bytes 4 to 2052 Disc Manufacturing Information</summary>
public byte[] DMI;
}
}

View File

@@ -38,238 +38,111 @@ namespace DiscImageChef.Decoders.DVD
[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>
/// <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
/// <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
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>
/// <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>
/// <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>
/// <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
/// <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>
/// <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>
/// <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
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,
None = 0, Two = 0, Four = 0x10,
Six = 0x20, Eight = 0x30, Ten = 0x40,
Twelve = 0x50
}
#endregion

View File

@@ -35,209 +35,95 @@ using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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
/// 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
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class Layers
{
public struct LayerCapacity
{
/// <summary>
/// Bytes 0 to 1
/// Data length
/// </summary>
/// <summary>Bytes 0 to 1 Data length</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Byte 4, bit 7
/// If set, L0 capacity is immutable
/// </summary>
/// <summary>Byte 4, bit 7 If set, L0 capacity is immutable</summary>
public bool InitStatus;
/// <summary>
/// Byte 4, bits 6 to 0
/// Reserved
/// </summary>
/// <summary>Byte 4, bits 6 to 0 Reserved</summary>
public byte Reserved3;
/// <summary>
/// Byte 5
/// Reserved
/// </summary>
/// <summary>Byte 5 Reserved</summary>
public byte Reserved4;
/// <summary>
/// Byte 6
/// Reserved
/// </summary>
/// <summary>Byte 6 Reserved</summary>
public byte Reserved5;
/// <summary>
/// Byte 7
/// Reserved
/// </summary>
/// <summary>Byte 7 Reserved</summary>
public byte Reserved6;
/// <summary>
/// Byte 8 to 11
/// L0 Data Area Capacity
/// </summary>
/// <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>
/// <summary>Bytes 0 to 1 Data length = 10</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Byte 4, bit 7
/// If set, L0 shifter middle area is immutable
/// </summary>
/// <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>
/// <summary>Byte 4, bits 6 to 0 Reserved</summary>
public byte Reserved3;
/// <summary>
/// Byte 5
/// Reserved
/// </summary>
/// <summary>Byte 5 Reserved</summary>
public byte Reserved4;
/// <summary>
/// Byte 6
/// Reserved
/// </summary>
/// <summary>Byte 6 Reserved</summary>
public byte Reserved5;
/// <summary>
/// Byte 7
/// Reserved
/// </summary>
/// <summary>Byte 7 Reserved</summary>
public byte Reserved6;
/// <summary>
/// Byte 8 to 11
/// Start LBA of Shifted Middle Area on L0
/// </summary>
/// <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>
/// <summary>Bytes 0 to 1 Data length = 10</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Byte 4
/// Reserved
/// </summary>
/// <summary>Byte 4 Reserved</summary>
public byte Reserved3;
/// <summary>
/// Byte 5
/// Reserved
/// </summary>
/// <summary>Byte 5 Reserved</summary>
public byte Reserved4;
/// <summary>
/// Byte 6
/// Reserved
/// </summary>
/// <summary>Byte 6 Reserved</summary>
public byte Reserved5;
/// <summary>
/// Byte 7
/// Reserved
/// </summary>
/// <summary>Byte 7 Reserved</summary>
public byte Reserved6;
/// <summary>
/// Byte 8 to 11
/// Jump Interval size for the Regular Interval Layer Jump
/// </summary>
/// <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>
/// <summary>Bytes 0 to 1 Data length = 10</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Byte 4
/// Reserved
/// </summary>
/// <summary>Byte 4 Reserved</summary>
public byte Reserved3;
/// <summary>
/// Byte 5
/// Reserved
/// </summary>
/// <summary>Byte 5 Reserved</summary>
public byte Reserved4;
/// <summary>
/// Byte 6
/// Reserved
/// </summary>
/// <summary>Byte 6 Reserved</summary>
public byte Reserved5;
/// <summary>
/// Byte 7
/// Reserved
/// </summary>
/// <summary>Byte 7 Reserved</summary>
public byte Reserved6;
/// <summary>
/// Byte 8 to 11
/// LBA for the manual layer jump
/// </summary>
/// <summary>Byte 8 to 11 LBA for the manual layer jump</summary>
public uint LBA;
}
}

1642
DVD/PFI.cs

File diff suppressed because it is too large Load Diff

View File

@@ -35,47 +35,23 @@ using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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
/// 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
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class PRI
{
public struct PreRecordedInformation
{
/// <summary>
/// Bytes 0 to 1
/// Data length
/// </summary>
/// <summary>Bytes 0 to 1 Data length</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Bytes 4 to end
/// Pre-recorded Information in Lead-in for writable media
/// </summary>
/// <summary>Bytes 4 to end Pre-recorded Information in Lead-in for writable media</summary>
public byte[] PRI;
}
}

View File

@@ -35,86 +35,41 @@ using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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
/// 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
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[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>
/// <summary>Bytes 0 to 1 Data length</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Bytes 4 to end
/// RMD in last recorded Border-out
/// </summary>
/// <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>
/// <summary>Bytes 0 to 1 Data length</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Byte 4, bits 7 to 1
/// Reserved
/// </summary>
/// <summary>Byte 4, bits 7 to 1 Reserved</summary>
public byte Reserved3;
/// <summary>
/// Byte 4, bit 0
/// Test Zone has been extended
/// </summary>
/// <summary>Byte 4, bit 0 Test Zone has been extended</summary>
public bool ExtendedTestZone;
/// <summary>
/// Byte 5
/// Number of remaining RMDs in RDZ
/// </summary>
/// <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>
/// <summary>Bytes 6 to 7 Number of remaining RMDs in current RMZ</summary>
public ushort CurrentRemainingRMDs;
}
}

View File

@@ -36,68 +36,22 @@ using System.Text;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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
/// 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
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "NotAccessedField.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class Spare
{
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 static SpareAreaInformation? Decode(byte[] response)
{
if(response?.Length != 16) return null;
if(response?.Length != 16)
return null;
return new SpareAreaInformation
{
DataLength = (ushort)((response[0] << 8) + response[1]),
Reserved1 = response[2],
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]),
@@ -110,19 +64,37 @@ namespace DiscImageChef.Decoders.DVD
public static string Prettify(SpareAreaInformation? sai)
{
if(sai == null) return null;
if(sai == null)
return null;
SpareAreaInformation decoded = sai.Value;
StringBuilder sb = new StringBuilder();
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} allocated supplementary spare blocks", decoded.AllocatedSupplementaryBlocks)
.AppendLine();
sb.AppendFormat("{0} allocated supplementary spare blocks", decoded.AllocatedSupplementaryBlocks).
AppendLine();
return sb.ToString();
}
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;
}
}
}

View File

@@ -35,87 +35,39 @@ using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
/// 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
/// 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
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class UDI
{
public struct UniqueDiscIdentifier
{
/// <summary>
/// Bytes 0 to 1
/// Data length
/// </summary>
/// <summary>Bytes 0 to 1 Data length</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Byte 4
/// Reserved
/// </summary>
/// <summary>Byte 4 Reserved</summary>
public byte Reserved3;
/// <summary>
/// Byte 5
/// Reserved
/// </summary>
/// <summary>Byte 5 Reserved</summary>
public byte Reserved4;
/// <summary>
/// Bytes 6 to 7
/// Random number
/// </summary>
/// <summary>Bytes 6 to 7 Random number</summary>
public ushort RandomNumber;
/// <summary>
/// Byte 8 to 11
/// Year
/// </summary>
/// <summary>Byte 8 to 11 Year</summary>
public uint Year;
/// <summary>
/// Byte 12 to 13
/// Month
/// </summary>
/// <summary>Byte 12 to 13 Month</summary>
public ushort Month;
/// <summary>
/// Byte 14 to 15
/// Day
/// </summary>
/// <summary>Byte 14 to 15 Day</summary>
public ushort Day;
/// <summary>
/// Byte 16 to 17
/// Hour
/// </summary>
/// <summary>Byte 16 to 17 Hour</summary>
public ushort Hour;
/// <summary>
/// Byte 18 to 19
/// Minute
/// </summary>
/// <summary>Byte 18 to 19 Minute</summary>
public ushort Minute;
/// <summary>
/// Byte 20 to 21
/// Second
/// </summary>
/// <summary>Byte 20 to 21 Second</summary>
public ushort Second;
}
}