diff options
author | Aleksoid <aleksoid@users.sourceforge.net> | 2012-03-16 16:25:29 +0400 |
---|---|---|
committer | Aleksoid <aleksoid@users.sourceforge.net> | 2012-03-16 16:25:29 +0400 |
commit | 09463d6ff3ad5214d9093df9ce33d0022b6958b6 (patch) | |
tree | b4a71b1076a604bdec0005ce207533978b47accf /src/Subtitles | |
parent | 3700d3cb5ab61febc728daf687f722f2de60958c (diff) |
Fix : DVB Subtitle - improve parser and displaying;
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4150 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/Subtitles')
-rw-r--r-- | src/Subtitles/DVBSub.cpp | 27 | ||||
-rw-r--r-- | src/Subtitles/DVBSub.h | 2 |
2 files changed, 24 insertions, 5 deletions
diff --git a/src/Subtitles/DVBSub.cpp b/src/Subtitles/DVBSub.cpp index f38ab8629..2be4a9f33 100644 --- a/src/Subtitles/DVBSub.cpp +++ b/src/Subtitles/DVBSub.cpp @@ -250,10 +250,12 @@ HRESULT CDVBSub::ParseSample(IMediaSample* pSample) ParsePage(gb, wSegLength, pPage);
if (pPage->PageState == DPS_ACQUISITION) {
+ UpdateTimeStamp(m_rtStart);
+
m_pCurrentPage = pPage;
- m_pCurrentPage->rtStart = m_rtStart;
+ m_pCurrentPage->rtStart = m_rtStart;
+ m_pCurrentPage->rtStop = m_pCurrentPage->rtStart + m_pCurrentPage->PageTimeOut * 1000000;
TRACE_DVB ("DVB - Page started %S\n", ReftimeToString(m_rtStart));
- m_rtStart = INVALID_TIME;
} else {
TRACE_DVB ("DVB - Page update\n");
}
@@ -273,16 +275,15 @@ HRESULT CDVBSub::ParseSample(IMediaSample* pSample) break;
case DISPLAY :
ParseDisplay(gb, wSegLength);
+ TRACE_DVB ("DVB - Display\n");
break;
case END_OF_DISPLAY :
- if (m_pCurrentPage != NULL && m_rtStart != INVALID_TIME) {
- m_pCurrentPage->rtStop = m_rtStart;
+ if (m_pCurrentPage != NULL) {
TRACE_DVB ("DVB - End display %S - %S\n", ReftimeToString(m_pCurrentPage->rtStart), ReftimeToString(m_pCurrentPage->rtStop));
m_Pages.AddTail (m_pCurrentPage.Detach());
}
break;
default :
- // gb.SkipBytes(wSegLength);
break;
}
nLastPos = gb.GetPos();
@@ -555,3 +556,19 @@ HRESULT CDVBSub::ParseObject(CGolombBuffer& gb, WORD wSegLength) return hr;
}
+
+HRESULT CDVBSub::UpdateTimeStamp(REFERENCE_TIME rtStop)
+{
+ HRESULT hr = E_FAIL;
+ POSITION pos = m_Pages.GetHeadPosition();
+ while (pos) {
+ DVB_PAGE* pPage = m_Pages.GetAt (pos);
+ if (pPage->rtStop > rtStop) {
+ pPage->rtStop = rtStop;
+ hr = S_OK;
+ }
+ m_Pages.GetNext(pos);
+ }
+
+ return hr;
+}
\ No newline at end of file diff --git a/src/Subtitles/DVBSub.h b/src/Subtitles/DVBSub.h index c4c441498..a21d29dce 100644 --- a/src/Subtitles/DVBSub.h +++ b/src/Subtitles/DVBSub.h @@ -211,4 +211,6 @@ private: HRESULT ParseClut(CGolombBuffer& gb, WORD wSegLength);
HRESULT ParseObject(CGolombBuffer& gb, WORD wSegLength);
+ HRESULT UpdateTimeStamp(REFERENCE_TIME rtStop);
+
};
|