Add cache info to OSD.
[xy_vsfilter.git] / src / filters / transform / vsfilter / DirectVobSub.cpp
blob332d2bd4f5f34dee4283bb019fe550f54d281ee3
1 /*
2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 #include "stdafx.h"
23 #include "DirectVobSub.h"
24 #include "VSFilter.h"
26 CDirectVobSub::CDirectVobSub()
28 AFX_MANAGE_STATE(AfxGetStaticModuleState());
30 BYTE* pData = NULL;
31 UINT nSize = 0;
33 m_supported_filter_verion = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SUPPORTED_VERSION), 0);
34 m_config_info_version = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VERSION), 0);
36 m_iSelectedLanguage = 0;
37 m_fHideSubtitles = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), 0);
38 m_fDoPreBuffering = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DOPREBUFFERING), 1);
40 m_colorSpace = GetCompatibleProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLOR_SPACE), CDirectVobSub::YuvMatrix_AUTO);
41 if( m_colorSpace!=CDirectVobSub::YuvMatrix_AUTO &&
42 m_colorSpace!=CDirectVobSub::BT_601 &&
43 m_colorSpace!=CDirectVobSub::BT_709 &&
44 m_colorSpace!=CDirectVobSub::GUESS)
46 m_colorSpace = CDirectVobSub::YuvMatrix_AUTO;
48 m_yuvRange = GetCompatibleProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_YUV_RANGE), CDirectVobSub::YuvRange_Auto);
49 if( m_yuvRange!=CDirectVobSub::YuvRange_Auto &&
50 m_yuvRange!=CDirectVobSub::YuvRange_PC &&
51 m_yuvRange!=CDirectVobSub::YuvRange_TV )
53 m_yuvRange = CDirectVobSub::YuvRange_Auto;
56 m_bt601Width = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_BT601_WIDTH), 1024);
57 m_bt601Height = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_BT601_HEIGHT), 600);
59 m_fOverridePlacement = !!theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), 0);
60 m_PlacementXperc = theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), 50);
61 m_PlacementYperc = theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), 90);
62 m_fBufferVobSub = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), 1);
63 m_fOnlyShowForcedVobSubs = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), 0);
64 m_fPolygonize = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), 0);
65 m_defStyle <<= theApp.GetProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), _T(""));
66 m_fFlipPicture = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), 0);
67 m_fFlipSubtitles = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), 0);
68 m_fOSD = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), 0);
69 m_fSaveFullPath = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), 0);
70 m_nReloaderDisableCount = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0) ? 1 : 0;
71 m_SubtitleDelay = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), 0);
72 m_SubtitleSpeedMul = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), 1000);
73 m_SubtitleSpeedDiv = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), 1000);
74 m_fMediaFPSEnabled = !!theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), 0);
75 m_ePARCompensationType = static_cast<CSimpleTextSubtitle::EPARCompensationType>(theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_AUTOPARCOMPENSATION), 0));
76 m_fHideTrayIcon = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE_TRAY_ICON), 0);
78 m_overlay_cache_max_item_num = theApp.GetProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_OVERLAY_CACHE_MAX_ITEM_NUM)
79 , CacheManager::OVERLAY_CACHE_ITEM_NUM);
80 if(m_overlay_cache_max_item_num<0) m_overlay_cache_max_item_num = 0;
82 m_overlay_no_blur_cache_max_item_num = theApp.GetProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_OVERLAY_NO_BLUR_CACHE_MAX_ITEM_NUM)
83 , CacheManager::OVERLAY_NO_BLUR_CACHE_ITEM_NUM);
84 if(m_overlay_no_blur_cache_max_item_num<0) m_overlay_no_blur_cache_max_item_num = 0;
86 m_scan_line_data_cache_max_item_num = theApp.GetProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_SCAN_LINE_DATA_CACHE_MAX_ITEM_NUM)
87 , CacheManager::SCAN_LINE_DATA_CACHE_ITEM_NUM);
88 if(m_scan_line_data_cache_max_item_num<0) m_scan_line_data_cache_max_item_num = 0;
90 m_path_data_cache_max_item_num = theApp.GetProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_PATH_DATA_CACHE_MAX_ITEM_NUM)
91 , CacheManager::PATH_CACHE_ITEM_NUM);
92 if(m_path_data_cache_max_item_num<0) m_path_data_cache_max_item_num = 0;
94 m_subpixel_pos_level = theApp.GetProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_SUBPIXEL_POS_LEVEL), SubpixelPositionControler::EIGHT_X_EIGHT);
95 if(m_subpixel_pos_level<0) m_subpixel_pos_level=0;
96 else if(m_subpixel_pos_level>=SubpixelPositionControler::MAX_COUNT) m_subpixel_pos_level=SubpixelPositionControler::EIGHT_X_EIGHT;
98 m_fFollowUpstreamPreferredOrder = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_USE_UPSTREAM_PREFERRED_ORDER), true);
99 // get output colorspace config
100 if(pData)
102 delete [] pData;
103 pData = NULL;
105 if(theApp.GetProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_OUTPUT_COLORFORMATS), &pData, &nSize)
106 && pData && nSize == 2*GetOutputColorSpaceNumber())
108 for (unsigned i=0;i<nSize/2;i++)
110 m_outputColorSpace[i] = static_cast<ColorSpaceId>(pData[2*i]);
111 m_selectedOutputColorSpace[i] = !!pData[2*i+1];
114 else
116 for (unsigned i=0;i<GetOutputColorSpaceNumber();i++)
118 m_outputColorSpace[i] = static_cast<ColorSpaceId>(i);
119 m_selectedOutputColorSpace[i] = true;
123 // get input colorspace config
124 if(pData)
126 delete [] pData;
127 pData = NULL;
129 if(theApp.GetProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INPUT_COLORFORMATS), &pData, &nSize)
130 && pData && nSize == 2*GetInputColorSpaceNumber())
132 for (unsigned i=0;i<nSize/2;i++)
134 m_inputColorSpace[i] = static_cast<ColorSpaceId>(pData[2*i]);
135 m_selectedInputColorSpace[i] = !!pData[2*i+1];
138 else
140 for (unsigned i=0;i<GetOutputColorSpaceNumber();i++)
142 m_inputColorSpace[i] = static_cast<ColorSpaceId>(i);
143 m_selectedInputColorSpace[i] = true;
148 if(pData)
150 delete [] pData;
151 pData = NULL;
153 if(theApp.GetProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), &pData, &nSize) && pData)
155 if(nSize != sizeof(m_MediaFPS)) m_MediaFPS = 25.0;
156 else memcpy(&m_MediaFPS, pData, sizeof(m_MediaFPS));
158 m_ZoomRect.left = m_ZoomRect.top = 0;
159 m_ZoomRect.right = m_ZoomRect.bottom = 1;
161 m_fForced = false;
162 if(pData)
164 delete [] pData;
165 pData = NULL;
169 CDirectVobSub::~CDirectVobSub()
171 CAutoLock cAutoLock(&m_propsLock);
174 STDMETHODIMP CDirectVobSub::get_FileName(WCHAR* fn)
176 CAutoLock cAutoLock(&m_propsLock);
178 if(!fn) return E_POINTER;
180 #ifdef UNICODE
181 wcscpy(fn, m_FileName);
182 #else
183 mbstowcs(fn, m_FileName, m_FileName.GetLength()+1);
184 #endif
186 return S_OK;
189 STDMETHODIMP CDirectVobSub::put_FileName(WCHAR* fn)
191 CAutoLock cAutoLock(&m_propsLock);
193 if(!fn) return E_POINTER;
195 CString tmp = fn;
196 if(!m_FileName.Left(m_FileName.ReverseFind('.')+1).CompareNoCase(tmp.Left(tmp.ReverseFind('.')+1))) return S_FALSE;
198 #ifdef UNICODE
199 m_FileName = fn;
200 #else
201 CHARSETINFO cs={0};
202 ::TranslateCharsetInfo((DWORD *)DEFAULT_CHARSET, &cs, TCI_SRCCHARSET);
203 CHAR* buff = m_FileName.GetBuffer(MAX_PATH*2);
204 int len = WideCharToMultiByte(cs.ciACP/*CP_OEMCP*/, NULL, fn, -1, buff, MAX_PATH*2, NULL, NULL);
205 m_FileName.ReleaseBuffer(len+1);
206 #endif
208 return S_OK;
211 STDMETHODIMP CDirectVobSub::get_LanguageCount(int* nLangs)
213 CAutoLock cAutoLock(&m_propsLock);
215 return nLangs ? *nLangs = 0, S_OK : E_POINTER;
218 STDMETHODIMP CDirectVobSub::get_LanguageName(int iLanguage, WCHAR** ppName)
220 return S_OK;
223 STDMETHODIMP CDirectVobSub::get_SelectedLanguage(int* iSelected)
225 CAutoLock cAutoLock(&m_propsLock);
227 return iSelected ? *iSelected = m_iSelectedLanguage, S_OK : E_POINTER;
230 STDMETHODIMP CDirectVobSub::put_SelectedLanguage(int iSelected)
232 CAutoLock cAutoLock(&m_propsLock);
234 if(m_iSelectedLanguage == iSelected) return S_FALSE;
236 int nCount;
237 if(FAILED(get_LanguageCount(&nCount))
238 || iSelected < 0
239 || iSelected >= nCount)
240 return E_FAIL;
242 m_iSelectedLanguage = iSelected;
244 return S_OK;
247 STDMETHODIMP CDirectVobSub::get_HideSubtitles(bool* fHideSubtitles)
249 CAutoLock cAutoLock(&m_propsLock);
251 return fHideSubtitles ? *fHideSubtitles = m_fHideSubtitles, S_OK : E_POINTER;
254 STDMETHODIMP CDirectVobSub::put_HideSubtitles(bool fHideSubtitles)
256 CAutoLock cAutoLock(&m_propsLock);
258 if(m_fHideSubtitles == fHideSubtitles) return S_FALSE;
260 m_fHideSubtitles = fHideSubtitles;
262 return S_OK;
265 STDMETHODIMP CDirectVobSub::get_PreBuffering(bool* fDoPreBuffering)
267 CAutoLock cAutoLock(&m_propsLock);
269 //return fDoPreBuffering ? *fDoPreBuffering = m_fDoPreBuffering, S_OK : E_POINTER;
270 return fDoPreBuffering ? *fDoPreBuffering = false, S_OK : E_POINTER;
273 STDMETHODIMP CDirectVobSub::put_PreBuffering(bool fDoPreBuffering)
275 return E_NOTIMPL;
276 //CAutoLock cAutoLock(&m_propsLock);
278 //if(m_fDoPreBuffering == fDoPreBuffering) return S_FALSE;
280 //m_fDoPreBuffering = fDoPreBuffering;
282 //return S_OK;
285 STDMETHODIMP CDirectVobSub::get_ColorSpace(int* colorSpace)
287 CAutoLock cAutoLock(&m_propsLock);
289 return colorSpace ? *colorSpace = m_colorSpace, S_OK : E_POINTER;
292 STDMETHODIMP CDirectVobSub::put_ColorSpace(int colorSpace)
294 CAutoLock cAutoLock(&m_propsLock);
296 if(m_colorSpace == colorSpace) return S_FALSE;
298 m_colorSpace = colorSpace;
300 return S_OK;
303 STDMETHODIMP CDirectVobSub::get_YuvRange(int* yuvRange)
305 CAutoLock cAutoLock(&m_propsLock);
307 return yuvRange ? *yuvRange = m_yuvRange, S_OK : E_POINTER;
310 STDMETHODIMP CDirectVobSub::put_YuvRange(int yuvRange)
312 CAutoLock cAutoLock(&m_propsLock);
314 if(m_yuvRange == yuvRange) return S_FALSE;
316 m_yuvRange = yuvRange;
318 return S_OK;
321 STDMETHODIMP CDirectVobSub::get_Placement(bool* fOverridePlacement, int* xperc, int* yperc)
323 CAutoLock cAutoLock(&m_propsLock);
325 if(fOverridePlacement) *fOverridePlacement = m_fOverridePlacement;
326 if(xperc) *xperc = m_PlacementXperc;
327 if(yperc) *yperc = m_PlacementYperc;
329 return S_OK;
332 STDMETHODIMP CDirectVobSub::put_Placement(bool fOverridePlacement, int xperc, int yperc)
334 DbgLog((LOG_TRACE, 3, "%s(%d): %s", __FILE__, __LINE__, __FUNCTION__));
335 CAutoLock cAutoLock(&m_propsLock);
337 DbgLog((LOG_TRACE, 3, "\tfOverridePlacement:%d xperc:%d yperc:%d", (int)fOverridePlacement, xperc, yperc));
338 DbgLog((LOG_TRACE, 3, "\tm_fOverridePlacement:%d m_PlacementXperc:%d m_PlacementYperc:%d", (int)m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc));
339 if(m_fOverridePlacement == fOverridePlacement && m_PlacementXperc == xperc && m_PlacementYperc == yperc) return S_FALSE;
341 m_fOverridePlacement = fOverridePlacement;
342 m_PlacementXperc = xperc;
343 m_PlacementYperc = yperc;
345 return S_OK;
348 STDMETHODIMP CDirectVobSub::get_VobSubSettings(bool* fBuffer, bool* fOnlyShowForcedSubs, bool* fPolygonize)
350 CAutoLock cAutoLock(&m_propsLock);
352 if(fBuffer) *fBuffer = m_fBufferVobSub;
353 if(fOnlyShowForcedSubs) *fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
354 if(fPolygonize) *fPolygonize = m_fPolygonize;
356 return S_OK;
359 STDMETHODIMP CDirectVobSub::put_VobSubSettings(bool fBuffer, bool fOnlyShowForcedSubs, bool fPolygonize)
361 CAutoLock cAutoLock(&m_propsLock);
363 if(m_fBufferVobSub == fBuffer && m_fOnlyShowForcedVobSubs == fOnlyShowForcedSubs && m_fPolygonize == fPolygonize) return S_FALSE;
365 m_fBufferVobSub = fBuffer;
366 m_fOnlyShowForcedVobSubs = fOnlyShowForcedSubs;
367 m_fPolygonize = fPolygonize;
369 return S_OK;
372 STDMETHODIMP CDirectVobSub::get_TextSettings(void* lf, int lflen, COLORREF* color, bool* fShadow, bool* fOutline, bool* fAdvancedRenderer)
374 CAutoLock cAutoLock(&m_propsLock);
376 if(lf)
378 if(lflen == sizeof(LOGFONTA))
379 strncpy_s(((LOGFONTA*)lf)->lfFaceName, LF_FACESIZE, CStringA(m_defStyle.fontName), _TRUNCATE);
380 else if(lflen == sizeof(LOGFONTW))
381 wcsncpy_s(((LOGFONTW*)lf)->lfFaceName, LF_FACESIZE, CStringW(m_defStyle.fontName), _TRUNCATE);
382 else
383 return E_INVALIDARG;
385 ((LOGFONT*)lf)->lfCharSet = m_defStyle.charSet;
386 ((LOGFONT*)lf)->lfItalic = m_defStyle.fItalic;
387 ((LOGFONT*)lf)->lfHeight = m_defStyle.fontSize;
388 ((LOGFONT*)lf)->lfWeight = m_defStyle.fontWeight;
389 ((LOGFONT*)lf)->lfStrikeOut = m_defStyle.fStrikeOut;
390 ((LOGFONT*)lf)->lfUnderline = m_defStyle.fUnderline;
393 if(color) *color = m_defStyle.colors[0];
394 if(fShadow) *fShadow = (m_defStyle.shadowDepthX>0) || (m_defStyle.shadowDepthY>0);
395 if(fOutline) *fOutline = (m_defStyle.outlineWidthX>0) || (m_defStyle.outlineWidthY>0);
396 if(fAdvancedRenderer) *fAdvancedRenderer = m_fAdvancedRenderer;
398 return S_OK;
401 STDMETHODIMP CDirectVobSub::put_TextSettings(void* lf, int lflen, COLORREF color, bool fShadow, bool fOutline, bool fAdvancedRenderer)
403 CAutoLock cAutoLock(&m_propsLock);
404 STSStyle tmp = m_defStyle;
405 if(lf)
407 if(lflen == sizeof(LOGFONTA))
408 tmp.fontName = ((LOGFONTA*)lf)->lfFaceName;
409 else if(lflen == sizeof(LOGFONTW))
410 tmp.fontName = ((LOGFONTW*)lf)->lfFaceName;
411 else
412 return E_INVALIDARG;
414 tmp.charSet = ((LOGFONT*)lf)->lfCharSet;
415 tmp.fItalic = !!((LOGFONT*)lf)->lfItalic;
416 tmp.fontSize = ((LOGFONT*)lf)->lfHeight;
417 tmp.fontWeight = ((LOGFONT*)lf)->lfWeight;
418 tmp.fStrikeOut = !!((LOGFONT*)lf)->lfStrikeOut;
419 tmp.fUnderline = !!((LOGFONT*)lf)->lfUnderline;
421 if(tmp.fontSize < 0)
423 HDC hdc = ::GetDC(0);
424 m_defStyle.fontSize = -m_defStyle.fontSize * 72 / GetDeviceCaps(hdc, LOGPIXELSY);
425 ::ReleaseDC(0, hdc);
430 tmp.colors[0] = color;
431 tmp.shadowDepthX = tmp.shadowDepthY = fShadow?2:0;
432 tmp.outlineWidthX = tmp.outlineWidthY = fOutline?2:0;
434 if(tmp==m_defStyle)
436 return S_FALSE;//Important! Avoid unnecessary deinit
438 else
440 m_defStyle = tmp;
441 return S_OK;
446 STDMETHODIMP CDirectVobSub::get_Flip(bool* fPicture, bool* fSubtitles)
448 CAutoLock cAutoLock(&m_propsLock);
450 if(fPicture) *fPicture = m_fFlipPicture;
451 if(fSubtitles) *fSubtitles = m_fFlipSubtitles;
453 return S_OK;
456 STDMETHODIMP CDirectVobSub::put_Flip(bool fPicture, bool fSubtitles)
458 CAutoLock cAutoLock(&m_propsLock);
460 if(m_fFlipPicture == fPicture && m_fFlipSubtitles == fSubtitles) return S_FALSE;
462 m_fFlipPicture = fPicture;
463 m_fFlipSubtitles = fSubtitles;
465 return S_OK;
468 STDMETHODIMP CDirectVobSub::get_OSD(bool* fOSD)
470 CAutoLock cAutoLock(&m_propsLock);
472 return fOSD ? *fOSD = m_fOSD, S_OK : E_POINTER;
475 STDMETHODIMP CDirectVobSub::put_OSD(bool fOSD)
477 CAutoLock cAutoLock(&m_propsLock);
479 if(m_fOSD == fOSD) return S_FALSE;
481 m_fOSD = fOSD;
483 return S_OK;
486 STDMETHODIMP CDirectVobSub::get_SaveFullPath(bool* fSaveFullPath)
488 CAutoLock cAutoLock(&m_propsLock);
490 return fSaveFullPath ? *fSaveFullPath = m_fSaveFullPath, S_OK : E_POINTER;
493 STDMETHODIMP CDirectVobSub::put_SaveFullPath(bool fSaveFullPath)
495 CAutoLock cAutoLock(&m_propsLock);
497 if(m_fSaveFullPath == fSaveFullPath) return S_FALSE;
499 m_fSaveFullPath = fSaveFullPath;
501 return S_OK;
504 STDMETHODIMP CDirectVobSub::get_SubtitleTiming(int* delay, int* speedmul, int* speeddiv)
506 CAutoLock cAutoLock(&m_propsLock);
508 if(delay) *delay = m_SubtitleDelay;
509 if(speedmul) *speedmul = m_SubtitleSpeedMul;
510 if(speeddiv) *speeddiv = m_SubtitleSpeedDiv;
512 return S_OK;
515 STDMETHODIMP CDirectVobSub::put_SubtitleTiming(int delay, int speedmul, int speeddiv)
517 CAutoLock cAutoLock(&m_propsLock);
519 if(m_SubtitleDelay == delay && m_SubtitleSpeedMul == speedmul && m_SubtitleSpeedDiv == speeddiv) return S_FALSE;
521 m_SubtitleDelay = delay;
522 m_SubtitleSpeedMul = speedmul;
523 if(speeddiv > 0) m_SubtitleSpeedDiv = speeddiv;
525 return S_OK;
528 STDMETHODIMP CDirectVobSub::get_MediaFPS(bool* fEnabled, double* fps)
530 CAutoLock cAutoLock(&m_propsLock);
532 if(fEnabled) *fEnabled = m_fMediaFPSEnabled;
533 if(fps) *fps = m_MediaFPS;
535 return S_OK;
538 STDMETHODIMP CDirectVobSub::put_MediaFPS(bool fEnabled, double fps)
540 CAutoLock cAutoLock(&m_propsLock);
542 if(m_fMediaFPSEnabled == fEnabled && m_MediaFPS == fps) return S_FALSE;
544 m_fMediaFPSEnabled = fEnabled;
545 if(fps > 0) m_MediaFPS = fps;
547 return S_OK;
550 STDMETHODIMP CDirectVobSub::get_ZoomRect(NORMALIZEDRECT* rect)
552 CAutoLock cAutoLock(&m_propsLock);
554 if(!rect) return E_POINTER;
556 *rect = m_ZoomRect;
558 return S_OK;
561 STDMETHODIMP CDirectVobSub::put_ZoomRect(NORMALIZEDRECT* rect)
563 CAutoLock cAutoLock(&m_propsLock);
565 if(!rect) return E_POINTER;
567 if(!memcmp(&m_ZoomRect, rect, sizeof(m_ZoomRect))) return S_FALSE;
569 m_ZoomRect = *rect;
571 return S_OK;
574 STDMETHODIMP CDirectVobSub::get_OutputColorFormat(ColorSpaceId* preferredOrder, bool* fSelected, UINT* count)
576 CAutoLock cAutoLock(&m_propsLock);
577 if(count)
579 *count = GetOutputColorSpaceNumber();
581 if(preferredOrder)
583 memcpy(preferredOrder, m_outputColorSpace, GetOutputColorSpaceNumber()*sizeof(*preferredOrder));
585 if(fSelected)
587 memcpy(fSelected, m_selectedOutputColorSpace, GetOutputColorSpaceNumber()*sizeof(*fSelected));
590 return S_OK;
593 STDMETHODIMP CDirectVobSub::put_OutputColorFormat( const ColorSpaceId* preferredOrder, const bool* fSelected, UINT count )
595 CAutoLock cAutoLock(&m_propsLock);
597 if( count!=GetOutputColorSpaceNumber() )
598 return S_FALSE;
599 if( (preferredOrder==NULL || !memcmp(preferredOrder, m_outputColorSpace, count*sizeof(*preferredOrder)))
600 && (fSelected==NULL || !memcmp(fSelected, m_selectedOutputColorSpace, count*sizeof(*fSelected))) )
601 return S_FALSE;
602 if(preferredOrder)
603 memcpy(m_outputColorSpace, preferredOrder, count*sizeof(*preferredOrder));
604 if(fSelected)
605 memcpy(m_selectedOutputColorSpace, fSelected, count*sizeof(*fSelected));
607 return S_OK;
610 STDMETHODIMP CDirectVobSub::get_InputColorFormat( ColorSpaceId* preferredOrder, bool* fSelected, UINT* count )
612 CAutoLock cAutoLock(&m_propsLock);
613 if(count)
615 *count = GetInputColorSpaceNumber();
617 if(preferredOrder)
619 memcpy(preferredOrder, m_inputColorSpace, GetOutputColorSpaceNumber()*sizeof(*preferredOrder));
621 if(fSelected)
623 memcpy(fSelected, m_selectedInputColorSpace, GetOutputColorSpaceNumber()*sizeof(*fSelected));
626 return S_OK;
629 STDMETHODIMP CDirectVobSub::put_InputColorFormat( const ColorSpaceId* preferredOrder, const bool* fSelected, UINT count )
631 CAutoLock cAutoLock(&m_propsLock);
633 if( count!=GetInputColorSpaceNumber() )
634 return S_FALSE;
635 if( (preferredOrder==NULL || !memcmp(preferredOrder, m_inputColorSpace, count*sizeof(*preferredOrder)))
636 && (fSelected==NULL || !memcmp(fSelected, m_selectedInputColorSpace, count*sizeof(*fSelected))) )
637 return S_FALSE;
638 if(preferredOrder)
639 memcpy(m_inputColorSpace, preferredOrder, count*sizeof(*preferredOrder));
640 if(fSelected)
641 memcpy(m_selectedInputColorSpace, fSelected, count*sizeof(*fSelected));
643 return S_OK;
646 STDMETHODIMP CDirectVobSub::get_OverlayCacheMaxItemNum(int* overlay_cache_max_item_num)
648 CAutoLock cAutoLock(&m_propsLock);
650 if(overlay_cache_max_item_num) *overlay_cache_max_item_num = m_overlay_cache_max_item_num;
652 return S_OK;
655 STDMETHODIMP CDirectVobSub::put_OverlayCacheMaxItemNum(int overlay_cache_max_item_num)
657 CAutoLock cAutoLock(&m_propsLock);
659 if(m_overlay_cache_max_item_num == overlay_cache_max_item_num || overlay_cache_max_item_num<0) return S_FALSE;
661 m_overlay_cache_max_item_num = overlay_cache_max_item_num;
663 return S_OK;
666 STDMETHODIMP CDirectVobSub::get_ScanLineDataCacheMaxItemNum(int* scan_line_data_cache_max_item_num)
668 CAutoLock cAutoLock(&m_propsLock);
670 if(scan_line_data_cache_max_item_num) *scan_line_data_cache_max_item_num = m_scan_line_data_cache_max_item_num;
672 return S_OK;
675 STDMETHODIMP CDirectVobSub::put_ScanLineDataCacheMaxItemNum(int scan_line_data_cache_max_item_num)
677 CAutoLock cAutoLock(&m_propsLock);
679 if(m_scan_line_data_cache_max_item_num == scan_line_data_cache_max_item_num || scan_line_data_cache_max_item_num<0) return S_FALSE;
680 m_scan_line_data_cache_max_item_num = scan_line_data_cache_max_item_num;
682 return S_OK;
685 STDMETHODIMP CDirectVobSub::get_PathDataCacheMaxItemNum(int* path_data_cache_max_item_num)
687 CAutoLock cAutoLock(&m_propsLock);
689 if(path_data_cache_max_item_num) *path_data_cache_max_item_num = m_path_data_cache_max_item_num;
691 return S_OK;
694 STDMETHODIMP CDirectVobSub::put_PathDataCacheMaxItemNum(int path_data_cache_max_item_num)
696 CAutoLock cAutoLock(&m_propsLock);
698 if(m_path_data_cache_max_item_num == path_data_cache_max_item_num || path_data_cache_max_item_num<0) return S_FALSE;
699 m_path_data_cache_max_item_num = path_data_cache_max_item_num;
701 return S_OK;
704 STDMETHODIMP CDirectVobSub::get_OverlayNoBlurCacheMaxItemNum(int* overlay_no_blur_cache_max_item_num)
706 CAutoLock cAutoLock(&m_propsLock);
708 if(overlay_no_blur_cache_max_item_num) *overlay_no_blur_cache_max_item_num = m_overlay_no_blur_cache_max_item_num;
710 return S_OK;
713 STDMETHODIMP CDirectVobSub::put_OverlayNoBlurCacheMaxItemNum(int overlay_no_blur_cache_max_item_num)
715 CAutoLock cAutoLock(&m_propsLock);
717 if(m_overlay_no_blur_cache_max_item_num == overlay_no_blur_cache_max_item_num || overlay_no_blur_cache_max_item_num<0) return S_FALSE;
718 m_overlay_no_blur_cache_max_item_num = overlay_no_blur_cache_max_item_num;
720 return S_OK;
723 STDMETHODIMP CDirectVobSub::get_CachesInfo(CachesInfo* caches_info)
725 CAutoLock cAutoLock(&m_propsLock);
726 if(caches_info)
728 caches_info->path_cache_cur_item_num = 0;
729 caches_info->path_cache_hit_count = 0;
730 caches_info->path_cache_query_count = 0;
731 caches_info->scanline_cache2_cur_item_num= 0;
732 caches_info->scanline_cache2_hit_count = 0;
733 caches_info->scanline_cache2_query_count = 0;
734 caches_info->non_blur_cache_cur_item_num= 0;
735 caches_info->non_blur_cache_hit_count = 0;
736 caches_info->non_blur_cache_query_count = 0;
737 caches_info->overlay_cache_cur_item_num = 0;
738 caches_info->overlay_cache_hit_count = 0;
739 caches_info->overlay_cache_query_count = 0;
740 caches_info->interpolate_cache_cur_item_num = 0;
741 caches_info->interpolate_cache_query_count = 0;
742 caches_info->interpolate_cache_hit_count = 0;
743 caches_info->text_info_cache_cur_item_num = 0;
744 caches_info->text_info_cache_query_count = 0;
745 caches_info->text_info_cache_hit_count = 0;
746 caches_info->word_info_cache_cur_item_num = 0;
747 caches_info->word_info_cache_query_count = 0;
748 caches_info->word_info_cache_hit_count = 0;
749 return S_OK;
751 else
753 return S_FALSE;
757 STDMETHODIMP CDirectVobSub::get_SubpixelPositionLevel(int* subpixel_pos_level)
759 CAutoLock cAutoLock(&m_propsLock);
761 if(subpixel_pos_level) *subpixel_pos_level = m_subpixel_pos_level;
763 return S_OK;
766 STDMETHODIMP CDirectVobSub::put_SubpixelPositionLevel(int subpixel_pos_level)
768 CAutoLock cAutoLock(&m_propsLock);
770 if(m_subpixel_pos_level == subpixel_pos_level || subpixel_pos_level<0 || subpixel_pos_level>=SubpixelPositionControler::MAX_COUNT) return S_FALSE;
771 m_subpixel_pos_level = subpixel_pos_level;
773 return S_OK;
776 STDMETHODIMP CDirectVobSub::get_FollowUpstreamPreferredOrder( bool *fFollowUpstreamPreferredOrder )
778 CAutoLock cAutoLock(&m_propsLock);
780 if(fFollowUpstreamPreferredOrder) *fFollowUpstreamPreferredOrder=m_fFollowUpstreamPreferredOrder;
782 return S_OK;
785 STDMETHODIMP CDirectVobSub::put_FollowUpstreamPreferredOrder( bool fFollowUpstreamPreferredOrder )
787 CAutoLock cAutoLock(&m_propsLock);
789 if(m_fFollowUpstreamPreferredOrder == fFollowUpstreamPreferredOrder) return S_FALSE;
790 m_fFollowUpstreamPreferredOrder = fFollowUpstreamPreferredOrder;
792 return S_OK;
795 STDMETHODIMP CDirectVobSub::get_HideTrayIcon( bool *fHideTrayIcon )
797 CAutoLock cAutoLock(&m_propsLock);
799 if(fHideTrayIcon) *fHideTrayIcon=m_fHideTrayIcon;
801 return S_OK;
804 STDMETHODIMP CDirectVobSub::put_HideTrayIcon( bool fHideTrayIcon )
806 CAutoLock cAutoLock(&m_propsLock);
808 if(m_fHideTrayIcon == fHideTrayIcon) return S_FALSE;
809 m_fHideTrayIcon = fHideTrayIcon;
811 return S_OK;
814 STDMETHODIMP CDirectVobSub::UpdateRegistry()
816 AFX_MANAGE_STATE(AfxGetStaticModuleState());
818 CAutoLock cAutoLock(&m_propsLock);
820 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), m_fHideSubtitles);
821 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DOPREBUFFERING), m_fDoPreBuffering);
823 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_YUV_RANGE), m_yuvRange);
825 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLOR_SPACE), m_colorSpace);
826 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_BT601_WIDTH), 1024);
827 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_BT601_HEIGHT), 600);
829 theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), m_fOverridePlacement);
830 theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), m_PlacementXperc);
831 theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), m_PlacementYperc);
832 theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), m_fBufferVobSub);
833 theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), m_fOnlyShowForcedVobSubs);
834 theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), m_fPolygonize);
835 CString style;
836 theApp.WriteProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), style <<= m_defStyle);
837 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), m_fFlipPicture);
838 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), m_fFlipSubtitles);
839 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), m_fOSD);
840 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), m_fSaveFullPath);
841 theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), m_SubtitleDelay);
842 theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), m_SubtitleSpeedMul);
843 theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), m_SubtitleSpeedDiv);
844 theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), m_fMediaFPSEnabled);
845 theApp.WriteProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), (BYTE*)&m_MediaFPS, sizeof(m_MediaFPS));
846 theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_AUTOPARCOMPENSATION), m_ePARCompensationType);
847 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE_TRAY_ICON), m_fHideTrayIcon);
849 theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_OVERLAY_CACHE_MAX_ITEM_NUM), m_overlay_cache_max_item_num);
850 theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_OVERLAY_NO_BLUR_CACHE_MAX_ITEM_NUM), m_overlay_no_blur_cache_max_item_num);
851 theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_SCAN_LINE_DATA_CACHE_MAX_ITEM_NUM), m_scan_line_data_cache_max_item_num);
852 theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_PATH_DATA_CACHE_MAX_ITEM_NUM), m_path_data_cache_max_item_num);
853 theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_SUBPIXEL_POS_LEVEL), m_subpixel_pos_level);
854 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_USE_UPSTREAM_PREFERRED_ORDER), m_fFollowUpstreamPreferredOrder);
856 //save output color config
858 int count = GetOutputColorSpaceNumber();
859 BYTE* pData = new BYTE[2*count];
860 for(int i = 0; i < count; i++)
862 pData[2*i] = static_cast<BYTE>(m_outputColorSpace[i]);
863 pData[2*i+1] = static_cast<BYTE>(m_selectedOutputColorSpace[i]);
865 theApp.WriteProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_OUTPUT_COLORFORMATS), pData, 2*count);
867 delete [] pData;
870 //save input color config
872 int count = GetInputColorSpaceNumber();
873 BYTE* pData = new BYTE[2*count];
874 for(int i = 0; i < count; i++)
876 pData[2*i] = static_cast<BYTE>(m_inputColorSpace[i]);
877 pData[2*i+1] = static_cast<BYTE>(m_selectedInputColorSpace[i]);
879 theApp.WriteProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INPUT_COLORFORMATS), pData, 2*count);
881 delete [] pData;
884 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SUPPORTED_VERSION), CUR_SUPPORTED_FILTER_VERSION);
885 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VERSION), XY_VSFILTER_VERSION_COMMIT);
887 return S_OK;
890 STDMETHODIMP CDirectVobSub::HasConfigDialog(int iSelected)
892 return E_NOTIMPL;
895 STDMETHODIMP CDirectVobSub::ShowConfigDialog(int iSelected, HWND hWndParent)
897 return E_NOTIMPL;
900 STDMETHODIMP CDirectVobSub::IsSubtitleReloaderLocked(bool* fLocked)
902 CAutoLock cAutoLock(&m_propsLock);
904 if(!fLocked) return E_POINTER;
906 bool fDisabled;
907 get_SubtitleReloader(&fDisabled);
909 *fLocked = fDisabled || m_nReloaderDisableCount > 0;
911 return S_OK;
914 STDMETHODIMP CDirectVobSub::LockSubtitleReloader(bool fLock)
916 CAutoLock cAutoLock(&m_propsLock);
918 if(fLock) m_nReloaderDisableCount++;
919 else m_nReloaderDisableCount--;
921 ASSERT(m_nReloaderDisableCount >= 0);
922 if(m_nReloaderDisableCount < 0) m_nReloaderDisableCount = 0;
924 return S_OK;
927 STDMETHODIMP CDirectVobSub::get_SubtitleReloader(bool* fDisabled)
929 AFX_MANAGE_STATE(AfxGetStaticModuleState());
931 CAutoLock cAutoLock(&m_propsLock);
933 if(fDisabled) *fDisabled = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0);
935 return S_OK;
938 STDMETHODIMP CDirectVobSub::put_SubtitleReloader(bool fDisable)
940 AFX_MANAGE_STATE(AfxGetStaticModuleState());
942 CAutoLock cAutoLock(&m_propsLock);
944 bool b;
945 get_SubtitleReloader(&b);
946 if(b == fDisable) return S_FALSE;
948 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), fDisable);
950 return S_OK;
953 STDMETHODIMP CDirectVobSub::get_ExtendPicture(int* horizontal, int* vertical, int* resx2, int* resx2minw, int* resx2minh)
955 AFX_MANAGE_STATE(AfxGetStaticModuleState());
957 CAutoLock cAutoLock(&m_propsLock);
959 if(horizontal) *horizontal = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), 0) & 1;
960 if(vertical) *vertical = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), 0);
961 //if(resx2) *resx2 = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), 2) & 3;
962 if(resx2) *resx2 = 0;
963 if(resx2minw) *resx2minw = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), 384);
964 if(resx2minh) *resx2minh = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), 288);
966 return S_OK;
969 STDMETHODIMP CDirectVobSub::put_ExtendPicture(int horizontal, int vertical, int resx2, int resx2minw, int resx2minh)
971 AFX_MANAGE_STATE(AfxGetStaticModuleState());
973 CAutoLock cAutoLock(&m_propsLock);
974 if(resx2==0)
976 int i[5];
977 get_ExtendPicture(i, i+1, i+2, i+3, i+4);
978 if(i[0] == horizontal && i[1] == vertical && i[2] == resx2 && i[3] == resx2minw && i[4] == resx2minh) return S_FALSE;
980 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), horizontal & 1);
981 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), vertical);
982 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), resx2 & 3);
983 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), resx2minw);
984 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), resx2minh);
986 return S_OK;
988 else
990 return S_FALSE;
994 STDMETHODIMP CDirectVobSub::get_LoadSettings(int* level, bool* fExternalLoad, bool* fWebLoad, bool* fEmbeddedLoad)
996 AFX_MANAGE_STATE(AfxGetStaticModuleState());
998 CAutoLock cAutoLock(&m_propsLock);
1000 if(level) *level = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), 0) & 3;
1001 if(fExternalLoad) *fExternalLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), 1);
1002 if(fWebLoad) *fWebLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), 0);
1003 if(fEmbeddedLoad) *fEmbeddedLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), 1);
1005 return S_OK;
1008 STDMETHODIMP CDirectVobSub::put_LoadSettings(int level, bool fExternalLoad, bool fWebLoad, bool fEmbeddedLoad)
1010 AFX_MANAGE_STATE(AfxGetStaticModuleState());
1012 CAutoLock cAutoLock(&m_propsLock);
1014 int i;
1015 bool b[3];
1016 get_LoadSettings(&i, b, b+1, b+2);
1017 if(i == level && b[0] == fExternalLoad && b[1] == fWebLoad && b[2] == fEmbeddedLoad) return S_FALSE;
1019 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), level & 3);
1020 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), fExternalLoad);
1021 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), fWebLoad);
1022 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), fEmbeddedLoad);
1024 return S_OK;
1027 // IDirectVobSub2
1029 STDMETHODIMP CDirectVobSub::AdviseSubClock(ISubClock* pSubClock)
1031 m_pSubClock = pSubClock;
1032 return S_OK;
1035 STDMETHODIMP_(bool) CDirectVobSub::get_Forced()
1037 return m_fForced;
1040 STDMETHODIMP CDirectVobSub::put_Forced(bool fForced)
1042 if(m_fForced==fForced)
1043 return S_FALSE;
1045 m_fForced = fForced;
1046 return S_OK;
1049 STDMETHODIMP CDirectVobSub::get_TextSettings(STSStyle* pDefStyle)
1051 CheckPointer(pDefStyle, E_POINTER);
1053 CAutoLock cAutoLock(&m_propsLock);
1055 *pDefStyle = m_defStyle;
1057 return S_OK;
1060 STDMETHODIMP CDirectVobSub::put_TextSettings(STSStyle* pDefStyle)
1062 CheckPointer(pDefStyle, E_POINTER);
1064 CAutoLock cAutoLock(&m_propsLock);
1066 if(m_defStyle==*pDefStyle)
1067 return S_FALSE;
1068 if(!memcmp(&m_defStyle, pDefStyle, sizeof(m_defStyle)))
1069 return S_FALSE;
1071 m_defStyle = *pDefStyle;
1073 return S_OK;
1076 STDMETHODIMP CDirectVobSub::get_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType)
1078 CAutoLock cAutoLock(&m_propsLock);
1080 *ePARCompensationType = m_ePARCompensationType;
1082 return S_OK;
1085 STDMETHODIMP CDirectVobSub::put_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType)
1087 CAutoLock cAutoLock(&m_propsLock);
1089 if(m_ePARCompensationType==*ePARCompensationType)
1090 return S_FALSE;
1092 m_ePARCompensationType = *ePARCompensationType;
1094 return S_OK;
1097 // IFilterVersion
1099 STDMETHODIMP_(DWORD) CDirectVobSub::GetFilterVersion()
1101 return 0x0234;
1104 bool CDirectVobSub::is_compatible()
1106 bool compatible = false;
1107 if ( m_config_info_version>XY_VSFILTER_VERSION_COMMIT )
1109 compatible = m_supported_filter_verion<=XY_VSFILTER_VERSION_COMMIT;
1111 else
1113 compatible = REQUIRED_CONFIG_VERSION<=m_config_info_version;
1115 return compatible;
1118 UINT CDirectVobSub::GetCompatibleProfileInt( LPCTSTR lpszSection, LPCTSTR lpszEntry, int nDefault )
1120 UINT result = nDefault;
1121 if (is_compatible())
1123 result = theApp.GetProfileInt(lpszSection, lpszEntry, nDefault);
1125 return result;