Fix overlapping time codes in vobsub embedded inside mkv files (some versions of Handbrake makes overlapping time codes - thx Hawke)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@408 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-04-22 07:29:43 +00:00
parent ceb00b5960
commit 8959eb7529

View File

@ -5035,6 +5035,7 @@ namespace Nikse.SubtitleEdit.Forms
MakeHistoryForUndo(_language.BeforeImportFromMatroskaFile);
_subtitleListViewIndex = -1;
_subtitle.Paragraphs.Clear();
List<VobSubMergedPack> mergedVobSubPacks = new List<VobSubMergedPack>();
Nikse.SubtitleEdit.Logic.VobSub.Idx idx = new Logic.VobSub.Idx(matroskaSubtitleInfo.CodecPrivate.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries));
foreach (SubtitleSequence p in sub)
@ -5065,6 +5066,10 @@ namespace Nikse.SubtitleEdit.Forms
mergedVobSubPacks.Add(new VobSubMergedPack(p.BinaryData, TimeSpan.FromMilliseconds(p.StartMilliseconds), 32, null));
}
mergedVobSubPacks[mergedVobSubPacks.Count - 1].EndTime = TimeSpan.FromMilliseconds(p.EndMilliseconds);
// fix overlapping (some versions of Handbrake makes overlapping time codes - thx Hawke)
if (mergedVobSubPacks.Count > 1 && mergedVobSubPacks[mergedVobSubPacks.Count - 2].EndTime > mergedVobSubPacks[mergedVobSubPacks.Count - 1].StartTime)
mergedVobSubPacks[mergedVobSubPacks.Count - 2].EndTime = TimeSpan.FromMilliseconds(mergedVobSubPacks[mergedVobSubPacks.Count - 1].StartTime.TotalMilliseconds - 1);
}
var formSubOcr = new VobSubOcr();