Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksoid <aleksoid@users.sourceforge.net>2012-03-27 02:26:45 +0400
committerAleksoid <aleksoid@users.sourceforge.net>2012-03-27 02:26:45 +0400
commit14580e632cdf2720a34bdb2c7037db0396627f50 (patch)
treef68d5c497ba4d31576ef0cc932d53e0eb8b9b47e /src/Subtitles
parent95a770d8d3421363ddee103de1829319faf9089c (diff)
Fix : DVB Subtitles - wrong duration, ticket #2101; refactoring some code;
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4197 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/Subtitles')
-rw-r--r--src/Subtitles/CompositionObject.cpp16
-rw-r--r--src/Subtitles/DVBSub.cpp20
-rw-r--r--src/Subtitles/HdmvSub.cpp2
3 files changed, 18 insertions, 20 deletions
diff --git a/src/Subtitles/CompositionObject.cpp b/src/Subtitles/CompositionObject.cpp
index c672bba29..7b79023e9 100644
--- a/src/Subtitles/CompositionObject.cpp
+++ b/src/Subtitles/CompositionObject.cpp
@@ -44,18 +44,12 @@ CompositionObject::~CompositionObject()
void CompositionObject::SetPalette (int nNbEntry, HDMV_PALETTE* pPalette, bool bIsHD)
{
- m_nColorNumber = nNbEntry;
-
- for (int i=0; i<m_nColorNumber; i++) {
- // if (pPalette[i].T != 0) // Prevent ugly background when Alpha=0 (but RGB different from 0)
- {
- if (bIsHD) {
- m_Colors[pPalette[i].entry_id] = YCrCbToRGB_Rec709 (pPalette[i].T, pPalette[i].Y, pPalette[i].Cr, pPalette[i].Cb);
- } else {
- m_Colors[pPalette[i].entry_id] = YCrCbToRGB_Rec601 (pPalette[i].T, pPalette[i].Y, pPalette[i].Cr, pPalette[i].Cb);
- }
+ for (int i=0; i<nNbEntry; i++) {
+ if (bIsHD) {
+ m_Colors[pPalette[i].entry_id] = YCrCbToRGB_Rec709 (pPalette[i].T, pPalette[i].Y, pPalette[i].Cr, pPalette[i].Cb);
+ } else {
+ m_Colors[pPalette[i].entry_id] = YCrCbToRGB_Rec601 (pPalette[i].T, pPalette[i].Y, pPalette[i].Cr, pPalette[i].Cb);
}
- // TRACE_HDMVSUB ("%03d : %08x\n", pPalette[i].entry_id, m_Colors[pPalette[i].entry_id]);
}
}
diff --git a/src/Subtitles/DVBSub.cpp b/src/Subtitles/DVBSub.cpp
index 8374c5246..a736fd1fb 100644
--- a/src/Subtitles/DVBSub.cpp
+++ b/src/Subtitles/DVBSub.cpp
@@ -232,6 +232,8 @@ HRESULT CDVBSub::ParseSample(IMediaSample* pSample)
while (!gb.IsEOF()) {
if (gb.ReadByte() == 0x0F) {
+ TRACE_DVB ("DVB - ParseSample\n");
+
WORD wPageId;
WORD wSegLength;
@@ -250,12 +252,16 @@ HRESULT CDVBSub::ParseSample(IMediaSample* pSample)
ParsePage(gb, wSegLength, pPage);
if (pPage->PageState == DPS_ACQUISITION) {
+ if(m_pCurrentPage != NULL) {
+ m_pCurrentPage->rtStop = max(m_pCurrentPage->rtStop, m_rtStart);
+ m_Pages.AddTail (m_pCurrentPage.Detach());
+ }
UpdateTimeStamp(m_rtStart);
m_pCurrentPage = pPage;
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));
+ TRACE_DVB ("DVB - Page started %S, TimeOut = %d\n", ReftimeToString(m_rtStart), m_pCurrentPage->PageTimeOut);
} else {
TRACE_DVB ("DVB - Page update\n");
}
@@ -267,7 +273,7 @@ HRESULT CDVBSub::ParseSample(IMediaSample* pSample)
break;
case CLUT :
ParseClut(gb, wSegLength);
- TRACE_DVB ("DVB - Clut \n");
+ TRACE_DVB ("DVB - Clut\n");
break;
case OBJECT :
ParseObject(gb, wSegLength);
@@ -278,7 +284,8 @@ HRESULT CDVBSub::ParseSample(IMediaSample* pSample)
TRACE_DVB ("DVB - Display\n");
break;
case END_OF_DISPLAY :
- if (m_pCurrentPage != NULL) {
+ if (m_pCurrentPage != NULL && (m_pCurrentPage->rtStart != m_rtStart)) {
+ m_pCurrentPage->rtStop = max(m_pCurrentPage->rtStop, m_rtStart);
TRACE_DVB ("DVB - End display %S - %S\n", ReftimeToString(m_pCurrentPage->rtStart), ReftimeToString(m_pCurrentPage->rtStop));
m_Pages.AddTail (m_pCurrentPage.Detach());
}
@@ -311,7 +318,7 @@ void CDVBSub::Render(SubPicDesc& spd, REFERENCE_TIME rt, RECT& bbox)
nY = pRegion->VertAddr + pRegion->Objects[j].object_vertical_position;
pObject->m_width = pRegion->width;
pObject->m_height = pRegion->height;
- pObject->SetPalette(pRegion->Clut.Size, pRegion->Clut.Palette, false);
+ pObject->SetPalette(pRegion->Clut.Size, pRegion->Clut.Palette, m_Display.width > 720);
pObject->RenderDvb(spd, nX, nY);
}
}
@@ -347,9 +354,6 @@ POSITION CDVBSub::GetStartPosition(REFERENCE_TIME rt, double fps)
if (!pPage->Rendered) {
TRACE_DVB ("DVB - remove unrendered object, %S - %S\n", ReftimeToString(pPage->rtStart), ReftimeToString(pPage->rtStop));
}
-
- //TRACE_HDMVSUB ("CHdmvSub:HDMV remove object %d %S => %S (rt=%S)\n", pPage->GetRLEDataSize(),
- // ReftimeToString (pPage->rtStart), ReftimeToString(pPage->rtStop), ReftimeToString(rt));
m_Pages.RemoveHead();
delete pPage;
} else {
@@ -373,7 +377,7 @@ REFERENCE_TIME CDVBSub::GetStart(POSITION nPos)
return pPage!=NULL ? pPage->rtStart : INVALID_TIME;
}
-REFERENCE_TIME CDVBSub::GetStop(POSITION nPos)
+REFERENCE_TIME CDVBSub::GetStop(POSITION nPos)
{
DVB_PAGE* pPage = m_Pages.GetAt(nPos);
return pPage!=NULL ? pPage->rtStop : INVALID_TIME;
diff --git a/src/Subtitles/HdmvSub.cpp b/src/Subtitles/HdmvSub.cpp
index df66d3231..96f742705 100644
--- a/src/Subtitles/HdmvSub.cpp
+++ b/src/Subtitles/HdmvSub.cpp
@@ -239,7 +239,7 @@ void CHdmvSub::ParsePalette(CGolombBuffer* pGBuffer, USHORT nSize) // #497
memcpy (m_pDefaultPalette, pPalette, nNbEntry*sizeof(HDMV_PALETTE));
if (m_pCurrentObject) {
- m_pCurrentObject->SetPalette (nNbEntry, pPalette, m_VideoDescriptor.nVideoWidth>720);
+ m_pCurrentObject->SetPalette (nNbEntry, pPalette, m_VideoDescriptor.nVideoWidth > 720);
}
}