diff options
author | Casimir666 <casimir666@users.sourceforge.net> | 2008-12-20 17:35:34 +0300 |
---|---|---|
committer | Casimir666 <casimir666@users.sourceforge.net> | 2008-12-20 17:35:34 +0300 |
commit | 162bbc48209c6d11e67d7ca31470bec667682e21 (patch) | |
tree | ba913c573bfa678f51a5fd55077600928859d810 /src/subtitles/HdmvSub.cpp | |
parent | e251ccc93101960713ccde6a2d87b36a37ca5495 (diff) |
FIXED : Bugs on presentation graphics (missing subtitles, better synchronization)
FIXED : Audio change on M2TS files reset the selected subtitle
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@931 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/subtitles/HdmvSub.cpp')
-rw-r--r-- | src/subtitles/HdmvSub.cpp | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/src/subtitles/HdmvSub.cpp b/src/subtitles/HdmvSub.cpp index 1c4bda8ce..929ac9ce3 100644 --- a/src/subtitles/HdmvSub.cpp +++ b/src/subtitles/HdmvSub.cpp @@ -150,20 +150,17 @@ HRESULT CHdmvSub::ParseSample(IMediaSample* pSample) case PRESENTATION_SEG :
TRACE_HDMVSUB ("CHdmvSub:PRESENTATION_SEG %S (size=%d)\n", ReftimeToString(rtStart), m_nSegSize);
- if (ParsePresentationSegment(&SegmentBuffer, rtStart) > 0)
+ if (m_pCurrentObject)
{
- m_pCurrentObject->m_rtStart = rtStart;
- m_pCurrentObject->m_rtStop = rtStart + 1;
+ m_pCurrentObject->m_rtStop = rtStart;
+ TRACE_HDMVSUB ("CHdmvSub:HDMV : %S => %S\n", ReftimeToString (m_pCurrentObject->m_rtStart), ReftimeToString(rtStart));
+ m_pCurrentObject = NULL;
}
- else
+
+ if (ParsePresentationSegment(&SegmentBuffer) > 0)
{
- if (m_pCurrentObject)
- {
- m_pCurrentObject->m_rtStop = rtStart;
- m_pObjects.AddTail (m_pCurrentObject);
- TRACE_HDMVSUB ("CHdmvSub:HDMV : %S => %S\n", ReftimeToString (m_pCurrentObject->m_rtStart), ReftimeToString(rtStart));
- m_pCurrentObject = NULL;
- }
+ m_pCurrentObject->m_rtStart = rtStart;
+ m_pCurrentObject->m_rtStop = _I64_MAX;
}
break;
case WINDOW_DEF :
@@ -185,7 +182,7 @@ HRESULT CHdmvSub::ParseSample(IMediaSample* pSample) return hr;
}
-int CHdmvSub::ParsePresentationSegment(CGolombBuffer* pGBuffer, REFERENCE_TIME rtStart)
+int CHdmvSub::ParsePresentationSegment(CGolombBuffer* pGBuffer)
{
COMPOSITION_DESCRIPTOR CompositionDescriptor;
BYTE nObjectNumber;
@@ -200,12 +197,7 @@ int CHdmvSub::ParsePresentationSegment(CGolombBuffer* pGBuffer, REFERENCE_TIME r if (nObjectNumber > 0)
{
- if (m_pCurrentObject)
- {
- m_pCurrentObject->m_rtStop = rtStart;
- m_pObjects.AddTail (m_pCurrentObject);
- }
-
+ ASSERT (m_pCurrentObject == NULL);
m_pCurrentObject = new CompositionObject();
ParseCompositionObject (pGBuffer, m_pCurrentObject);
}
@@ -252,6 +244,12 @@ void CHdmvSub::ParseObject(CGolombBuffer* pGBuffer, USHORT nUnitSize) // #498 }
else
m_pCurrentObject->AppendRLEData (pGBuffer->GetBufferPos(), nUnitSize-4);
+
+ if (m_pCurrentObject->IsRLEComplete())
+ {
+ m_pObjects.AddTail (m_pCurrentObject);
+ TRACE_HDMVSUB ("CHdmvSub:HDMV : %S added\n", ReftimeToString (m_pCurrentObject->m_rtStart));
+ }
}
}
@@ -288,6 +286,20 @@ void CHdmvSub::ParseCompositionDescriptor(CGolombBuffer* pGBuffer, COMPOSITION_D pCompositionDescriptor->bState = pGBuffer->ReadByte();
}
+
+HRESULT CHdmvSub::UpdateStop(REFERENCE_TIME rtStart, REFERENCE_TIME* rtStop)
+{
+ CompositionObject* pObject = FindObject (rtStart);
+
+ if (pObject && pObject->m_rtStart == rtStart && pObject->m_rtStop != _I64_MAX)
+ {
+ *rtStop = pObject->m_rtStop;
+ return S_OK;
+ }
+
+ return S_FALSE;
+}
+
void CHdmvSub::Render(SubPicDesc& spd, REFERENCE_TIME rt, RECT& bbox)
{
CompositionObject* pObject = FindObject (rt);
@@ -330,7 +342,6 @@ HRESULT CHdmvSub::GetTextureSize (POSITION pos, SIZE& MaxTextureSize, SIZE& Vide return E_INVALIDARG;
}
-
void CHdmvSub::Reset()
{
CompositionObject* pObject;
|