Skip to content

Commit

Permalink
Опция "Только форсированные" теперь работает с PGS/DVB так же как и с…
Browse files Browse the repository at this point in the history
… текстовыми, смотрим в имени сабов "forced". В PGS субтитрах остается "фильтрация" по флагу forced в CompositionObject.
  • Loading branch information
Aleksoid1978 committed Aug 5, 2024
1 parent 385a4d6 commit 31dd224
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/Subtitles/BaseSub.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class CBaseSub

HRESULT SetConvertType(LPCWSTR _yuvMatrix, ColorConvert::convertType _convertType);

void SetForced(bool bForced) { m_bForced = bForced; }

protected :
SUBTITLE_TYPE m_nType;

Expand All @@ -64,4 +66,6 @@ protected :

YUVMATRIX yuvMatrix = {};
ColorConvert::convertType convertType;

bool m_bForced = false;
};
7 changes: 6 additions & 1 deletion src/Subtitles/DVBSub.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) 2006-2023 see Authors.txt
* (C) 2006-2024 see Authors.txt
*
* This file is part of MPC-BE.
*
Expand Down Expand Up @@ -395,6 +395,11 @@ POSITION CDVBSub::GetStartPosition(REFERENCE_TIME rt, double fps, bool CleanOld/
if (CleanOld) {
CDVBSub::CleanOld(rt);
}

if (g_bForcedSubtitle && !m_bForced) {
return nullptr;
}

POSITION pos = m_pages.GetHeadPosition();
while (pos) {
DVB_PAGE* pPage = m_pages.GetAt(pos);
Expand Down
5 changes: 3 additions & 2 deletions src/Subtitles/HdmvSub.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) 2006-2023 see Authors.txt
* (C) 2006-2024 see Authors.txt
*
* This file is part of MPC-BE.
*
Expand Down Expand Up @@ -54,7 +54,8 @@ POSITION CHdmvSub::GetStartPosition(REFERENCE_TIME rt, double fps, bool CleanOld
POSITION pos = m_pObjects.GetHeadPosition();
while (pos) {
const CompositionObject* pObject = m_pObjects.GetAt(pos);
if (pObject->m_rtStop <= rt || (g_bForcedSubtitle && !pObject->m_forced_on_flag)) {
auto skipForced = pObject->m_forced_on_flag ? false : g_bForcedSubtitle && !m_bForced;
if (pObject->m_rtStop <= rt || skipForced) {
m_pObjects.GetNext(pos);
} else {
break;
Expand Down
5 changes: 5 additions & 0 deletions src/Subtitles/RenderedHdmvSubtitle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ CRenderedHdmvSubtitle::CRenderedHdmvSubtitle(CCritSec* pLock, SUBTITLE_TYPE nTyp
ASSERT(FALSE);
m_pSub = nullptr;
}

if (m_pSub) {
auto bForced = (CString(name).MakeLower().Find(L"forced") >= 0);
m_pSub->SetForced(bForced);
}
}

CRenderedHdmvSubtitle::CRenderedHdmvSubtitle(CCritSec* pLock)
Expand Down

0 comments on commit 31dd224

Please sign in to comment.