diff options
author | Aleksoid <aleksoid@users.sourceforge.net> | 2011-09-12 04:30:00 +0400 |
---|---|---|
committer | Aleksoid <aleksoid@users.sourceforge.net> | 2011-09-12 04:30:00 +0400 |
commit | ad75df50e8c3b86ec44366d8f6900daeab87527b (patch) | |
tree | 0728cb108f9f137d854998e6106f1c6cfaa312db /src/Subtitles | |
parent | 1a3c70ab64086693a41d679a3e423fbd233a957a (diff) |
Fix : Some BluRay (PGS) subtitle from M2Ts are not displayed, partially fix ticket #48.
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@3720 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/Subtitles')
-rw-r--r-- | src/Subtitles/CompositionObject.h | 1 | ||||
-rw-r--r-- | src/Subtitles/HdmvSub.cpp | 22 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/Subtitles/CompositionObject.h b/src/Subtitles/CompositionObject.h index 21e8f4406..da9da3962 100644 --- a/src/Subtitles/CompositionObject.h +++ b/src/Subtitles/CompositionObject.h @@ -44,6 +44,7 @@ public : bool m_object_cropped_flag;
bool m_forced_on_flag;
BYTE m_version_number;
+ BYTE m_nObjectNumber;
SHORT m_horizontal_position;
SHORT m_vertical_position;
diff --git a/src/Subtitles/HdmvSub.cpp b/src/Subtitles/HdmvSub.cpp index 04146eb89..0c7e3591a 100644 --- a/src/Subtitles/HdmvSub.cpp +++ b/src/Subtitles/HdmvSub.cpp @@ -25,9 +25,9 @@ #include "../DSUtil/GolombBuffer.h"
#if (0) // Set to 1 to activate HDMV subtitles traces
-#define TRACE_HDMVSUB TRACE
+ #define TRACE_HDMVSUB TRACE
#else
-#define TRACE_HDMVSUB
+ #define TRACE_HDMVSUB
#endif
@@ -150,13 +150,18 @@ HRESULT CHdmvSub::ParseSample(IMediaSample* pSample) ParsePalette(&SegmentBuffer, m_nSegSize);
break;
case OBJECT :
- //TRACE_HDMVSUB ("CHdmvSub:OBJECT %S\n", ReftimeToString(rtStart));
+ TRACE_HDMVSUB ("CHdmvSub:OBJECT %S\n", ReftimeToString(rtStart));
ParseObject(&SegmentBuffer, m_nSegSize);
break;
case PRESENTATION_SEG :
TRACE_HDMVSUB ("CHdmvSub:PRESENTATION_SEG %S (size=%d)\n", ReftimeToString(rtStart), m_nSegSize);
if (m_pCurrentObject) {
+ TRACE_HDMVSUB ("CHdmvSub:PRESENTATION_SEG %d\n", m_pCurrentObject->m_nObjectNumber);
+ if(m_pCurrentObject->m_nObjectNumber > 1) {
+ m_pCurrentObject->m_nObjectNumber--;
+ break;
+ }
m_pCurrentObject->m_rtStop = rtStart;
m_pObjects.AddTail (m_pCurrentObject);
TRACE_HDMVSUB ("CHdmvSub:HDMV : %S => %S\n", ReftimeToString (m_pCurrentObject->m_rtStart), ReftimeToString(rtStart));
@@ -200,10 +205,15 @@ int CHdmvSub::ParsePresentationSegment(CGolombBuffer* pGBuffer) pGBuffer->ReadByte(); //palette_id_ref = pGBuffer->ReadByte();
nObjectNumber = pGBuffer->ReadByte();
+ TRACE_HDMVSUB( "CHdmvSub::ParsePresentationSegment Size = %d, nObjectNumber = %d\n", pGBuffer->GetSize(), nObjectNumber);
+
if (nObjectNumber > 0) {
delete m_pCurrentObject;
m_pCurrentObject = DNew CompositionObject();
- ParseCompositionObject (pGBuffer, m_pCurrentObject);
+ m_pCurrentObject->m_nObjectNumber = nObjectNumber;
+ for(int i=0; i<nObjectNumber; i++) {
+ ParseCompositionObject (pGBuffer, m_pCurrentObject);
+ }
}
return nObjectNumber;
@@ -298,7 +308,9 @@ void CHdmvSub::Render(SubPicDesc& spd, REFERENCE_TIME rt, RECT& bbox) ASSERT (pObject!=NULL && spd.w >= (pObject->m_horizontal_position + pObject->m_width) && spd.h >= (pObject->m_vertical_position + pObject->m_height));
- if (pObject && spd.w >= (pObject->m_horizontal_position + pObject->m_width) && spd.h >= (pObject->m_vertical_position + pObject->m_height)) {
+ if (pObject && pObject->GetRLEDataSize() && pObject->m_width > 0 && pObject->m_height > 0 &&
+ spd.w >= (pObject->m_horizontal_position + pObject->m_width) &&
+ spd.h >= (pObject->m_vertical_position + pObject->m_height)) {
if (!pObject->HavePalette()) {
pObject->SetPalette (m_nDefaultPaletteNbEntry, m_pDefaultPalette, m_VideoDescriptor.nVideoWidth>720);
}
|