From 8bb55b01ee9095bf4e6b11508924888bfb01e9ef Mon Sep 17 00:00:00 2001 From: Juergen Tem Date: Fri, 4 May 2018 16:58:23 +0200 Subject: [PATCH] Fix reading of DTS-HD streams without extended XLL Metadata --- BDInfo/BDROM/TSCodecDTSHD.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/BDInfo/BDROM/TSCodecDTSHD.cs b/BDInfo/BDROM/TSCodecDTSHD.cs index 8227125b79..f3ad093ff2 100644 --- a/BDInfo/BDROM/TSCodecDTSHD.cs +++ b/BDInfo/BDROM/TSCodecDTSHD.cs @@ -213,15 +213,22 @@ public static void Scan( } var startPos = 0; + uint temp2 = 0; foreach (var size in AssetSizes) { startPos += size; } - buffer.Seek(buffer.Length - startPos, SeekOrigin.Begin); - uint temp2 = 0; - for (int j = 0; j < 4; j++) + if (startPos < buffer.Length) + { + buffer.Seek(buffer.Length - startPos, SeekOrigin.Begin); + for (int j = 0; j < 4; j++) + { + temp2 = (temp2 << 8) + buffer.ReadByte(); + } + } + else { - temp2 = (temp2 << 8) + buffer.ReadByte(); + temp2 = 0; } if (temp2 == 0x41A29547) //XLL Extended data