Some fixes for dvb subs - thx marse end :)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2364 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2014-01-11 12:34:40 +00:00
parent 4f9ed5e5d0
commit 05bfbcba9c
2 changed files with 18 additions and 13 deletions

View File

@ -7075,21 +7075,25 @@ namespace Nikse.SubtitleEdit.Forms
private void MergeDvbForEachSubImage()
{
for (int i = 0; i < _dvbSubtitles.Count; i++)
int i = 0;
while (i < _dvbSubtitles.Count)
{
var dvbSub = _dvbSubtitles[i];
if (dvbSub.ActiveImageIndex.HasValue && dvbSub.ActiveImageIndex > 0)
dvbSub.ActiveImageIndex = null;
if (i < _dvbSubtitles.Count - 1 && dvbSub.Pes == _dvbSubtitles[i + 1].Pes)
{
_dvbSubtitles.RemoveAt(i);
string oldText = _subtitle.Paragraphs[i].Text;
_subtitle.Paragraphs.RemoveAt(i);
var prev = _subtitle.GetParagraphOrDefault(i - 1);
if (prev != null)
prev.Text = (prev.Text + Environment.NewLine + oldText).Trim();
var next = _subtitle.GetParagraphOrDefault(i + 1);
if (!string.IsNullOrEmpty(next.Text))
{
var p = _subtitle.Paragraphs[i];
p.Text = (p.Text + Environment.NewLine + next.Text).Trim();
}
_subtitle.Paragraphs.RemoveAt(i + 1);
_dvbSubtitles.RemoveAt(i + 1);
}
else
{
dvbSub.ActiveImageIndex = null;
i++;
}
}
_tesseractAsyncStrings = null;
@ -7111,8 +7115,9 @@ namespace Nikse.SubtitleEdit.Forms
newDbvSub.Pes = dvbSub.Pes;
newDbvSub.ActiveImageIndex = i;
newDbvSub.StartMilliseconds = dvbSub.StartMilliseconds;
newDbvSub.EndMilliseconds = dvbSub.EndMilliseconds;
list.Add(newDbvSub);
newDbvSub.EndMilliseconds = dvbSub.EndMilliseconds;
if (newDbvSub.Pes.ObjectDataList[i].TopFieldDataBlockLength > 8)
list.Add(newDbvSub);
}
}
else

View File

@ -40,6 +40,8 @@ namespace Nikse.SubtitleEdit.Logic.TransportStream
ObjectVersionNumber = buffer[index + 2] >> 4;
ObjectCodingMethod = (buffer[index + 2] & Helper.B00001100) >> 2;
NonModifyingColorFlag = (buffer[index + 2] & Helper.B00000010) > 0;
TopFieldDataBlockLength = Helper.GetEndianWord(buffer, index + 3);
BottomFieldDataBlockLength = Helper.GetEndianWord(buffer, index + 5);
BufferIndex = index;
}
@ -53,8 +55,6 @@ namespace Nikse.SubtitleEdit.Logic.TransportStream
int pixelCode = 0;
int runLength = 0;
TopFieldDataBlockLength = Helper.GetEndianWord(buffer, index + 3);
BottomFieldDataBlockLength = Helper.GetEndianWord(buffer, index + 5);
int dataType = buffer[index + 7];
int length = TopFieldDataBlockLength;