diff --git a/AaxDecrypter/Chapters.cs b/AaxDecrypter/Chapters.cs index 83d0f117..8a05e7e2 100644 --- a/AaxDecrypter/Chapters.cs +++ b/AaxDecrypter/Chapters.cs @@ -1,5 +1,6 @@ using Dinah.Core; using Dinah.Core.Diagnostics; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; @@ -66,8 +67,8 @@ namespace AaxDecrypter public class Chapter { public string Title { get; } - public long StartOffsetMs { get; } - public long EndOffsetMs { get; } + public TimeSpan StartOffset { get; } + public TimeSpan EndOffset { get; } public Chapter(string title, long startOffsetMs, long lengthMs) { ArgumentValidator.EnsureNotNullOrEmpty(title, nameof(title)); @@ -75,16 +76,16 @@ namespace AaxDecrypter ArgumentValidator.EnsureGreaterThan(lengthMs, nameof(lengthMs), 0); Title = title; - StartOffsetMs = startOffsetMs; - EndOffsetMs = StartOffsetMs + lengthMs; + StartOffset = TimeSpan.FromMilliseconds(startOffsetMs); + EndOffset = StartOffset + TimeSpan.FromMilliseconds(lengthMs); } public string ToFFMeta() { return "[CHAPTER]\n" + "TIMEBASE=1/1000\n" + - "START=" + StartOffsetMs + "\n" + - "END=" + EndOffsetMs + "\n" + + "START=" + StartOffset.TotalMilliseconds + "\n" + + "END=" + EndOffset.TotalMilliseconds + "\n" + "title=" + Title; } } diff --git a/AaxDecrypter/Cue.cs b/AaxDecrypter/Cue.cs index cc892aa2..8f492f66 100644 --- a/AaxDecrypter/Cue.cs +++ b/AaxDecrypter/Cue.cs @@ -17,11 +17,10 @@ namespace AaxDecrypter foreach (var c in chapters.Chapters) { trackCount++; - var startTime = TimeSpan.FromMilliseconds(c.StartOffsetMs); stringBuilder.AppendLine($"TRACK {trackCount} AUDIO"); stringBuilder.AppendLine($" TITLE \"{c.Title}\""); - stringBuilder.AppendLine($" INDEX 01 {(int)startTime.TotalMinutes}:{startTime:ss\\:ff}"); + stringBuilder.AppendLine($" INDEX 01 {(int)c.StartOffset.TotalMinutes}:{c.StartOffset:ss\\:ff}"); } return stringBuilder.ToString();