mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Implemented decoding DVD-RAM Spare Area Information.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2015-12-02 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
|
* DVD/Spare.cs:
|
||||||
|
Implemented decoding DVD-RAM Spare Area Information.
|
||||||
|
|
||||||
2015-12-02 Natalia Portillo <claunia@claunia.com>
|
2015-12-02 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
* DVD/Cartridge.cs:
|
* DVD/Cartridge.cs:
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
// //$Id$
|
// //$Id$
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace DiscImageChef.Decoders.DVD
|
namespace DiscImageChef.Decoders.DVD
|
||||||
{
|
{
|
||||||
@@ -53,7 +54,6 @@ namespace DiscImageChef.Decoders.DVD
|
|||||||
/// T10/1675-D revision 2c
|
/// T10/1675-D revision 2c
|
||||||
/// T10/1675-D revision 4
|
/// T10/1675-D revision 4
|
||||||
/// T10/1836-D revision 2g
|
/// T10/1836-D revision 2g
|
||||||
/// ECMA 365
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class Spare
|
public static class Spare
|
||||||
{
|
{
|
||||||
@@ -90,6 +90,46 @@ namespace DiscImageChef.Decoders.DVD
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public UInt32 AllocatedSupplementaryBlocks;
|
public UInt32 AllocatedSupplementaryBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SpareAreaInformation? Decode(byte[] response)
|
||||||
|
{
|
||||||
|
if (response == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (response.Length != 16)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
SpareAreaInformation sai = new SpareAreaInformation();
|
||||||
|
|
||||||
|
sai.DataLength = (ushort)((response[0] << 8) + response[1]);
|
||||||
|
sai.Reserved1 = response[2];
|
||||||
|
sai.Reserved2 = response[3];
|
||||||
|
sai.UnusedPrimaryBlocks = (uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]);
|
||||||
|
sai.UnusedSupplementaryBlocks = (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
|
||||||
|
sai.AllocatedSupplementaryBlocks = (uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
|
||||||
|
|
||||||
|
return sai;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Prettify(SpareAreaInformation? sai)
|
||||||
|
{
|
||||||
|
if (sai == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
SpareAreaInformation decoded = sai.Value;
|
||||||
|
StringBuilder 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();
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Prettify(byte[] response)
|
||||||
|
{
|
||||||
|
return Prettify(Decode(response));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
2015-12-02 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
|
* Commands/MediaInfo.cs:
|
||||||
|
Implemented decoding DVD-RAM Spare Area Information.
|
||||||
|
|
||||||
2015-12-02 Natalia Portillo <claunia@claunia.com>
|
2015-12-02 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
* Commands/MediaInfo.cs:
|
* Commands/MediaInfo.cs:
|
||||||
|
|||||||
@@ -431,7 +431,10 @@ namespace DiscImageChef.Commands
|
|||||||
if(sense)
|
if(sense)
|
||||||
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: SAI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: SAI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
||||||
else
|
else
|
||||||
|
{
|
||||||
doWriteFile(outputPrefix, "_readdiscstructure_dvdram_spare.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
|
doWriteFile(outputPrefix, "_readdiscstructure_dvdram_spare.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
|
||||||
|
DicConsole.WriteLine("Spare Area Information:\n{0}", Decoders.DVD.Spare.Prettify(cmdBuf));
|
||||||
|
}
|
||||||
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_RecordingType, 0, dev.Timeout, out duration);
|
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_RecordingType, 0, dev.Timeout, out duration);
|
||||||
if(sense)
|
if(sense)
|
||||||
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Recording Type\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Recording Type\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
||||||
|
|||||||
Reference in New Issue
Block a user