Minor changes.
[xy_vsfilter.git] / src / filters / transform / vsfilter / DirectVobSub.cpp
blobec06ee6e1aca5ec65ffafdf9bdcfd46e2f543b9b
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), 256);
79 if(m_overlay_cache_max_item_num<0) m_overlay_cache_max_item_num = 0;
81 m_overlay_no_blur_cache_max_item_num = theApp.GetProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_OVERLAY_NO_BLUR_CACHE_MAX_ITEM_NUM), 256);
82 if(m_overlay_no_blur_cache_max_item_num<0) m_overlay_no_blur_cache_max_item_num = 0;
84 m_scan_line_data_cache_max_item_num = theApp.GetProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_SCAN_LINE_DATA_CACHE_MAX_ITEM_NUM), 512);
85 if(m_scan_line_data_cache_max_item_num<0) m_scan_line_data_cache_max_item_num = 0;
87 m_path_data_cache_max_item_num = theApp.GetProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_PATH_DATA_CACHE_MAX_ITEM_NUM), 512);
88 if(m_path_data_cache_max_item_num<0) m_path_data_cache_max_item_num = 0;
90 m_subpixel_pos_level = theApp.GetProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_SUBPIXEL_POS_LEVEL), SubpixelPositionControler::EIGHT_X_EIGHT);
91 if(m_subpixel_pos_level<0) m_subpixel_pos_level=0;
92 else if(m_subpixel_pos_level>=SubpixelPositionControler::MAX_COUNT) m_subpixel_pos_level=SubpixelPositionControler::EIGHT_X_EIGHT;
94 m_fFollowUpstreamPreferredOrder = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_USE_UPSTREAM_PREFERRED_ORDER), true);
95 // get output colorspace config
96 if(pData)
98 delete [] pData;
99 pData = NULL;
101 if(theApp.GetProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_OUTPUT_COLORFORMATS), &pData, &nSize)
102 && pData && nSize == 2*GetOutputColorSpaceNumber())
104 for (int i=0;i<nSize/2;i++)
106 m_outputColorSpace[i] = static_cast<ColorSpaceId>(pData[2*i]);
107 m_selectedOutputColorSpace[i] = static_cast<bool>(pData[2*i+1]);
110 else
112 for (int i=0;i<GetOutputColorSpaceNumber();i++)
114 m_outputColorSpace[i] = static_cast<ColorSpaceId>(i);
115 m_selectedOutputColorSpace[i] = true;
119 // get input colorspace config
120 if(pData)
122 delete [] pData;
123 pData = NULL;
125 if(theApp.GetProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INPUT_COLORFORMATS), &pData, &nSize)
126 && pData && nSize == 2*GetInputColorSpaceNumber())
128 for (int i=0;i<nSize/2;i++)
130 m_inputColorSpace[i] = static_cast<ColorSpaceId>(pData[2*i]);
131 m_selectedInputColorSpace[i] = static_cast<bool>(pData[2*i+1]);
134 else
136 for (int i=0;i<GetOutputColorSpaceNumber();i++)
138 m_inputColorSpace[i] = static_cast<ColorSpaceId>(i);
139 m_selectedInputColorSpace[i] = true;
144 if(pData)
146 delete [] pData;
147 pData = NULL;
149 if(theApp.GetProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), &pData, &nSize) && pData)
151 if(nSize != sizeof(m_MediaFPS)) m_MediaFPS = 25.0;
152 else memcpy(&m_MediaFPS, pData, sizeof(m_MediaFPS));
154 m_ZoomRect.left = m_ZoomRect.top = 0;
155 m_ZoomRect.right = m_ZoomRect.bottom = 1;
157 m_fForced = false;
158 if(pData)
160 delete [] pData;
161 pData = NULL;
165 CDirectVobSub::~CDirectVobSub()
167 CAutoLock cAutoLock(&m_propsLock);
170 STDMETHODIMP CDirectVobSub::get_FileName(WCHAR* fn)
172 CAutoLock cAutoLock(&m_propsLock);
174 if(!fn) return E_POINTER;
176 #ifdef UNICODE
177 wcscpy(fn, m_FileName);
178 #else
179 mbstowcs(fn, m_FileName, m_FileName.GetLength()+1);
180 #endif
182 return S_OK;
185 STDMETHODIMP CDirectVobSub::put_FileName(WCHAR* fn)
187 CAutoLock cAutoLock(&m_propsLock);
189 if(!fn) return E_POINTER;
191 CString tmp = fn;
192 if(!m_FileName.Left(m_FileName.ReverseFind('.')+1).CompareNoCase(tmp.Left(tmp.ReverseFind('.')+1))) return S_FALSE;
194 #ifdef UNICODE
195 m_FileName = fn;
196 #else
197 CHARSETINFO cs={0};
198 ::TranslateCharsetInfo((DWORD *)DEFAULT_CHARSET, &cs, TCI_SRCCHARSET);
199 CHAR* buff = m_FileName.GetBuffer(MAX_PATH*2);
200 int len = WideCharToMultiByte(cs.ciACP/*CP_OEMCP*/, NULL, fn, -1, buff, MAX_PATH*2, NULL, NULL);
201 m_FileName.ReleaseBuffer(len+1);
202 #endif
204 return S_OK;
207 STDMETHODIMP CDirectVobSub::get_LanguageCount(int* nLangs)
209 CAutoLock cAutoLock(&m_propsLock);
211 return nLangs ? *nLangs = 0, S_OK : E_POINTER;
214 STDMETHODIMP CDirectVobSub::get_LanguageName(int iLanguage, WCHAR** ppName)
216 return S_OK;
219 STDMETHODIMP CDirectVobSub::get_SelectedLanguage(int* iSelected)
221 CAutoLock cAutoLock(&m_propsLock);
223 return iSelected ? *iSelected = m_iSelectedLanguage, S_OK : E_POINTER;
226 STDMETHODIMP CDirectVobSub::put_SelectedLanguage(int iSelected)
228 CAutoLock cAutoLock(&m_propsLock);
230 if(m_iSelectedLanguage == iSelected) return S_FALSE;
232 int nCount;
233 if(FAILED(get_LanguageCount(&nCount))
234 || iSelected < 0
235 || iSelected >= nCount)
236 return E_FAIL;
238 m_iSelectedLanguage = iSelected;
240 return S_OK;
243 STDMETHODIMP CDirectVobSub::get_HideSubtitles(bool* fHideSubtitles)
245 CAutoLock cAutoLock(&m_propsLock);
247 return fHideSubtitles ? *fHideSubtitles = m_fHideSubtitles, S_OK : E_POINTER;
250 STDMETHODIMP CDirectVobSub::put_HideSubtitles(bool fHideSubtitles)
252 CAutoLock cAutoLock(&m_propsLock);
254 if(m_fHideSubtitles == fHideSubtitles) return S_FALSE;
256 m_fHideSubtitles = fHideSubtitles;
258 return S_OK;
261 STDMETHODIMP CDirectVobSub::get_PreBuffering(bool* fDoPreBuffering)
263 CAutoLock cAutoLock(&m_propsLock);
265 //return fDoPreBuffering ? *fDoPreBuffering = m_fDoPreBuffering, S_OK : E_POINTER;
266 return fDoPreBuffering ? *fDoPreBuffering = false, S_OK : E_POINTER;
269 STDMETHODIMP CDirectVobSub::put_PreBuffering(bool fDoPreBuffering)
271 return E_NOTIMPL;
272 //CAutoLock cAutoLock(&m_propsLock);
274 //if(m_fDoPreBuffering == fDoPreBuffering) return S_FALSE;
276 //m_fDoPreBuffering = fDoPreBuffering;
278 //return S_OK;
281 STDMETHODIMP CDirectVobSub::get_ColorSpace(int* colorSpace)
283 CAutoLock cAutoLock(&m_propsLock);
285 return colorSpace ? *colorSpace = m_colorSpace, S_OK : E_POINTER;
288 STDMETHODIMP CDirectVobSub::put_ColorSpace(int colorSpace)
290 CAutoLock cAutoLock(&m_propsLock);
292 if(m_colorSpace == colorSpace) return S_FALSE;
294 m_colorSpace = colorSpace;
296 return S_OK;
299 STDMETHODIMP CDirectVobSub::get_YuvRange(int* yuvRange)
301 CAutoLock cAutoLock(&m_propsLock);
303 return yuvRange ? *yuvRange = m_yuvRange, S_OK : E_POINTER;
306 STDMETHODIMP CDirectVobSub::put_YuvRange(int yuvRange)
308 CAutoLock cAutoLock(&m_propsLock);
310 if(m_yuvRange == yuvRange) return S_FALSE;
312 m_yuvRange = yuvRange;
314 return S_OK;
317 STDMETHODIMP CDirectVobSub::get_Placement(bool* fOverridePlacement, int* xperc, int* yperc)
319 CAutoLock cAutoLock(&m_propsLock);
321 if(fOverridePlacement) *fOverridePlacement = m_fOverridePlacement;
322 if(xperc) *xperc = m_PlacementXperc;
323 if(yperc) *yperc = m_PlacementYperc;
325 return S_OK;
328 STDMETHODIMP CDirectVobSub::put_Placement(bool fOverridePlacement, int xperc, int yperc)
330 DbgLog((LOG_TRACE, 3, "%s(%d): %s", __FILE__, __LINE__, __FUNCTION__));
331 CAutoLock cAutoLock(&m_propsLock);
333 DbgLog((LOG_TRACE, 3, "\tfOverridePlacement:%d xperc:%d yperc:%d", (int)fOverridePlacement, xperc, yperc));
334 DbgLog((LOG_TRACE, 3, "\tm_fOverridePlacement:%d m_PlacementXperc:%d m_PlacementYperc:%d", (int)m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc));
335 if(m_fOverridePlacement == fOverridePlacement && m_PlacementXperc == xperc && m_PlacementYperc == yperc) return S_FALSE;
337 m_fOverridePlacement = fOverridePlacement;
338 m_PlacementXperc = xperc;
339 m_PlacementYperc = yperc;
341 return S_OK;
344 STDMETHODIMP CDirectVobSub::get_VobSubSettings(bool* fBuffer, bool* fOnlyShowForcedSubs, bool* fPolygonize)
346 CAutoLock cAutoLock(&m_propsLock);
348 if(fBuffer) *fBuffer = m_fBufferVobSub;
349 if(fOnlyShowForcedSubs) *fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
350 if(fPolygonize) *fPolygonize = m_fPolygonize;
352 return S_OK;
355 STDMETHODIMP CDirectVobSub::put_VobSubSettings(bool fBuffer, bool fOnlyShowForcedSubs, bool fPolygonize)
357 CAutoLock cAutoLock(&m_propsLock);
359 if(m_fBufferVobSub == fBuffer && m_fOnlyShowForcedVobSubs == fOnlyShowForcedSubs && m_fPolygonize == fPolygonize) return S_FALSE;
361 m_fBufferVobSub = fBuffer;
362 m_fOnlyShowForcedVobSubs = fOnlyShowForcedSubs;
363 m_fPolygonize = fPolygonize;
365 return S_OK;
368 STDMETHODIMP CDirectVobSub::get_TextSettings(void* lf, int lflen, COLORREF* color, bool* fShadow, bool* fOutline, bool* fAdvancedRenderer)
370 CAutoLock cAutoLock(&m_propsLock);
372 if(lf)
374 if(lflen == sizeof(LOGFONTA))
375 strncpy_s(((LOGFONTA*)lf)->lfFaceName, LF_FACESIZE, CStringA(m_defStyle.fontName), _TRUNCATE);
376 else if(lflen == sizeof(LOGFONTW))
377 wcsncpy_s(((LOGFONTW*)lf)->lfFaceName, LF_FACESIZE, CStringW(m_defStyle.fontName), _TRUNCATE);
378 else
379 return E_INVALIDARG;
381 ((LOGFONT*)lf)->lfCharSet = m_defStyle.charSet;
382 ((LOGFONT*)lf)->lfItalic = m_defStyle.fItalic;
383 ((LOGFONT*)lf)->lfHeight = m_defStyle.fontSize;
384 ((LOGFONT*)lf)->lfWeight = m_defStyle.fontWeight;
385 ((LOGFONT*)lf)->lfStrikeOut = m_defStyle.fStrikeOut;
386 ((LOGFONT*)lf)->lfUnderline = m_defStyle.fUnderline;
389 if(color) *color = m_defStyle.colors[0];
390 if(fShadow) *fShadow = (m_defStyle.shadowDepthX>0) || (m_defStyle.shadowDepthY>0);
391 if(fOutline) *fOutline = (m_defStyle.outlineWidthX>0) || (m_defStyle.outlineWidthY>0);
392 if(fAdvancedRenderer) *fAdvancedRenderer = m_fAdvancedRenderer;
394 return S_OK;
397 STDMETHODIMP CDirectVobSub::put_TextSettings(void* lf, int lflen, COLORREF color, bool fShadow, bool fOutline, bool fAdvancedRenderer)
399 CAutoLock cAutoLock(&m_propsLock);
400 STSStyle tmp = m_defStyle;
401 if(lf)
403 if(lflen == sizeof(LOGFONTA))
404 tmp.fontName = ((LOGFONTA*)lf)->lfFaceName;
405 else if(lflen == sizeof(LOGFONTW))
406 tmp.fontName = ((LOGFONTW*)lf)->lfFaceName;
407 else
408 return E_INVALIDARG;
410 tmp.charSet = ((LOGFONT*)lf)->lfCharSet;
411 tmp.fItalic = !!((LOGFONT*)lf)->lfItalic;
412 tmp.fontSize = ((LOGFONT*)lf)->lfHeight;
413 tmp.fontWeight = ((LOGFONT*)lf)->lfWeight;
414 tmp.fStrikeOut = !!((LOGFONT*)lf)->lfStrikeOut;
415 tmp.fUnderline = !!((LOGFONT*)lf)->lfUnderline;
417 if(tmp.fontSize < 0)
419 HDC hdc = ::GetDC(0);
420 m_defStyle.fontSize = -m_defStyle.fontSize * 72 / GetDeviceCaps(hdc, LOGPIXELSY);
421 ::ReleaseDC(0, hdc);
426 tmp.colors[0] = color;
427 tmp.shadowDepthX = tmp.shadowDepthY = fShadow?2:0;
428 tmp.outlineWidthX = tmp.outlineWidthY = fOutline?2:0;
430 if(tmp==m_defStyle)
432 return S_FALSE;//Important! Avoid unnecessary deinit
434 else
436 m_defStyle = tmp;
437 return S_OK;
442 STDMETHODIMP CDirectVobSub::get_Flip(bool* fPicture, bool* fSubtitles)
444 CAutoLock cAutoLock(&m_propsLock);
446 if(fPicture) *fPicture = m_fFlipPicture;
447 if(fSubtitles) *fSubtitles = m_fFlipSubtitles;
449 return S_OK;
452 STDMETHODIMP CDirectVobSub::put_Flip(bool fPicture, bool fSubtitles)
454 CAutoLock cAutoLock(&m_propsLock);
456 if(m_fFlipPicture == fPicture && m_fFlipSubtitles == fSubtitles) return S_FALSE;
458 m_fFlipPicture = fPicture;
459 m_fFlipSubtitles = fSubtitles;
461 return S_OK;
464 STDMETHODIMP CDirectVobSub::get_OSD(bool* fOSD)
466 CAutoLock cAutoLock(&m_propsLock);
468 return fOSD ? *fOSD = m_fOSD, S_OK : E_POINTER;
471 STDMETHODIMP CDirectVobSub::put_OSD(bool fOSD)
473 CAutoLock cAutoLock(&m_propsLock);
475 if(m_fOSD == fOSD) return S_FALSE;
477 m_fOSD = fOSD;
479 return S_OK;
482 STDMETHODIMP CDirectVobSub::get_SaveFullPath(bool* fSaveFullPath)
484 CAutoLock cAutoLock(&m_propsLock);
486 return fSaveFullPath ? *fSaveFullPath = m_fSaveFullPath, S_OK : E_POINTER;
489 STDMETHODIMP CDirectVobSub::put_SaveFullPath(bool fSaveFullPath)
491 CAutoLock cAutoLock(&m_propsLock);
493 if(m_fSaveFullPath == fSaveFullPath) return S_FALSE;
495 m_fSaveFullPath = fSaveFullPath;
497 return S_OK;
500 STDMETHODIMP CDirectVobSub::get_SubtitleTiming(int* delay, int* speedmul, int* speeddiv)
502 CAutoLock cAutoLock(&m_propsLock);
504 if(delay) *delay = m_SubtitleDelay;
505 if(speedmul) *speedmul = m_SubtitleSpeedMul;
506 if(speeddiv) *speeddiv = m_SubtitleSpeedDiv;
508 return S_OK;
511 STDMETHODIMP CDirectVobSub::put_SubtitleTiming(int delay, int speedmul, int speeddiv)
513 CAutoLock cAutoLock(&m_propsLock);
515 if(m_SubtitleDelay == delay && m_SubtitleSpeedMul == speedmul && m_SubtitleSpeedDiv == speeddiv) return S_FALSE;
517 m_SubtitleDelay = delay;
518 m_SubtitleSpeedMul = speedmul;
519 if(speeddiv > 0) m_SubtitleSpeedDiv = speeddiv;
521 return S_OK;
524 STDMETHODIMP CDirectVobSub::get_MediaFPS(bool* fEnabled, double* fps)
526 CAutoLock cAutoLock(&m_propsLock);
528 if(fEnabled) *fEnabled = m_fMediaFPSEnabled;
529 if(fps) *fps = m_MediaFPS;
531 return S_OK;
534 STDMETHODIMP CDirectVobSub::put_MediaFPS(bool fEnabled, double fps)
536 CAutoLock cAutoLock(&m_propsLock);
538 if(m_fMediaFPSEnabled == fEnabled && m_MediaFPS == fps) return S_FALSE;
540 m_fMediaFPSEnabled = fEnabled;
541 if(fps > 0) m_MediaFPS = fps;
543 return S_OK;
546 STDMETHODIMP CDirectVobSub::get_ZoomRect(NORMALIZEDRECT* rect)
548 CAutoLock cAutoLock(&m_propsLock);
550 if(!rect) return E_POINTER;
552 *rect = m_ZoomRect;
554 return S_OK;
557 STDMETHODIMP CDirectVobSub::put_ZoomRect(NORMALIZEDRECT* rect)
559 CAutoLock cAutoLock(&m_propsLock);
561 if(!rect) return E_POINTER;
563 if(!memcmp(&m_ZoomRect, rect, sizeof(m_ZoomRect))) return S_FALSE;
565 m_ZoomRect = *rect;
567 return S_OK;
570 STDMETHODIMP CDirectVobSub::get_OutputColorFormat(ColorSpaceId* preferredOrder, bool* fSelected, UINT* count)
572 CAutoLock cAutoLock(&m_propsLock);
573 if(count)
575 *count = GetOutputColorSpaceNumber();
577 if(preferredOrder)
579 memcpy(preferredOrder, m_outputColorSpace, GetOutputColorSpaceNumber()*sizeof(*preferredOrder));
581 if(fSelected)
583 memcpy(fSelected, m_selectedOutputColorSpace, GetOutputColorSpaceNumber()*sizeof(*fSelected));
586 return S_OK;
589 STDMETHODIMP CDirectVobSub::put_OutputColorFormat( const ColorSpaceId* preferredOrder, const bool* fSelected, UINT count )
591 CAutoLock cAutoLock(&m_propsLock);
593 if( count!=GetOutputColorSpaceNumber() )
594 return S_FALSE;
595 if( (preferredOrder==NULL || !memcmp(preferredOrder, m_outputColorSpace, count*sizeof(*preferredOrder)))
596 && (fSelected==NULL || !memcmp(fSelected, m_selectedOutputColorSpace, count*sizeof(*fSelected))) )
597 return S_FALSE;
598 if(preferredOrder)
599 memcpy(m_outputColorSpace, preferredOrder, count*sizeof(*preferredOrder));
600 if(fSelected)
601 memcpy(m_selectedOutputColorSpace, fSelected, count*sizeof(*fSelected));
603 return S_OK;
606 STDMETHODIMP CDirectVobSub::get_InputColorFormat( ColorSpaceId* preferredOrder, bool* fSelected, UINT* count )
608 CAutoLock cAutoLock(&m_propsLock);
609 if(count)
611 *count = GetInputColorSpaceNumber();
613 if(preferredOrder)
615 memcpy(preferredOrder, m_inputColorSpace, GetOutputColorSpaceNumber()*sizeof(*preferredOrder));
617 if(fSelected)
619 memcpy(fSelected, m_selectedInputColorSpace, GetOutputColorSpaceNumber()*sizeof(*fSelected));
622 return S_OK;
625 STDMETHODIMP CDirectVobSub::put_InputColorFormat( const ColorSpaceId* preferredOrder, const bool* fSelected, UINT count )
627 CAutoLock cAutoLock(&m_propsLock);
629 if( count!=GetInputColorSpaceNumber() )
630 return S_FALSE;
631 if( (preferredOrder==NULL || !memcmp(preferredOrder, m_inputColorSpace, count*sizeof(*preferredOrder)))
632 && (fSelected==NULL || !memcmp(fSelected, m_selectedInputColorSpace, count*sizeof(*fSelected))) )
633 return S_FALSE;
634 if(preferredOrder)
635 memcpy(m_inputColorSpace, preferredOrder, count*sizeof(*preferredOrder));
636 if(fSelected)
637 memcpy(m_selectedInputColorSpace, fSelected, count*sizeof(*fSelected));
639 return S_OK;
642 STDMETHODIMP CDirectVobSub::get_OverlayCacheMaxItemNum(int* overlay_cache_max_item_num)
644 CAutoLock cAutoLock(&m_propsLock);
646 if(overlay_cache_max_item_num) *overlay_cache_max_item_num = m_overlay_cache_max_item_num;
648 return S_OK;
651 STDMETHODIMP CDirectVobSub::put_OverlayCacheMaxItemNum(int overlay_cache_max_item_num)
653 CAutoLock cAutoLock(&m_propsLock);
655 if(m_overlay_cache_max_item_num == overlay_cache_max_item_num || overlay_cache_max_item_num<0) return S_FALSE;
657 m_overlay_cache_max_item_num = overlay_cache_max_item_num;
659 return S_OK;
662 STDMETHODIMP CDirectVobSub::get_ScanLineDataCacheMaxItemNum(int* scan_line_data_cache_max_item_num)
664 CAutoLock cAutoLock(&m_propsLock);
666 if(scan_line_data_cache_max_item_num) *scan_line_data_cache_max_item_num = m_scan_line_data_cache_max_item_num;
668 return S_OK;
671 STDMETHODIMP CDirectVobSub::put_ScanLineDataCacheMaxItemNum(int scan_line_data_cache_max_item_num)
673 CAutoLock cAutoLock(&m_propsLock);
675 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;
676 m_scan_line_data_cache_max_item_num = scan_line_data_cache_max_item_num;
678 return S_OK;
681 STDMETHODIMP CDirectVobSub::get_PathDataCacheMaxItemNum(int* path_data_cache_max_item_num)
683 CAutoLock cAutoLock(&m_propsLock);
685 if(path_data_cache_max_item_num) *path_data_cache_max_item_num = m_path_data_cache_max_item_num;
687 return S_OK;
690 STDMETHODIMP CDirectVobSub::put_PathDataCacheMaxItemNum(int path_data_cache_max_item_num)
692 CAutoLock cAutoLock(&m_propsLock);
694 if(m_path_data_cache_max_item_num == path_data_cache_max_item_num || path_data_cache_max_item_num<0) return S_FALSE;
695 m_path_data_cache_max_item_num = path_data_cache_max_item_num;
697 return S_OK;
700 STDMETHODIMP CDirectVobSub::get_OverlayNoBlurCacheMaxItemNum(int* overlay_no_blur_cache_max_item_num)
702 CAutoLock cAutoLock(&m_propsLock);
704 if(overlay_no_blur_cache_max_item_num) *overlay_no_blur_cache_max_item_num = m_overlay_no_blur_cache_max_item_num;
706 return S_OK;
709 STDMETHODIMP CDirectVobSub::put_OverlayNoBlurCacheMaxItemNum(int overlay_no_blur_cache_max_item_num)
711 CAutoLock cAutoLock(&m_propsLock);
713 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;
714 m_overlay_no_blur_cache_max_item_num = overlay_no_blur_cache_max_item_num;
716 return S_OK;
719 STDMETHODIMP CDirectVobSub::get_CachesInfo(CachesInfo* caches_info)
721 CAutoLock cAutoLock(&m_propsLock);
722 if(caches_info)
724 caches_info->path_cache_cur_item_num = 0;
725 caches_info->path_cache_hit_count = 0;
726 caches_info->path_cache_query_count = 0;
727 caches_info->scanline_cache_cur_item_num= 0;
728 caches_info->scanline_cache_hit_count = 0;
729 caches_info->scanline_cache_query_count = 0;
730 caches_info->non_blur_cache_cur_item_num= 0;
731 caches_info->non_blur_cache_hit_count = 0;
732 caches_info->non_blur_cache_query_count = 0;
733 caches_info->overlay_cache_cur_item_num = 0;
734 caches_info->overlay_cache_hit_count = 0;
735 caches_info->overlay_cache_query_count = 0;
736 caches_info->interpolate_cache_cur_item_num = 0;
737 caches_info->interpolate_cache_query_count = 0;
738 caches_info->interpolate_cache_hit_count = 0;
739 caches_info->text_info_cache_cur_item_num = 0;
740 caches_info->text_info_cache_query_count = 0;
741 caches_info->text_info_cache_hit_count = 0;
742 caches_info->word_info_cache_cur_item_num = 0;
743 caches_info->word_info_cache_query_count = 0;
744 caches_info->word_info_cache_hit_count = 0;
745 return S_OK;
747 else
749 return S_FALSE;
753 STDMETHODIMP CDirectVobSub::get_SubpixelPositionLevel(int* subpixel_pos_level)
755 CAutoLock cAutoLock(&m_propsLock);
757 if(subpixel_pos_level) *subpixel_pos_level = m_subpixel_pos_level;
759 return S_OK;
762 STDMETHODIMP CDirectVobSub::put_SubpixelPositionLevel(int subpixel_pos_level)
764 CAutoLock cAutoLock(&m_propsLock);
766 if(m_subpixel_pos_level == subpixel_pos_level || subpixel_pos_level<0 || subpixel_pos_level>=SubpixelPositionControler::MAX_COUNT) return S_FALSE;
767 m_subpixel_pos_level = subpixel_pos_level;
769 return S_OK;
772 STDMETHODIMP CDirectVobSub::get_FollowUpstreamPreferredOrder( bool *fFollowUpstreamPreferredOrder )
774 CAutoLock cAutoLock(&m_propsLock);
776 if(fFollowUpstreamPreferredOrder) *fFollowUpstreamPreferredOrder=m_fFollowUpstreamPreferredOrder;
778 return S_OK;
781 STDMETHODIMP CDirectVobSub::put_FollowUpstreamPreferredOrder( bool fFollowUpstreamPreferredOrder )
783 CAutoLock cAutoLock(&m_propsLock);
785 if(m_fFollowUpstreamPreferredOrder == fFollowUpstreamPreferredOrder) return S_FALSE;
786 m_fFollowUpstreamPreferredOrder = fFollowUpstreamPreferredOrder;
788 return S_OK;
791 STDMETHODIMP CDirectVobSub::get_HideTrayIcon( bool *fHideTrayIcon )
793 CAutoLock cAutoLock(&m_propsLock);
795 if(fHideTrayIcon) *fHideTrayIcon=m_fHideTrayIcon;
797 return S_OK;
800 STDMETHODIMP CDirectVobSub::put_HideTrayIcon( bool fHideTrayIcon )
802 CAutoLock cAutoLock(&m_propsLock);
804 if(m_fHideTrayIcon == fHideTrayIcon) return S_FALSE;
805 m_fHideTrayIcon = fHideTrayIcon;
807 return S_OK;
810 STDMETHODIMP CDirectVobSub::UpdateRegistry()
812 AFX_MANAGE_STATE(AfxGetStaticModuleState());
814 CAutoLock cAutoLock(&m_propsLock);
816 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), m_fHideSubtitles);
817 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DOPREBUFFERING), m_fDoPreBuffering);
819 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_YUV_RANGE), m_yuvRange);
821 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLOR_SPACE), m_colorSpace);
822 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_BT601_WIDTH), 1024);
823 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_BT601_HEIGHT), 600);
825 theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), m_fOverridePlacement);
826 theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), m_PlacementXperc);
827 theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), m_PlacementYperc);
828 theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), m_fBufferVobSub);
829 theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), m_fOnlyShowForcedVobSubs);
830 theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), m_fPolygonize);
831 CString style;
832 theApp.WriteProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), style <<= m_defStyle);
833 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), m_fFlipPicture);
834 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), m_fFlipSubtitles);
835 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), m_fOSD);
836 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), m_fSaveFullPath);
837 theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), m_SubtitleDelay);
838 theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), m_SubtitleSpeedMul);
839 theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), m_SubtitleSpeedDiv);
840 theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), m_fMediaFPSEnabled);
841 theApp.WriteProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), (BYTE*)&m_MediaFPS, sizeof(m_MediaFPS));
842 theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_AUTOPARCOMPENSATION), m_ePARCompensationType);
843 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE_TRAY_ICON), m_fHideTrayIcon);
845 theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_OVERLAY_CACHE_MAX_ITEM_NUM), m_overlay_cache_max_item_num);
846 theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_OVERLAY_NO_BLUR_CACHE_MAX_ITEM_NUM), m_overlay_no_blur_cache_max_item_num);
847 theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_SCAN_LINE_DATA_CACHE_MAX_ITEM_NUM), m_scan_line_data_cache_max_item_num);
848 theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_PATH_DATA_CACHE_MAX_ITEM_NUM), m_path_data_cache_max_item_num);
849 theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_SUBPIXEL_POS_LEVEL), m_subpixel_pos_level);
850 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_USE_UPSTREAM_PREFERRED_ORDER), m_fFollowUpstreamPreferredOrder);
852 //save output color config
854 int count = GetOutputColorSpaceNumber();
855 BYTE* pData = new BYTE[2*count];
856 for(int i = 0; i < count; i++)
858 pData[2*i] = static_cast<BYTE>(m_outputColorSpace[i]);
859 pData[2*i+1] = static_cast<BYTE>(m_selectedOutputColorSpace[i]);
861 theApp.WriteProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_OUTPUT_COLORFORMATS), pData, 2*count);
863 delete [] pData;
866 //save input color config
868 int count = GetInputColorSpaceNumber();
869 BYTE* pData = new BYTE[2*count];
870 for(int i = 0; i < count; i++)
872 pData[2*i] = static_cast<BYTE>(m_inputColorSpace[i]);
873 pData[2*i+1] = static_cast<BYTE>(m_selectedInputColorSpace[i]);
875 theApp.WriteProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INPUT_COLORFORMATS), pData, 2*count);
877 delete [] pData;
880 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SUPPORTED_VERSION), CUR_SUPPORTED_FILTER_VERSION);
881 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VERSION), XY_VSFILTER_VERSION_COMMIT);
883 return S_OK;
886 STDMETHODIMP CDirectVobSub::HasConfigDialog(int iSelected)
888 return E_NOTIMPL;
891 STDMETHODIMP CDirectVobSub::ShowConfigDialog(int iSelected, HWND hWndParent)
893 return E_NOTIMPL;
896 STDMETHODIMP CDirectVobSub::IsSubtitleReloaderLocked(bool* fLocked)
898 CAutoLock cAutoLock(&m_propsLock);
900 if(!fLocked) return E_POINTER;
902 bool fDisabled;
903 get_SubtitleReloader(&fDisabled);
905 *fLocked = fDisabled || m_nReloaderDisableCount > 0;
907 return S_OK;
910 STDMETHODIMP CDirectVobSub::LockSubtitleReloader(bool fLock)
912 CAutoLock cAutoLock(&m_propsLock);
914 if(fLock) m_nReloaderDisableCount++;
915 else m_nReloaderDisableCount--;
917 ASSERT(m_nReloaderDisableCount >= 0);
918 if(m_nReloaderDisableCount < 0) m_nReloaderDisableCount = 0;
920 return S_OK;
923 STDMETHODIMP CDirectVobSub::get_SubtitleReloader(bool* fDisabled)
925 AFX_MANAGE_STATE(AfxGetStaticModuleState());
927 CAutoLock cAutoLock(&m_propsLock);
929 if(fDisabled) *fDisabled = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0);
931 return S_OK;
934 STDMETHODIMP CDirectVobSub::put_SubtitleReloader(bool fDisable)
936 AFX_MANAGE_STATE(AfxGetStaticModuleState());
938 CAutoLock cAutoLock(&m_propsLock);
940 bool b;
941 get_SubtitleReloader(&b);
942 if(b == fDisable) return S_FALSE;
944 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), fDisable);
946 return S_OK;
949 STDMETHODIMP CDirectVobSub::get_ExtendPicture(int* horizontal, int* vertical, int* resx2, int* resx2minw, int* resx2minh)
951 AFX_MANAGE_STATE(AfxGetStaticModuleState());
953 CAutoLock cAutoLock(&m_propsLock);
955 if(horizontal) *horizontal = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), 0) & 1;
956 if(vertical) *vertical = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), 0);
957 //if(resx2) *resx2 = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), 2) & 3;
958 if(resx2) *resx2 = 0;
959 if(resx2minw) *resx2minw = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), 384);
960 if(resx2minh) *resx2minh = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), 288);
962 return S_OK;
965 STDMETHODIMP CDirectVobSub::put_ExtendPicture(int horizontal, int vertical, int resx2, int resx2minw, int resx2minh)
967 AFX_MANAGE_STATE(AfxGetStaticModuleState());
969 CAutoLock cAutoLock(&m_propsLock);
970 if(resx2==0)
972 int i[5];
973 get_ExtendPicture(i, i+1, i+2, i+3, i+4);
974 if(i[0] == horizontal && i[1] == vertical && i[2] == resx2 && i[3] == resx2minw && i[4] == resx2minh) return S_FALSE;
976 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), horizontal & 1);
977 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), vertical);
978 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), resx2 & 3);
979 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), resx2minw);
980 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), resx2minh);
982 return S_OK;
984 else
986 return S_FALSE;
990 STDMETHODIMP CDirectVobSub::get_LoadSettings(int* level, bool* fExternalLoad, bool* fWebLoad, bool* fEmbeddedLoad)
992 AFX_MANAGE_STATE(AfxGetStaticModuleState());
994 CAutoLock cAutoLock(&m_propsLock);
996 if(level) *level = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), 0) & 3;
997 if(fExternalLoad) *fExternalLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), 1);
998 if(fWebLoad) *fWebLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), 0);
999 if(fEmbeddedLoad) *fEmbeddedLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), 1);
1001 return S_OK;
1004 STDMETHODIMP CDirectVobSub::put_LoadSettings(int level, bool fExternalLoad, bool fWebLoad, bool fEmbeddedLoad)
1006 AFX_MANAGE_STATE(AfxGetStaticModuleState());
1008 CAutoLock cAutoLock(&m_propsLock);
1010 int i;
1011 bool b[3];
1012 get_LoadSettings(&i, b, b+1, b+2);
1013 if(i == level && b[0] == fExternalLoad && b[1] == fWebLoad && b[2] == fEmbeddedLoad) return S_FALSE;
1015 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), level & 3);
1016 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), fExternalLoad);
1017 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), fWebLoad);
1018 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), fEmbeddedLoad);
1020 return S_OK;
1023 // IDirectVobSub2
1025 STDMETHODIMP CDirectVobSub::AdviseSubClock(ISubClock* pSubClock)
1027 m_pSubClock = pSubClock;
1028 return S_OK;
1031 STDMETHODIMP_(bool) CDirectVobSub::get_Forced()
1033 return m_fForced;
1036 STDMETHODIMP CDirectVobSub::put_Forced(bool fForced)
1038 if(m_fForced==fForced)
1039 return S_FALSE;
1041 m_fForced = fForced;
1042 return S_OK;
1045 STDMETHODIMP CDirectVobSub::get_TextSettings(STSStyle* pDefStyle)
1047 CheckPointer(pDefStyle, E_POINTER);
1049 CAutoLock cAutoLock(&m_propsLock);
1051 *pDefStyle = m_defStyle;
1053 return S_OK;
1056 STDMETHODIMP CDirectVobSub::put_TextSettings(STSStyle* pDefStyle)
1058 CheckPointer(pDefStyle, E_POINTER);
1060 CAutoLock cAutoLock(&m_propsLock);
1062 if(m_defStyle==*pDefStyle)
1063 return S_FALSE;
1064 if(!memcmp(&m_defStyle, pDefStyle, sizeof(m_defStyle)))
1065 return S_FALSE;
1067 m_defStyle = *pDefStyle;
1069 return S_OK;
1072 STDMETHODIMP CDirectVobSub::get_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType)
1074 CAutoLock cAutoLock(&m_propsLock);
1076 *ePARCompensationType = m_ePARCompensationType;
1078 return S_OK;
1081 STDMETHODIMP CDirectVobSub::put_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType)
1083 CAutoLock cAutoLock(&m_propsLock);
1085 if(m_ePARCompensationType==*ePARCompensationType)
1086 return S_FALSE;
1088 m_ePARCompensationType = *ePARCompensationType;
1090 return S_OK;
1093 // IFilterVersion
1095 STDMETHODIMP_(DWORD) CDirectVobSub::GetFilterVersion()
1097 return 0x0234;
1100 bool CDirectVobSub::is_compatible()
1102 bool compatible = false;
1103 if ( m_config_info_version>XY_VSFILTER_VERSION_COMMIT )
1105 compatible = m_supported_filter_verion<=XY_VSFILTER_VERSION_COMMIT;
1107 else
1109 compatible = REQUIRED_CONFIG_VERSION<=m_config_info_version;
1111 return compatible;
1114 UINT CDirectVobSub::GetCompatibleProfileInt( LPCTSTR lpszSection, LPCTSTR lpszEntry, int nDefault )
1116 UINT result = nDefault;
1117 if (is_compatible())
1119 result = theApp.GetProfileInt(lpszSection, lpszEntry, nDefault);
1121 return result;