mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Added decoding Lead-In CMI for DVD.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2015-12-01 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
|
* DVD/CSS&CPRM.cs:
|
||||||
|
Added decoding Lead-In CMI for DVD.
|
||||||
|
|
||||||
2015-12-01 Natalia Portillo <claunia@claunia.com>
|
2015-12-01 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
* Blu-ray/DI.cs:
|
* Blu-ray/DI.cs:
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
// //$Id$
|
// //$Id$
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace DiscImageChef.Decoders.DVD
|
namespace DiscImageChef.Decoders.DVD
|
||||||
{
|
{
|
||||||
@@ -119,6 +120,88 @@ namespace DiscImageChef.Decoders.DVD
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public byte[] Key;
|
public byte[] Key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static LeadInCopyright? DecodeLeadInCopyright(byte[] response)
|
||||||
|
{
|
||||||
|
if(response == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (response.Length != 8)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
LeadInCopyright cmi = new LeadInCopyright();
|
||||||
|
|
||||||
|
cmi.DataLength = (ushort)((response[0] << 8) + response[1]);
|
||||||
|
cmi.Reserved1 = response[2];
|
||||||
|
cmi.Reserved2 = response[3];
|
||||||
|
cmi.CopyrightType = response[4];
|
||||||
|
cmi.RegionInformation = response[5];
|
||||||
|
cmi.Reserved3 = response[6];
|
||||||
|
cmi.Reserved4 = response[7];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string PrettifyLeadInCopyright(LeadInCopyright? cmi)
|
||||||
|
{
|
||||||
|
if (cmi == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
LeadInCopyright decoded = cmi.Value;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
switch (decoded.CopyrightType)
|
||||||
|
{
|
||||||
|
case 0x00:
|
||||||
|
sb.AppendLine("Disc has no encryption.");
|
||||||
|
break;
|
||||||
|
case 0x01:
|
||||||
|
sb.AppendLine("Disc is encrypted using CSS or CPPM.");
|
||||||
|
break;
|
||||||
|
case 0x02:
|
||||||
|
sb.AppendLine("Disc is encrypted using CPRM.");
|
||||||
|
break;
|
||||||
|
case 0x10:
|
||||||
|
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.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");
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string PrettifyLeadInCopyright(byte[] response)
|
||||||
|
{
|
||||||
|
return PrettifyLeadInCopyright(DecodeLeadInCopyright(response));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
2015-12-01 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
|
* Commands/MediaInfo.cs:
|
||||||
|
Added decoding Lead-In CMI for DVD.
|
||||||
|
|
||||||
2015-12-01 Natalia Portillo <claunia@claunia.com>
|
2015-12-01 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
* Commands/MediaInfo.cs:
|
* Commands/MediaInfo.cs:
|
||||||
|
|||||||
@@ -324,7 +324,10 @@ namespace DiscImageChef.Commands
|
|||||||
if(sense)
|
if(sense)
|
||||||
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
||||||
else
|
else
|
||||||
|
{
|
||||||
doWriteFile(outputPrefix, "_readdiscstructure_dvd_cmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
|
doWriteFile(outputPrefix, "_readdiscstructure_dvd_cmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
|
||||||
|
DicConsole.WriteLine("Lead-In CMI:\n{0}", Decoders.DVD.CSS_CPRM.PrettifyLeadInCopyright(cmdBuf));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion DVD-ROM
|
#endregion DVD-ROM
|
||||||
|
|
||||||
@@ -807,7 +810,10 @@ namespace DiscImageChef.Commands
|
|||||||
if(sense)
|
if(sense)
|
||||||
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
||||||
else
|
else
|
||||||
|
{
|
||||||
doWriteFile(outputPrefix, "_readdiscstructure_dvd_cmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
|
doWriteFile(outputPrefix, "_readdiscstructure_dvd_cmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
|
||||||
|
DicConsole.WriteLine("Lead-In CMI:\n{0}", Decoders.DVD.CSS_CPRM.PrettifyLeadInCopyright(cmdBuf));
|
||||||
|
}
|
||||||
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out duration);
|
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out duration);
|
||||||
if(sense)
|
if(sense)
|
||||||
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: BCA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: BCA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
||||||
|
|||||||
Reference in New Issue
Block a user