Fix missing end time for bdsup in bdsup-edit - thx Jamakmake :)

This commit is contained in:
niksedk 2021-12-11 21:31:42 +01:00
parent c54e87f62f
commit f8e6a6372a

View File

@ -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<Extra>();
bool first = true;
@ -402,6 +403,26 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
Text = Path.GetFileName(fileName) + " - " + LanguageSettings.Current.General.Title;
}
private void FixShortDisplayTimes(List<BluRaySupParser.PcsData> 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)