diff options
author | kasper93 <kasper93@gmail.com> | 2014-05-03 18:44:22 +0400 |
---|---|---|
committer | kasper93 <kasper93@gmail.com> | 2014-05-11 20:16:01 +0400 |
commit | 9d44eda3ac264c275763cb095baec91f67d35cf9 (patch) | |
tree | 781dc15d5a7f53b412bd22f8d2bfe34d36efa9ac /src/filters/transform | |
parent | 26ec37f906879ee78acec7a7848cac9243029ced (diff) |
VSFilter: Apply default style changes on runtime. No need to reload anymore.
Don't set subtitle again when manipulating style.
Diffstat (limited to 'src/filters/transform')
-rw-r--r-- | src/filters/transform/VSFilter/DirectVobSub.cpp | 12 | ||||
-rw-r--r-- | src/filters/transform/VSFilter/DirectVobSubFilter.cpp | 51 | ||||
-rw-r--r-- | src/filters/transform/VSFilter/DirectVobSubFilter.h | 2 |
3 files changed, 55 insertions, 10 deletions
diff --git a/src/filters/transform/VSFilter/DirectVobSub.cpp b/src/filters/transform/VSFilter/DirectVobSub.cpp index ee32bdd2e..10850e190 100644 --- a/src/filters/transform/VSFilter/DirectVobSub.cpp +++ b/src/filters/transform/VSFilter/DirectVobSub.cpp @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2013 see Authors.txt
+ * (C) 2006-2014 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -751,7 +751,7 @@ STDMETHODIMP CDirectVobSub::put_TextSettings(STSStyle* pDefStyle) CAutoLock cAutoLock(&m_propsLock);
- if (!memcmp(&m_defStyle, pDefStyle, sizeof(m_defStyle))) {
+ if (m_defStyle == *pDefStyle) {
return S_FALSE;
}
@@ -762,6 +762,8 @@ STDMETHODIMP CDirectVobSub::put_TextSettings(STSStyle* pDefStyle) STDMETHODIMP CDirectVobSub::get_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType)
{
+ CheckPointer(ePARCompensationType, E_POINTER);
+
CAutoLock cAutoLock(&m_propsLock);
*ePARCompensationType = m_ePARCompensationType;
@@ -771,8 +773,14 @@ STDMETHODIMP CDirectVobSub::get_AspectRatioSettings(CSimpleTextSubtitle::EPARCom STDMETHODIMP CDirectVobSub::put_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType)
{
+ CheckPointer(ePARCompensationType, E_POINTER);
+
CAutoLock cAutoLock(&m_propsLock);
+ if (m_ePARCompensationType == *ePARCompensationType) {
+ return S_FALSE;
+ }
+
m_ePARCompensationType = *ePARCompensationType;
return S_OK;
diff --git a/src/filters/transform/VSFilter/DirectVobSubFilter.cpp b/src/filters/transform/VSFilter/DirectVobSubFilter.cpp index bc0382045..4e5371cff 100644 --- a/src/filters/transform/VSFilter/DirectVobSubFilter.cpp +++ b/src/filters/transform/VSFilter/DirectVobSubFilter.cpp @@ -56,7 +56,6 @@ CDirectVobSubFilter::CDirectVobSubFilter(LPUNKNOWN punk, HRESULT* phr, const GUI , m_hfont(0)
, m_fps(25.0)
, m_fMSMpeg4Fix(false)
- , m_nSubtitleId(DWORD_PTR(-1))
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
{
@@ -1036,7 +1035,22 @@ STDMETHODIMP CDirectVobSubFilter::put_Placement(bool fOverridePlacement, int xpe HRESULT hr = CDirectVobSub::put_Placement(fOverridePlacement, xperc, yperc);
if (hr == NOERROR) {
- UpdateSubtitle();
+ if (auto pRTS = dynamic_cast<CRenderedTextSubtitle*>((ISubStream*)m_pCurrentSubStream)) {
+ {
+ CAutoLock cAutoLock(&m_csSubLock);
+
+ pRTS->SetAlignment(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc);
+ pRTS->Deinit();
+ }
+ InvalidateSubtitle();
+ } else if (auto pVSS = dynamic_cast<CVobSubSettings*>((ISubStream*)m_pCurrentSubStream)) {
+ {
+ CAutoLock cAutoLock(&m_csSubLock);
+
+ pVSS->SetAlignment(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc);
+ }
+ InvalidateSubtitle();
+ }
}
return hr;
@@ -1127,7 +1141,15 @@ STDMETHODIMP CDirectVobSubFilter::put_TextSettings(STSStyle* pDefStyle) HRESULT hr = CDirectVobSub::put_TextSettings(pDefStyle);
if (hr == NOERROR) {
- UpdateSubtitle();
+ if (auto pRTS = dynamic_cast<CRenderedTextSubtitle*>((ISubStream*)m_pCurrentSubStream)) {
+ {
+ CAutoLock cAutoLock(&m_csSubLock);
+
+ pRTS->SetDefaultStyle(m_defStyle);
+ pRTS->Deinit();
+ }
+ InvalidateSubtitle();
+ }
}
return hr;
@@ -1138,7 +1160,22 @@ STDMETHODIMP CDirectVobSubFilter::put_AspectRatioSettings(CSimpleTextSubtitle::E HRESULT hr = CDirectVobSub::put_AspectRatioSettings(ePARCompensationType);
if (hr == NOERROR) {
- UpdateSubtitle();
+ if (auto pRTS = dynamic_cast<CRenderedTextSubtitle*>((ISubStream*)m_pCurrentSubStream)) {
+ {
+ CAutoLock cAutoLock(&m_csSubLock);
+
+ pRTS->m_ePARCompensationType = m_ePARCompensationType;
+ if (m_CurrentVIH2.dwPictAspectRatioX && m_CurrentVIH2.dwPictAspectRatioY && m_CurrentVIH2.bmiHeader.biWidth && m_CurrentVIH2.bmiHeader.biHeight) {
+ pRTS->m_dPARCompensation = ((double)abs(m_CurrentVIH2.bmiHeader.biWidth) / (double)abs(m_CurrentVIH2.bmiHeader.biHeight)) /
+ ((double)abs((long)m_CurrentVIH2.dwPictAspectRatioX) / (double)abs((long)m_CurrentVIH2.dwPictAspectRatioY));
+ } else {
+ pRTS->m_dPARCompensation = 1.00;
+ }
+
+ pRTS->Deinit();
+ }
+ InvalidateSubtitle();
+ }
}
return hr;
@@ -1624,7 +1661,7 @@ void CDirectVobSubFilter::SetSubtitle(ISubStream* pSubStream) i += pSubStream2->GetStreamCount();
}
- m_nSubtitleId = (DWORD_PTR)pSubStream;
+ m_pCurrentSubStream = pSubStream;
if (m_pSubPicQueue) {
m_pSubPicQueue->SetSubPicProvider(CComQIPtr<ISubPicProvider>(pSubStream));
@@ -1636,7 +1673,7 @@ void CDirectVobSubFilter::InvalidateSubtitle(REFERENCE_TIME rtInvalidate /*= -1* CAutoLock cAutolock(&m_csQueueLock);
if (m_pSubPicQueue) {
- if (nSubtitleId == DWORD_PTR_MAX || nSubtitleId == m_nSubtitleId) {
+ if (nSubtitleId == DWORD_PTR_MAX || nSubtitleId == (DWORD_PTR)(ISubStream*)m_pCurrentSubStream) {
m_pSubPicQueue->Invalidate(rtInvalidate);
}
}
@@ -1678,7 +1715,7 @@ void CDirectVobSubFilter::RemoveSubStream(ISubStream* pSubStream) void CDirectVobSubFilter::Post_EC_OLE_EVENT(CString str, DWORD_PTR nSubtitleId /*= DWORD_PTR_MAX*/)
{
- if (nSubtitleId != DWORD_PTR_MAX && nSubtitleId != m_nSubtitleId) {
+ if (nSubtitleId != DWORD_PTR_MAX && nSubtitleId != (DWORD_PTR)(ISubStream*)m_pCurrentSubStream) {
return;
}
diff --git a/src/filters/transform/VSFilter/DirectVobSubFilter.h b/src/filters/transform/VSFilter/DirectVobSubFilter.h index fd2e924ec..a9270a975 100644 --- a/src/filters/transform/VSFilter/DirectVobSubFilter.h +++ b/src/filters/transform/VSFilter/DirectVobSubFilter.h @@ -149,7 +149,7 @@ protected: CCritSec m_csSubLock;
CInterfaceList<ISubStream> m_pSubStreams;
- DWORD_PTR m_nSubtitleId;
+ CComQIPtr<ISubStream> m_pCurrentSubStream;
void UpdateSubtitle();
void SetSubtitle(ISubStream* pSubStream);
void InvalidateSubtitle(REFERENCE_TIME rtInvalidate = -1, DWORD_PTR nSubtitleId = DWORD_PTR_MAX);
|