From f8e6a6372ae35c4182729dc456cbfcc16255e496 Mon Sep 17 00:00:00 2001 From: niksedk Date: Sat, 11 Dec 2021 21:31:42 +0100 Subject: [PATCH] Fix missing end time for bdsup in bdsup-edit - thx Jamakmake :) --- src/ui/Forms/BinaryEdit/BinEdit.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/ui/Forms/BinaryEdit/BinEdit.cs b/src/ui/Forms/BinaryEdit/BinEdit.cs index ee7e9d315..79233ea88 100644 --- a/src/ui/Forms/BinaryEdit/BinEdit.cs +++ b/src/ui/Forms/BinaryEdit/BinEdit.cs @@ -318,6 +318,7 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit CleanUp(); var log = new StringBuilder(); var bluRaySubtitles = BluRaySupParser.ParseBluRaySup(fileName, log); + FixShortDisplayTimes(bluRaySubtitles); _subtitle = new Subtitle(); _extra = new List(); bool first = true; @@ -402,6 +403,26 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit Text = Path.GetFileName(fileName) + " - " + LanguageSettings.Current.General.Title; } + private void FixShortDisplayTimes(List bluRaySubtitles) + { + for (int i = 0; i < bluRaySubtitles.Count; i++) + { + var p = bluRaySubtitles[i]; + if (p.EndTime <= p.StartTime) + { + var newEndTime = p.StartTimeCode.TotalMilliseconds + Configuration.Settings.VobSubOcr.DefaultMillisecondsForUnknownDurations; + if (i >= bluRaySubtitles.Count - 1 || bluRaySubtitles[i + 1].StartTimeCode.TotalMilliseconds < newEndTime) + { + p.EndTime = (long)Math.Round(newEndTime * 90.0, MidpointRounding.AwayFromZero); + } + else + { + p.EndTime = bluRaySubtitles[i + 1].StartTime + 90; + } + } + } + } + private void FillListView(Subtitle subtitle) { if (subtitle == null)