Skip to content

Commit

Permalink
Subtitles: Make both DVD subtitles show in case of overlap
Browse files Browse the repository at this point in the history
Makes behavior consistent with VLC and mplayer/libavcodec DVD
subtitle implementations. Sets the StopTime of the subtitle
before the same as the StartTime of the currently added DVD
subtitle.

Backport of MPC-HC commit f478e57
  • Loading branch information
jeeb committed Mar 28, 2013
1 parent 012525d commit cb07623
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/subtitles/VobSubFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2241,6 +2241,16 @@ void CVobSubStream::Add(REFERENCE_TIME tStart, REFERENCE_TIME tStop, BYTE* pData
m_subpics.RemoveTail();
m_img.iIdx = -1;
}

// We can only render one subpicture at a time, thus if there is overlap
// we have to fix it. tStop = tStart seems to work.
if (m_subpics.GetCount() && m_subpics.GetTail()->tStop > p->tStart) {
TRACE(_T("[CVobSubStream::Add] Vobsub timestamp overlap detected! ")
_T("Subpicture #%d, StopTime %I64d > %I64d (Next StartTime), making them equal!\n"),
m_subpics.GetCount(), m_subpics.GetTail()->tStop, p->tStart);
m_subpics.GetTail()->tStop = p->tStart;
}

m_subpics.AddTail(p);
}

Expand Down

0 comments on commit cb07623

Please sign in to comment.