From 17f75f3ce62235e948443ba10d62d140ea329357 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 17 Sep 2020 10:37:04 -0700 Subject: [PATCH] First parts of layerbreak info --- DICUI.Library/Aaru/Parameters.cs | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/DICUI.Library/Aaru/Parameters.cs b/DICUI.Library/Aaru/Parameters.cs index 7299d113..12de2bf9 100644 --- a/DICUI.Library/Aaru/Parameters.cs +++ b/DICUI.Library/Aaru/Parameters.cs @@ -1585,6 +1585,25 @@ namespace DICUI.Aaru info.SizeAndChecksums.SHA1 = sha1; } + // Deal with the layerbreak + string layerbreak = null; + if (type == MediaType.DVD) + layerbreak = GetLayerbreak(sidecar) ?? ""; + else if (type == MediaType.BluRay) + layerbreak = (info.SizeAndChecksums.Size > 25025314816 ? "25025314816" : null); + + // If we have a single-layer disc + if (string.IsNullOrWhiteSpace(layerbreak)) + { + info.Extras.PVD = GeneratePVD(sidecar) ?? "Disc has no PVD"; + } + // If we have a dual-layer disc + else + { + info.Extras.PVD = GeneratePVD(sidecar) ?? "Disc has no PVD"; + info.SizeAndChecksums.Layerbreak = Int64.Parse(layerbreak); + } + // TODO: Investigate XGD disc outputs // TODO: Get layerbreak information // TODO: Investigate BD specifics like PIC @@ -2782,6 +2801,33 @@ namespace DICUI.Aaru } } + /// + /// Get the layerbreak from the input file, if possible + /// + /// CICM Sidecar data generated by Aaru + /// Layerbreak if possible, null on error + private static string GetLayerbreak(CICMMetadataType cicmSidecar) + { + // If the object is null, we can't get information from it + if (cicmSidecar == null) + return null; + + // Only care about OpticalDisc types + if (cicmSidecar.OpticalDisc == null || cicmSidecar.OpticalDisc.Length == 0) + return null; + + // Setup the layerbreak + string layerbreak = null; + + // Find and return the layerbreak, if possible + foreach (OpticalDiscType opticalDisc in cicmSidecar.OpticalDisc) + { + // TODO: Determine how to find the layerbreak from the CICM + } + + return layerbreak; + } + /// /// Get the write offset from the CICM Sidecar file, if possible ///