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)
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
23 #include "DirectVobSub.h"
26 using namespace DirectVobSubXyOptions
;
28 CDirectVobSub::CDirectVobSub()
30 AFX_MANAGE_STATE(AfxGetStaticModuleState());
35 m_supported_filter_verion
= theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_SUPPORTED_VERSION
), 0);
36 m_config_info_version
= theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_VERSION
), 0);
38 m_iSelectedLanguage
= 0;
39 m_fHideSubtitles
= !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_HIDE
), 0);
40 m_fDoPreBuffering
= !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_DOPREBUFFERING
), 1);
42 m_xy_int_opt
[INT_COLOR_SPACE
] = GetCompatibleProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_COLOR_SPACE
), CDirectVobSub::YuvMatrix_AUTO
);
43 if( m_xy_int_opt
[INT_COLOR_SPACE
]!=CDirectVobSub::YuvMatrix_AUTO
&&
44 m_xy_int_opt
[INT_COLOR_SPACE
]!=CDirectVobSub::BT_601
&&
45 m_xy_int_opt
[INT_COLOR_SPACE
]!=CDirectVobSub::BT_709
&&
46 m_xy_int_opt
[INT_COLOR_SPACE
]!=CDirectVobSub::GUESS
)
48 m_xy_int_opt
[INT_COLOR_SPACE
] = CDirectVobSub::YuvMatrix_AUTO
;
50 m_xy_int_opt
[INT_YUV_RANGE
] = GetCompatibleProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_YUV_RANGE
), CDirectVobSub::YuvRange_Auto
);
51 if( m_xy_int_opt
[INT_YUV_RANGE
]!=CDirectVobSub::YuvRange_Auto
&&
52 m_xy_int_opt
[INT_YUV_RANGE
]!=CDirectVobSub::YuvRange_PC
&&
53 m_xy_int_opt
[INT_YUV_RANGE
]!=CDirectVobSub::YuvRange_TV
)
55 m_xy_int_opt
[INT_YUV_RANGE
] = CDirectVobSub::YuvRange_Auto
;
58 m_bt601Width
= theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_BT601_WIDTH
), 1024);
59 m_bt601Height
= theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_BT601_HEIGHT
), 600);
61 m_fOverridePlacement
= !!theApp
.GetProfileInt(ResStr(IDS_R_TEXT
), ResStr(IDS_RT_OVERRIDEPLACEMENT
), 0);
62 m_PlacementXperc
= theApp
.GetProfileInt(ResStr(IDS_R_TEXT
), ResStr(IDS_RT_XPERC
), 50);
63 m_PlacementYperc
= theApp
.GetProfileInt(ResStr(IDS_R_TEXT
), ResStr(IDS_RT_YPERC
), 90);
64 m_fBufferVobSub
= !!theApp
.GetProfileInt(ResStr(IDS_R_VOBSUB
), ResStr(IDS_RV_BUFFER
), 1);
65 m_fOnlyShowForcedVobSubs
= !!theApp
.GetProfileInt(ResStr(IDS_R_VOBSUB
), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS
), 0);
66 m_fPolygonize
= !!theApp
.GetProfileInt(ResStr(IDS_R_VOBSUB
), ResStr(IDS_RV_POLYGONIZE
), 0);
67 m_defStyle
<<= theApp
.GetProfileString(ResStr(IDS_R_TEXT
), ResStr(IDS_RT_STYLE
), _T(""));
68 m_fFlipPicture
= !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_FLIPPICTURE
), 0);
69 m_fFlipSubtitles
= !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_FLIPSUBTITLES
), 0);
70 m_fOSD
= !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_SHOWOSDSTATS
), 0);
71 m_fSaveFullPath
= !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_SAVEFULLPATH
), 0);
72 m_nReloaderDisableCount
= !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_DISABLERELOADER
), 0) ? 1 : 0;
73 m_SubtitleDelay
= theApp
.GetProfileInt(ResStr(IDS_R_TIMING
), ResStr(IDS_RTM_SUBTITLEDELAY
), 0);
74 m_SubtitleSpeedMul
= theApp
.GetProfileInt(ResStr(IDS_R_TIMING
), ResStr(IDS_RTM_SUBTITLESPEEDMUL
), 1000);
75 m_SubtitleSpeedDiv
= theApp
.GetProfileInt(ResStr(IDS_R_TIMING
), ResStr(IDS_RTM_SUBTITLESPEEDDIV
), 1000);
76 m_fMediaFPSEnabled
= !!theApp
.GetProfileInt(ResStr(IDS_R_TIMING
), ResStr(IDS_RTM_MEDIAFPSENABLED
), 0);
77 m_ePARCompensationType
= static_cast<CSimpleTextSubtitle::EPARCompensationType
>(theApp
.GetProfileInt(ResStr(IDS_R_TEXT
), ResStr(IDS_RT_AUTOPARCOMPENSATION
), 0));
78 m_xy_bool_opt
[BOOL_HIDE_TRAY_ICON
] = !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_HIDE_TRAY_ICON
), 0);
80 m_xy_int_opt
[INT_OVERLAY_CACHE_MAX_ITEM_NUM
] = theApp
.GetProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_OVERLAY_CACHE_MAX_ITEM_NUM
)
81 , CacheManager::OVERLAY_CACHE_ITEM_NUM
);
82 if(m_xy_int_opt
[INT_OVERLAY_CACHE_MAX_ITEM_NUM
]<0) m_xy_int_opt
[INT_OVERLAY_CACHE_MAX_ITEM_NUM
] = 0;
84 m_xy_int_opt
[INT_OVERLAY_NO_BLUR_CACHE_MAX_ITEM_NUM
] = theApp
.GetProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_OVERLAY_NO_BLUR_CACHE_MAX_ITEM_NUM
)
85 , CacheManager::OVERLAY_NO_BLUR_CACHE_ITEM_NUM
);
86 if(m_xy_int_opt
[INT_OVERLAY_NO_BLUR_CACHE_MAX_ITEM_NUM
]<0) m_xy_int_opt
[INT_OVERLAY_NO_BLUR_CACHE_MAX_ITEM_NUM
] = 0;
88 m_xy_int_opt
[INT_SCAN_LINE_DATA_CACHE_MAX_ITEM_NUM
] = theApp
.GetProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_SCAN_LINE_DATA_CACHE_MAX_ITEM_NUM
)
89 , CacheManager::SCAN_LINE_DATA_CACHE_ITEM_NUM
);
90 if(m_xy_int_opt
[INT_SCAN_LINE_DATA_CACHE_MAX_ITEM_NUM
]<0) m_xy_int_opt
[INT_SCAN_LINE_DATA_CACHE_MAX_ITEM_NUM
] = 0;
92 m_xy_int_opt
[INT_PATH_DATA_CACHE_MAX_ITEM_NUM
] = theApp
.GetProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_PATH_DATA_CACHE_MAX_ITEM_NUM
)
93 , CacheManager::PATH_CACHE_ITEM_NUM
);
94 if(m_xy_int_opt
[INT_PATH_DATA_CACHE_MAX_ITEM_NUM
]<0) m_xy_int_opt
[INT_PATH_DATA_CACHE_MAX_ITEM_NUM
] = 0;
96 m_xy_int_opt
[INT_BITMAP_MRU_CACHE_ITEM_NUM
] = theApp
.GetProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_BITMAP_MRU_CACHE_ITEM_NUM
)
97 , CacheManager::BITMAP_MRU_CACHE_ITEM_NUM
);
98 if(m_xy_int_opt
[INT_BITMAP_MRU_CACHE_ITEM_NUM
]<0) m_xy_int_opt
[INT_BITMAP_MRU_CACHE_ITEM_NUM
] = 0;
100 m_xy_int_opt
[INT_CLIPPER_MRU_CACHE_ITEM_NUM
] = theApp
.GetProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_CLIPPER_MRU_CACHE_ITEM_NUM
)
101 , CacheManager::CLIPPER_MRU_CACHE_ITEM_NUM
);
102 if(m_xy_int_opt
[INT_CLIPPER_MRU_CACHE_ITEM_NUM
]<0) m_xy_int_opt
[INT_CLIPPER_MRU_CACHE_ITEM_NUM
] = 0;
104 m_xy_int_opt
[INT_TEXT_INFO_CACHE_ITEM_NUM
] = theApp
.GetProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_TEXT_INFO_CACHE_ITEM_NUM
)
105 , CacheManager::TEXT_INFO_CACHE_ITEM_NUM
);
106 if(m_xy_int_opt
[INT_TEXT_INFO_CACHE_ITEM_NUM
]<0) m_xy_int_opt
[INT_TEXT_INFO_CACHE_ITEM_NUM
] = 0;
108 m_xy_int_opt
[INT_ASS_TAG_LIST_CACHE_ITEM_NUM
] = theApp
.GetProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_ASS_TAG_LIST_CACHE_ITEM_NUM
)
109 , CacheManager::ASS_TAG_LIST_CACHE_ITEM_NUM
);
110 if(m_xy_int_opt
[INT_ASS_TAG_LIST_CACHE_ITEM_NUM
]<0) m_xy_int_opt
[INT_ASS_TAG_LIST_CACHE_ITEM_NUM
] = 0;
112 m_xy_int_opt
[INT_SUBPIXEL_POS_LEVEL
] = theApp
.GetProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_SUBPIXEL_POS_LEVEL
), SubpixelPositionControler::EIGHT_X_EIGHT
);
113 if(m_xy_int_opt
[INT_SUBPIXEL_POS_LEVEL
]<0) m_xy_int_opt
[INT_SUBPIXEL_POS_LEVEL
]=0;
114 else if(m_xy_int_opt
[INT_SUBPIXEL_POS_LEVEL
]>=SubpixelPositionControler::MAX_COUNT
) m_xy_int_opt
[INT_SUBPIXEL_POS_LEVEL
]=SubpixelPositionControler::EIGHT_X_EIGHT
;
116 m_xy_int_opt
[INT_LAYOUT_SIZE_OPT
] = theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_LAYOUT_SIZE_OPT
), LAYOUT_SIZE_OPT_FOLLOW_ORIGINAL_VIDEO_SIZE
);
117 switch(m_xy_int_opt
[INT_LAYOUT_SIZE_OPT
])
119 case LAYOUT_SIZE_OPT_FOLLOW_ORIGINAL_VIDEO_SIZE
:
120 case LAYOUT_SIZE_OPT_USER_SPECIFIED
:
123 m_xy_int_opt
[INT_LAYOUT_SIZE_OPT
] = LAYOUT_SIZE_OPT_FOLLOW_ORIGINAL_VIDEO_SIZE
;
127 m_xy_size_opt
[SIZE_USER_SPECIFIED_LAYOUT_SIZE
].cx
= theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_USER_SPECIFIED_LAYOUT_SIZE_X
), 0);
128 m_xy_size_opt
[SIZE_USER_SPECIFIED_LAYOUT_SIZE
].cy
= theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_USER_SPECIFIED_LAYOUT_SIZE_Y
), 0);
129 if (m_xy_size_opt
[SIZE_USER_SPECIFIED_LAYOUT_SIZE
].cx
<=0 || m_xy_size_opt
[SIZE_USER_SPECIFIED_LAYOUT_SIZE
].cy
<=0)
131 m_xy_size_opt
[SIZE_USER_SPECIFIED_LAYOUT_SIZE
].cx
= 1280;
132 m_xy_size_opt
[SIZE_USER_SPECIFIED_LAYOUT_SIZE
].cy
= 720;
135 m_xy_size_opt
[SIZE_ASS_PLAY_RESOLUTION
] = CSize(0,0);
136 m_xy_size_opt
[SIZE_ORIGINAL_VIDEO
] = CSize(0,0);
138 m_xy_bool_opt
[BOOL_FOLLOW_UPSTREAM_PREFERRED_ORDER
] = !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_USE_UPSTREAM_PREFERRED_ORDER
), true);
139 // get output colorspace config
145 if(theApp
.GetProfileBinary(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_OUTPUT_COLORFORMATS
), &pData
, &nSize
)
146 && pData
&& nSize
== 2*GetOutputColorSpaceNumber())
148 for (unsigned i
=0;i
<nSize
/2;i
++)
150 m_outputColorSpace
[i
].color_space
= static_cast<ColorSpaceId
>(pData
[2*i
]);
151 m_outputColorSpace
[i
].selected
= !!pData
[2*i
+1];
156 for (unsigned i
=0;i
<GetOutputColorSpaceNumber();i
++)
158 m_outputColorSpace
[i
].color_space
= static_cast<ColorSpaceId
>(i
);
159 m_outputColorSpace
[i
].selected
= true;
163 // get input colorspace config
169 if(theApp
.GetProfileBinary(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_INPUT_COLORFORMATS
), &pData
, &nSize
)
170 && pData
&& nSize
== 2*GetInputColorSpaceNumber())
172 for (unsigned i
=0;i
<nSize
/2;i
++)
174 m_inputColorSpace
[i
].color_space
= static_cast<ColorSpaceId
>(pData
[2*i
]);
175 m_inputColorSpace
[i
].selected
= !!pData
[2*i
+1];
180 for (unsigned i
=0;i
<GetOutputColorSpaceNumber();i
++)
182 m_inputColorSpace
[i
].color_space
= static_cast<ColorSpaceId
>(i
);
183 m_inputColorSpace
[i
].selected
= true;
193 if(theApp
.GetProfileBinary(ResStr(IDS_R_TIMING
), ResStr(IDS_RTM_MEDIAFPS
), &pData
, &nSize
) && pData
)
195 if(nSize
!= sizeof(m_MediaFPS
)) m_MediaFPS
= 25.0;
196 else memcpy(&m_MediaFPS
, pData
, sizeof(m_MediaFPS
));
198 m_ZoomRect
.left
= m_ZoomRect
.top
= 0;
199 m_ZoomRect
.right
= m_ZoomRect
.bottom
= 1;
209 CDirectVobSub::~CDirectVobSub()
211 CAutoLock
cAutoLock(&m_propsLock
);
214 STDMETHODIMP
CDirectVobSub::get_FileName(WCHAR
* fn
)
216 CAutoLock
cAutoLock(&m_propsLock
);
218 if(!fn
) return E_POINTER
;
221 wcscpy(fn
, m_FileName
);
223 mbstowcs(fn
, m_FileName
, m_FileName
.GetLength()+1);
229 STDMETHODIMP
CDirectVobSub::put_FileName(WCHAR
* fn
)
231 CAutoLock
cAutoLock(&m_propsLock
);
233 if(!fn
) return E_POINTER
;
236 if(!m_FileName
.Left(m_FileName
.ReverseFind('.')+1).CompareNoCase(tmp
.Left(tmp
.ReverseFind('.')+1))) return S_FALSE
;
242 ::TranslateCharsetInfo((DWORD
*)DEFAULT_CHARSET
, &cs
, TCI_SRCCHARSET
);
243 CHAR
* buff
= m_FileName
.GetBuffer(MAX_PATH
*2);
244 int len
= WideCharToMultiByte(cs
.ciACP
/*CP_OEMCP*/, NULL
, fn
, -1, buff
, MAX_PATH
*2, NULL
, NULL
);
245 m_FileName
.ReleaseBuffer(len
+1);
251 STDMETHODIMP
CDirectVobSub::get_LanguageCount(int* nLangs
)
253 CAutoLock
cAutoLock(&m_propsLock
);
255 return nLangs
? *nLangs
= 0, S_OK
: E_POINTER
;
258 STDMETHODIMP
CDirectVobSub::get_LanguageName(int iLanguage
, WCHAR
** ppName
)
263 STDMETHODIMP
CDirectVobSub::get_SelectedLanguage(int* iSelected
)
265 CAutoLock
cAutoLock(&m_propsLock
);
267 return iSelected
? *iSelected
= m_iSelectedLanguage
, S_OK
: E_POINTER
;
270 STDMETHODIMP
CDirectVobSub::put_SelectedLanguage(int iSelected
)
272 CAutoLock
cAutoLock(&m_propsLock
);
274 if(m_iSelectedLanguage
== iSelected
) return S_FALSE
;
277 if(FAILED(get_LanguageCount(&nCount
))
279 || iSelected
>= nCount
)
282 m_iSelectedLanguage
= iSelected
;
287 STDMETHODIMP
CDirectVobSub::get_HideSubtitles(bool* fHideSubtitles
)
289 CAutoLock
cAutoLock(&m_propsLock
);
291 return fHideSubtitles
? *fHideSubtitles
= m_fHideSubtitles
, S_OK
: E_POINTER
;
294 STDMETHODIMP
CDirectVobSub::put_HideSubtitles(bool fHideSubtitles
)
296 CAutoLock
cAutoLock(&m_propsLock
);
298 if(m_fHideSubtitles
== fHideSubtitles
) return S_FALSE
;
300 m_fHideSubtitles
= fHideSubtitles
;
305 STDMETHODIMP
CDirectVobSub::get_PreBuffering(bool* fDoPreBuffering
)
307 CAutoLock
cAutoLock(&m_propsLock
);
309 //return fDoPreBuffering ? *fDoPreBuffering = m_fDoPreBuffering, S_OK : E_POINTER;
310 return fDoPreBuffering
? *fDoPreBuffering
= false, S_OK
: E_POINTER
;
313 STDMETHODIMP
CDirectVobSub::put_PreBuffering(bool fDoPreBuffering
)
316 //CAutoLock cAutoLock(&m_propsLock);
318 //if(m_fDoPreBuffering == fDoPreBuffering) return S_FALSE;
320 //m_fDoPreBuffering = fDoPreBuffering;
326 STDMETHODIMP
CDirectVobSub::get_Placement(bool* fOverridePlacement
, int* xperc
, int* yperc
)
328 CAutoLock
cAutoLock(&m_propsLock
);
330 if(fOverridePlacement
) *fOverridePlacement
= m_fOverridePlacement
;
331 if(xperc
) *xperc
= m_PlacementXperc
;
332 if(yperc
) *yperc
= m_PlacementYperc
;
337 STDMETHODIMP
CDirectVobSub::put_Placement(bool fOverridePlacement
, int xperc
, int yperc
)
339 DbgLog((LOG_TRACE
, 3, "%s(%d): %s", __FILE__
, __LINE__
, __FUNCTION__
));
340 CAutoLock
cAutoLock(&m_propsLock
);
342 DbgLog((LOG_TRACE
, 3, "\tfOverridePlacement:%d xperc:%d yperc:%d", (int)fOverridePlacement
, xperc
, yperc
));
343 DbgLog((LOG_TRACE
, 3, "\tm_fOverridePlacement:%d m_PlacementXperc:%d m_PlacementYperc:%d", (int)m_fOverridePlacement
, m_PlacementXperc
, m_PlacementYperc
));
344 if(m_fOverridePlacement
== fOverridePlacement
&& m_PlacementXperc
== xperc
&& m_PlacementYperc
== yperc
) return S_FALSE
;
346 m_fOverridePlacement
= fOverridePlacement
;
347 m_PlacementXperc
= xperc
;
348 m_PlacementYperc
= yperc
;
353 STDMETHODIMP
CDirectVobSub::get_VobSubSettings(bool* fBuffer
, bool* fOnlyShowForcedSubs
, bool* fPolygonize
)
355 CAutoLock
cAutoLock(&m_propsLock
);
357 if(fBuffer
) *fBuffer
= m_fBufferVobSub
;
358 if(fOnlyShowForcedSubs
) *fOnlyShowForcedSubs
= m_fOnlyShowForcedVobSubs
;
359 if(fPolygonize
) *fPolygonize
= m_fPolygonize
;
364 STDMETHODIMP
CDirectVobSub::put_VobSubSettings(bool fBuffer
, bool fOnlyShowForcedSubs
, bool fPolygonize
)
366 CAutoLock
cAutoLock(&m_propsLock
);
368 if(m_fBufferVobSub
== fBuffer
&& m_fOnlyShowForcedVobSubs
== fOnlyShowForcedSubs
&& m_fPolygonize
== fPolygonize
) return S_FALSE
;
370 m_fBufferVobSub
= fBuffer
;
371 m_fOnlyShowForcedVobSubs
= fOnlyShowForcedSubs
;
372 m_fPolygonize
= fPolygonize
;
377 STDMETHODIMP
CDirectVobSub::get_TextSettings(void* lf
, int lflen
, COLORREF
* color
, bool* fShadow
, bool* fOutline
, bool* fAdvancedRenderer
)
379 CAutoLock
cAutoLock(&m_propsLock
);
383 if(lflen
== sizeof(LOGFONTA
))
384 strncpy_s(((LOGFONTA
*)lf
)->lfFaceName
, LF_FACESIZE
, CStringA(m_defStyle
.fontName
), _TRUNCATE
);
385 else if(lflen
== sizeof(LOGFONTW
))
386 wcsncpy_s(((LOGFONTW
*)lf
)->lfFaceName
, LF_FACESIZE
, CStringW(m_defStyle
.fontName
), _TRUNCATE
);
390 ((LOGFONT
*)lf
)->lfCharSet
= m_defStyle
.charSet
;
391 ((LOGFONT
*)lf
)->lfItalic
= m_defStyle
.fItalic
;
392 ((LOGFONT
*)lf
)->lfHeight
= m_defStyle
.fontSize
;
393 ((LOGFONT
*)lf
)->lfWeight
= m_defStyle
.fontWeight
;
394 ((LOGFONT
*)lf
)->lfStrikeOut
= m_defStyle
.fStrikeOut
;
395 ((LOGFONT
*)lf
)->lfUnderline
= m_defStyle
.fUnderline
;
398 if(color
) *color
= m_defStyle
.colors
[0];
399 if(fShadow
) *fShadow
= (m_defStyle
.shadowDepthX
>0) || (m_defStyle
.shadowDepthY
>0);
400 if(fOutline
) *fOutline
= (m_defStyle
.outlineWidthX
>0) || (m_defStyle
.outlineWidthY
>0);
401 if(fAdvancedRenderer
) *fAdvancedRenderer
= m_fAdvancedRenderer
;
406 STDMETHODIMP
CDirectVobSub::put_TextSettings(void* lf
, int lflen
, COLORREF color
, bool fShadow
, bool fOutline
, bool fAdvancedRenderer
)
408 CAutoLock
cAutoLock(&m_propsLock
);
409 STSStyle tmp
= m_defStyle
;
412 if(lflen
== sizeof(LOGFONTA
))
413 tmp
.fontName
= ((LOGFONTA
*)lf
)->lfFaceName
;
414 else if(lflen
== sizeof(LOGFONTW
))
415 tmp
.fontName
= ((LOGFONTW
*)lf
)->lfFaceName
;
419 tmp
.charSet
= ((LOGFONT
*)lf
)->lfCharSet
;
420 tmp
.fItalic
= !!((LOGFONT
*)lf
)->lfItalic
;
421 tmp
.fontSize
= ((LOGFONT
*)lf
)->lfHeight
;
422 tmp
.fontWeight
= ((LOGFONT
*)lf
)->lfWeight
;
423 tmp
.fStrikeOut
= !!((LOGFONT
*)lf
)->lfStrikeOut
;
424 tmp
.fUnderline
= !!((LOGFONT
*)lf
)->lfUnderline
;
428 HDC hdc
= ::GetDC(0);
429 m_defStyle
.fontSize
= -m_defStyle
.fontSize
* 72 / GetDeviceCaps(hdc
, LOGPIXELSY
);
435 tmp
.colors
[0] = color
;
436 tmp
.shadowDepthX
= tmp
.shadowDepthY
= fShadow
?2:0;
437 tmp
.outlineWidthX
= tmp
.outlineWidthY
= fOutline
?2:0;
441 return S_FALSE
;//Important! Avoid unnecessary deinit
451 STDMETHODIMP
CDirectVobSub::get_Flip(bool* fPicture
, bool* fSubtitles
)
453 CAutoLock
cAutoLock(&m_propsLock
);
455 if(fPicture
) *fPicture
= m_fFlipPicture
;
456 if(fSubtitles
) *fSubtitles
= m_fFlipSubtitles
;
461 STDMETHODIMP
CDirectVobSub::put_Flip(bool fPicture
, bool fSubtitles
)
463 CAutoLock
cAutoLock(&m_propsLock
);
465 if(m_fFlipPicture
== fPicture
&& m_fFlipSubtitles
== fSubtitles
) return S_FALSE
;
467 m_fFlipPicture
= fPicture
;
468 m_fFlipSubtitles
= fSubtitles
;
473 STDMETHODIMP
CDirectVobSub::get_OSD(bool* fOSD
)
475 CAutoLock
cAutoLock(&m_propsLock
);
477 return fOSD
? *fOSD
= m_fOSD
, S_OK
: E_POINTER
;
480 STDMETHODIMP
CDirectVobSub::put_OSD(bool fOSD
)
482 CAutoLock
cAutoLock(&m_propsLock
);
484 if(m_fOSD
== fOSD
) return S_FALSE
;
491 STDMETHODIMP
CDirectVobSub::get_SaveFullPath(bool* fSaveFullPath
)
493 CAutoLock
cAutoLock(&m_propsLock
);
495 return fSaveFullPath
? *fSaveFullPath
= m_fSaveFullPath
, S_OK
: E_POINTER
;
498 STDMETHODIMP
CDirectVobSub::put_SaveFullPath(bool fSaveFullPath
)
500 CAutoLock
cAutoLock(&m_propsLock
);
502 if(m_fSaveFullPath
== fSaveFullPath
) return S_FALSE
;
504 m_fSaveFullPath
= fSaveFullPath
;
509 STDMETHODIMP
CDirectVobSub::get_SubtitleTiming(int* delay
, int* speedmul
, int* speeddiv
)
511 CAutoLock
cAutoLock(&m_propsLock
);
513 if(delay
) *delay
= m_SubtitleDelay
;
514 if(speedmul
) *speedmul
= m_SubtitleSpeedMul
;
515 if(speeddiv
) *speeddiv
= m_SubtitleSpeedDiv
;
520 STDMETHODIMP
CDirectVobSub::put_SubtitleTiming(int delay
, int speedmul
, int speeddiv
)
522 CAutoLock
cAutoLock(&m_propsLock
);
524 if(m_SubtitleDelay
== delay
&& m_SubtitleSpeedMul
== speedmul
&& m_SubtitleSpeedDiv
== speeddiv
) return S_FALSE
;
526 m_SubtitleDelay
= delay
;
527 m_SubtitleSpeedMul
= speedmul
;
528 if(speeddiv
> 0) m_SubtitleSpeedDiv
= speeddiv
;
533 STDMETHODIMP
CDirectVobSub::get_MediaFPS(bool* fEnabled
, double* fps
)
535 CAutoLock
cAutoLock(&m_propsLock
);
537 if(fEnabled
) *fEnabled
= m_fMediaFPSEnabled
;
538 if(fps
) *fps
= m_MediaFPS
;
543 STDMETHODIMP
CDirectVobSub::put_MediaFPS(bool fEnabled
, double fps
)
545 CAutoLock
cAutoLock(&m_propsLock
);
547 if(m_fMediaFPSEnabled
== fEnabled
&& m_MediaFPS
== fps
) return S_FALSE
;
549 m_fMediaFPSEnabled
= fEnabled
;
550 if(fps
> 0) m_MediaFPS
= fps
;
555 STDMETHODIMP
CDirectVobSub::get_ZoomRect(NORMALIZEDRECT
* rect
)
557 CAutoLock
cAutoLock(&m_propsLock
);
559 if(!rect
) return E_POINTER
;
566 STDMETHODIMP
CDirectVobSub::put_ZoomRect(NORMALIZEDRECT
* rect
)
568 CAutoLock
cAutoLock(&m_propsLock
);
570 if(!rect
) return E_POINTER
;
572 if(!memcmp(&m_ZoomRect
, rect
, sizeof(m_ZoomRect
))) return S_FALSE
;
579 STDMETHODIMP
CDirectVobSub::get_CachesInfo(CachesInfo
* caches_info
)
581 CAutoLock
cAutoLock(&m_propsLock
);
584 caches_info
->path_cache_cur_item_num
= 0;
585 caches_info
->path_cache_hit_count
= 0;
586 caches_info
->path_cache_query_count
= 0;
587 caches_info
->scanline_cache2_cur_item_num
= 0;
588 caches_info
->scanline_cache2_hit_count
= 0;
589 caches_info
->scanline_cache2_query_count
= 0;
590 caches_info
->non_blur_cache_cur_item_num
= 0;
591 caches_info
->non_blur_cache_hit_count
= 0;
592 caches_info
->non_blur_cache_query_count
= 0;
593 caches_info
->overlay_cache_cur_item_num
= 0;
594 caches_info
->overlay_cache_hit_count
= 0;
595 caches_info
->overlay_cache_query_count
= 0;
596 caches_info
->interpolate_cache_cur_item_num
= 0;
597 caches_info
->interpolate_cache_query_count
= 0;
598 caches_info
->interpolate_cache_hit_count
= 0;
599 caches_info
->text_info_cache_cur_item_num
= 0;
600 caches_info
->text_info_cache_query_count
= 0;
601 caches_info
->text_info_cache_hit_count
= 0;
602 caches_info
->word_info_cache_cur_item_num
= 0;
603 caches_info
->word_info_cache_query_count
= 0;
604 caches_info
->word_info_cache_hit_count
= 0;
613 STDMETHODIMP
CDirectVobSub::get_XyFlyWeightInfo(XyFlyWeightInfo
* xy_fw_info
)
615 CAutoLock
cAutoLock(&m_propsLock
);
618 xy_fw_info
->xy_fw_string_w
.cur_item_num
= 0;
619 xy_fw_info
->xy_fw_string_w
.hit_count
= 0;
620 xy_fw_info
->xy_fw_string_w
.query_count
= 0;
622 xy_fw_info
->xy_fw_grouped_draw_items_hash_key
.cur_item_num
= 0;
623 xy_fw_info
->xy_fw_grouped_draw_items_hash_key
.hit_count
= 0;
624 xy_fw_info
->xy_fw_grouped_draw_items_hash_key
.query_count
= 0;
631 STDMETHODIMP
CDirectVobSub::UpdateRegistry()
633 AFX_MANAGE_STATE(AfxGetStaticModuleState());
635 CAutoLock
cAutoLock(&m_propsLock
);
637 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_HIDE
), m_fHideSubtitles
);
638 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_DOPREBUFFERING
), m_fDoPreBuffering
);
640 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_YUV_RANGE
), m_xy_int_opt
[INT_YUV_RANGE
]);
642 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_COLOR_SPACE
), m_xy_int_opt
[INT_COLOR_SPACE
]);
643 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_BT601_WIDTH
), 1024);
644 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_BT601_HEIGHT
), 600);
646 theApp
.WriteProfileInt(ResStr(IDS_R_TEXT
), ResStr(IDS_RT_OVERRIDEPLACEMENT
), m_fOverridePlacement
);
647 theApp
.WriteProfileInt(ResStr(IDS_R_TEXT
), ResStr(IDS_RT_XPERC
), m_PlacementXperc
);
648 theApp
.WriteProfileInt(ResStr(IDS_R_TEXT
), ResStr(IDS_RT_YPERC
), m_PlacementYperc
);
649 theApp
.WriteProfileInt(ResStr(IDS_R_VOBSUB
), ResStr(IDS_RV_BUFFER
), m_fBufferVobSub
);
650 theApp
.WriteProfileInt(ResStr(IDS_R_VOBSUB
), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS
), m_fOnlyShowForcedVobSubs
);
651 theApp
.WriteProfileInt(ResStr(IDS_R_VOBSUB
), ResStr(IDS_RV_POLYGONIZE
), m_fPolygonize
);
653 theApp
.WriteProfileString(ResStr(IDS_R_TEXT
), ResStr(IDS_RT_STYLE
), style
<<= m_defStyle
);
654 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_FLIPPICTURE
), m_fFlipPicture
);
655 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_FLIPSUBTITLES
), m_fFlipSubtitles
);
656 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_SHOWOSDSTATS
), m_fOSD
);
657 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_SAVEFULLPATH
), m_fSaveFullPath
);
658 theApp
.WriteProfileInt(ResStr(IDS_R_TIMING
), ResStr(IDS_RTM_SUBTITLEDELAY
), m_SubtitleDelay
);
659 theApp
.WriteProfileInt(ResStr(IDS_R_TIMING
), ResStr(IDS_RTM_SUBTITLESPEEDMUL
), m_SubtitleSpeedMul
);
660 theApp
.WriteProfileInt(ResStr(IDS_R_TIMING
), ResStr(IDS_RTM_SUBTITLESPEEDDIV
), m_SubtitleSpeedDiv
);
661 theApp
.WriteProfileInt(ResStr(IDS_R_TIMING
), ResStr(IDS_RTM_MEDIAFPSENABLED
), m_fMediaFPSEnabled
);
662 theApp
.WriteProfileBinary(ResStr(IDS_R_TIMING
), ResStr(IDS_RTM_MEDIAFPS
), (BYTE
*)&m_MediaFPS
, sizeof(m_MediaFPS
));
663 theApp
.WriteProfileInt(ResStr(IDS_R_TEXT
), ResStr(IDS_RT_AUTOPARCOMPENSATION
), m_ePARCompensationType
);
664 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_HIDE_TRAY_ICON
), m_xy_bool_opt
[BOOL_HIDE_TRAY_ICON
]);
666 theApp
.WriteProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_BITMAP_MRU_CACHE_ITEM_NUM
), m_xy_int_opt
[INT_BITMAP_MRU_CACHE_ITEM_NUM
]);
667 theApp
.WriteProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_CLIPPER_MRU_CACHE_ITEM_NUM
), m_xy_int_opt
[INT_CLIPPER_MRU_CACHE_ITEM_NUM
]);
668 theApp
.WriteProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_TEXT_INFO_CACHE_ITEM_NUM
), m_xy_int_opt
[INT_TEXT_INFO_CACHE_ITEM_NUM
]);
669 theApp
.WriteProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_ASS_TAG_LIST_CACHE_ITEM_NUM
), m_xy_int_opt
[INT_ASS_TAG_LIST_CACHE_ITEM_NUM
]);
671 theApp
.WriteProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_OVERLAY_CACHE_MAX_ITEM_NUM
), m_xy_int_opt
[INT_OVERLAY_CACHE_MAX_ITEM_NUM
]);
672 theApp
.WriteProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_OVERLAY_NO_BLUR_CACHE_MAX_ITEM_NUM
), m_xy_int_opt
[INT_OVERLAY_NO_BLUR_CACHE_MAX_ITEM_NUM
]);
673 theApp
.WriteProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_SCAN_LINE_DATA_CACHE_MAX_ITEM_NUM
), m_xy_int_opt
[INT_SCAN_LINE_DATA_CACHE_MAX_ITEM_NUM
]);
674 theApp
.WriteProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_PATH_DATA_CACHE_MAX_ITEM_NUM
), m_xy_int_opt
[INT_PATH_DATA_CACHE_MAX_ITEM_NUM
]);
675 theApp
.WriteProfileInt(ResStr(IDS_R_PERFORMANCE
), ResStr(IDS_RP_SUBPIXEL_POS_LEVEL
), m_xy_int_opt
[INT_SUBPIXEL_POS_LEVEL
]);
676 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_USE_UPSTREAM_PREFERRED_ORDER
), m_xy_bool_opt
[BOOL_FOLLOW_UPSTREAM_PREFERRED_ORDER
]);
678 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_LAYOUT_SIZE_OPT
), m_xy_int_opt
[INT_LAYOUT_SIZE_OPT
]);
679 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_USER_SPECIFIED_LAYOUT_SIZE_X
), m_xy_size_opt
[SIZE_USER_SPECIFIED_LAYOUT_SIZE
].cx
);
680 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_USER_SPECIFIED_LAYOUT_SIZE_Y
), m_xy_size_opt
[SIZE_USER_SPECIFIED_LAYOUT_SIZE
].cy
);
682 //save output color config
684 int count
= GetOutputColorSpaceNumber();
685 BYTE
* pData
= new BYTE
[2*count
];
686 for(int i
= 0; i
< count
; i
++)
688 pData
[2*i
] = static_cast<BYTE
>(m_outputColorSpace
[i
].color_space
);
689 pData
[2*i
+1] = static_cast<BYTE
>(m_outputColorSpace
[i
].selected
);
691 theApp
.WriteProfileBinary(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_OUTPUT_COLORFORMATS
), pData
, 2*count
);
696 //save input color config
698 int count
= GetInputColorSpaceNumber();
699 BYTE
* pData
= new BYTE
[2*count
];
700 for(int i
= 0; i
< count
; i
++)
702 pData
[2*i
] = static_cast<BYTE
>(m_inputColorSpace
[i
].color_space
);
703 pData
[2*i
+1] = static_cast<BYTE
>(m_inputColorSpace
[i
].selected
);
705 theApp
.WriteProfileBinary(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_INPUT_COLORFORMATS
), pData
, 2*count
);
710 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_SUPPORTED_VERSION
), CUR_SUPPORTED_FILTER_VERSION
);
711 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_VERSION
), XY_VSFILTER_VERSION_COMMIT
);
716 STDMETHODIMP
CDirectVobSub::HasConfigDialog(int iSelected
)
721 STDMETHODIMP
CDirectVobSub::ShowConfigDialog(int iSelected
, HWND hWndParent
)
726 STDMETHODIMP
CDirectVobSub::IsSubtitleReloaderLocked(bool* fLocked
)
728 CAutoLock
cAutoLock(&m_propsLock
);
730 if(!fLocked
) return E_POINTER
;
733 get_SubtitleReloader(&fDisabled
);
735 *fLocked
= fDisabled
|| m_nReloaderDisableCount
> 0;
740 STDMETHODIMP
CDirectVobSub::LockSubtitleReloader(bool fLock
)
742 CAutoLock
cAutoLock(&m_propsLock
);
744 if(fLock
) m_nReloaderDisableCount
++;
745 else m_nReloaderDisableCount
--;
747 ASSERT(m_nReloaderDisableCount
>= 0);
748 if(m_nReloaderDisableCount
< 0) m_nReloaderDisableCount
= 0;
753 STDMETHODIMP
CDirectVobSub::get_SubtitleReloader(bool* fDisabled
)
755 AFX_MANAGE_STATE(AfxGetStaticModuleState());
757 CAutoLock
cAutoLock(&m_propsLock
);
759 if(fDisabled
) *fDisabled
= !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_DISABLERELOADER
), 0);
764 STDMETHODIMP
CDirectVobSub::put_SubtitleReloader(bool fDisable
)
766 AFX_MANAGE_STATE(AfxGetStaticModuleState());
768 CAutoLock
cAutoLock(&m_propsLock
);
771 get_SubtitleReloader(&b
);
772 if(b
== fDisable
) return S_FALSE
;
774 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_DISABLERELOADER
), fDisable
);
779 STDMETHODIMP
CDirectVobSub::get_ExtendPicture(int* horizontal
, int* vertical
, int* resx2
, int* resx2minw
, int* resx2minh
)
781 AFX_MANAGE_STATE(AfxGetStaticModuleState());
783 CAutoLock
cAutoLock(&m_propsLock
);
785 if(horizontal
) *horizontal
= theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_MOD32FIX
), 0) & 1;
786 if(vertical
) *vertical
= theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_EXTPIC
), 0);
787 //if(resx2) *resx2 = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), 2) & 3;
788 if(resx2
) *resx2
= 0;
789 if(resx2minw
) *resx2minw
= theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_RESX2MINW
), 384);
790 if(resx2minh
) *resx2minh
= theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_RESX2MINH
), 288);
795 STDMETHODIMP
CDirectVobSub::put_ExtendPicture(int horizontal
, int vertical
, int resx2
, int resx2minw
, int resx2minh
)
797 AFX_MANAGE_STATE(AfxGetStaticModuleState());
799 CAutoLock
cAutoLock(&m_propsLock
);
803 get_ExtendPicture(i
, i
+1, i
+2, i
+3, i
+4);
804 if(i
[0] == horizontal
&& i
[1] == vertical
&& i
[2] == resx2
&& i
[3] == resx2minw
&& i
[4] == resx2minh
) return S_FALSE
;
806 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_MOD32FIX
), horizontal
& 1);
807 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_EXTPIC
), vertical
);
808 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_RESX2
), resx2
& 3);
809 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_RESX2MINW
), resx2minw
);
810 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_RESX2MINH
), resx2minh
);
820 STDMETHODIMP
CDirectVobSub::get_LoadSettings(int* level
, bool* fExternalLoad
, bool* fWebLoad
, bool* fEmbeddedLoad
)
822 AFX_MANAGE_STATE(AfxGetStaticModuleState());
824 CAutoLock
cAutoLock(&m_propsLock
);
826 if(level
) *level
= theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_LOADLEVEL
), 0) & 3;
827 if(fExternalLoad
) *fExternalLoad
= !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_EXTERNALLOAD
), 1);
828 if(fWebLoad
) *fWebLoad
= !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_WEBLOAD
), 0);
829 if(fEmbeddedLoad
) *fEmbeddedLoad
= !!theApp
.GetProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_EMBEDDEDLOAD
), 1);
834 STDMETHODIMP
CDirectVobSub::put_LoadSettings(int level
, bool fExternalLoad
, bool fWebLoad
, bool fEmbeddedLoad
)
836 AFX_MANAGE_STATE(AfxGetStaticModuleState());
838 CAutoLock
cAutoLock(&m_propsLock
);
842 get_LoadSettings(&i
, b
, b
+1, b
+2);
843 if(i
== level
&& b
[0] == fExternalLoad
&& b
[1] == fWebLoad
&& b
[2] == fEmbeddedLoad
) return S_FALSE
;
845 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_LOADLEVEL
), level
& 3);
846 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_EXTERNALLOAD
), fExternalLoad
);
847 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_WEBLOAD
), fWebLoad
);
848 theApp
.WriteProfileInt(ResStr(IDS_R_GENERAL
), ResStr(IDS_RG_EMBEDDEDLOAD
), fEmbeddedLoad
);
855 STDMETHODIMP
CDirectVobSub::AdviseSubClock(ISubClock
* pSubClock
)
857 m_pSubClock
= pSubClock
;
861 STDMETHODIMP_(bool) CDirectVobSub::get_Forced()
866 STDMETHODIMP
CDirectVobSub::put_Forced(bool fForced
)
868 if(m_fForced
==fForced
)
875 STDMETHODIMP
CDirectVobSub::get_TextSettings(STSStyle
* pDefStyle
)
877 CheckPointer(pDefStyle
, E_POINTER
);
879 CAutoLock
cAutoLock(&m_propsLock
);
881 *pDefStyle
= m_defStyle
;
886 STDMETHODIMP
CDirectVobSub::put_TextSettings(STSStyle
* pDefStyle
)
888 CheckPointer(pDefStyle
, E_POINTER
);
890 CAutoLock
cAutoLock(&m_propsLock
);
892 if(m_defStyle
==*pDefStyle
)
894 if(!memcmp(&m_defStyle
, pDefStyle
, sizeof(m_defStyle
)))
897 m_defStyle
= *pDefStyle
;
902 STDMETHODIMP
CDirectVobSub::get_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType
* ePARCompensationType
)
904 CAutoLock
cAutoLock(&m_propsLock
);
906 *ePARCompensationType
= m_ePARCompensationType
;
911 STDMETHODIMP
CDirectVobSub::put_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType
* ePARCompensationType
)
913 CAutoLock
cAutoLock(&m_propsLock
);
915 if(m_ePARCompensationType
==*ePARCompensationType
)
918 m_ePARCompensationType
= *ePARCompensationType
;
925 STDMETHODIMP_(DWORD
) CDirectVobSub::GetFilterVersion()
930 bool CDirectVobSub::is_compatible()
932 bool compatible
= false;
933 if ( m_config_info_version
>XY_VSFILTER_VERSION_COMMIT
)
935 compatible
= m_supported_filter_verion
<=XY_VSFILTER_VERSION_COMMIT
;
939 compatible
= REQUIRED_CONFIG_VERSION
<=m_config_info_version
;
944 UINT
CDirectVobSub::GetCompatibleProfileInt( LPCTSTR lpszSection
, LPCTSTR lpszEntry
, int nDefault
)
946 UINT result
= nDefault
;
949 result
= theApp
.GetProfileInt(lpszSection
, lpszEntry
, nDefault
);
956 STDMETHODIMP
CDirectVobSub::XyGetBool( int field
, bool *value
)
958 CAutoLock
cAutoLock(&m_propsLock
);
959 if (field
<0 || field
>=DirectVobSubXyOptions::BOOL_COUNT
)
963 return value
? *value
= m_xy_bool_opt
[field
], S_OK
: E_POINTER
;
966 STDMETHODIMP
CDirectVobSub::XyGetInt( int field
, int *value
)
968 CAutoLock
cAutoLock(&m_propsLock
);
969 if (field
<0 || field
>=DirectVobSubXyOptions::INT_COUNT
)
973 return value
? *value
= m_xy_int_opt
[field
], S_OK
: E_POINTER
;
976 STDMETHODIMP
CDirectVobSub::XyGetSize( int field
, SIZE
*value
)
978 CAutoLock
cAutoLock(&m_propsLock
);
979 if (field
<0 || field
>=DirectVobSubXyOptions::SIZE_COUNT
)
989 case SIZE_LAYOUT_WITH
:
990 switch(m_xy_int_opt
[DirectVobSubXyOptions::INT_LAYOUT_SIZE_OPT
])
992 case LAYOUT_SIZE_OPT_FOLLOW_ORIGINAL_VIDEO_SIZE
:
993 *value
= m_xy_size_opt
[DirectVobSubXyOptions::SIZE_ORIGINAL_VIDEO
];
995 case LAYOUT_SIZE_OPT_USER_SPECIFIED
:
996 *value
= m_xy_size_opt
[DirectVobSubXyOptions::SIZE_USER_SPECIFIED_LAYOUT_SIZE
];
999 *value
= m_xy_size_opt
[DirectVobSubXyOptions::SIZE_ASS_PLAY_RESOLUTION
];
1002 if (value
->cx
* value
->cy
== 0)
1004 *value
= m_xy_size_opt
[DirectVobSubXyOptions::SIZE_ORIGINAL_VIDEO
];
1008 *value
= m_xy_size_opt
[field
];
1014 STDMETHODIMP
CDirectVobSub::XyGetRect( int field
, RECT
*value
)
1019 STDMETHODIMP
CDirectVobSub::XyGetUlonglong( int field
, ULONGLONG
*value
)
1024 STDMETHODIMP
CDirectVobSub::XyGetDouble( int field
, double *value
)
1029 STDMETHODIMP
CDirectVobSub::XyGetString( int field
, LPWSTR
*value
, int *chars
)
1034 STDMETHODIMP
CDirectVobSub::XyGetBin( int field
, LPVOID
*value
, int *size
)
1036 CAutoLock
cAutoLock(&m_propsLock
);
1037 if (field
<0 || field
>=DirectVobSubXyOptions::BIN_COUNT
)
1043 return E_INVALIDARG
;
1052 case BIN_OUTPUT_COLOR_FORMAT
:
1055 *size
= GetOutputColorSpaceNumber();
1059 *value
= new ColorSpaceOpt
[*size
];
1061 memcpy(*value
, m_outputColorSpace
, GetOutputColorSpaceNumber()*sizeof(m_outputColorSpace
[0]));
1064 case BIN_INPUT_COLOR_FORMAT
:
1067 *size
= GetInputColorSpaceNumber();
1071 *value
= new ColorSpaceOpt
[*size
];
1073 memcpy(*value
, m_inputColorSpace
, GetInputColorSpaceNumber()*sizeof(m_inputColorSpace
[0]));
1076 case BIN_CACHES_INFO
:
1083 *value
= new CachesInfo
[1];
1085 return get_CachesInfo(reinterpret_cast<CachesInfo
*>(*value
));
1086 case BIN_XY_FLY_WEIGHT_INFO
:
1093 *value
= new XyFlyWeightInfo
[1];
1095 return get_XyFlyWeightInfo(reinterpret_cast<XyFlyWeightInfo
*>(*value
));
1101 STDMETHODIMP
CDirectVobSub::XySetBool( int field
, bool value
)
1103 if (field
<0 || field
>=DirectVobSubXyOptions::BOOL_COUNT
)
1108 CAutoLock
cAutoLock(&m_propsLock
);
1110 if(m_xy_bool_opt
[field
] == value
) return S_FALSE
;
1111 m_xy_bool_opt
[field
] = value
;
1116 STDMETHODIMP
CDirectVobSub::XySetInt( int field
, int value
)
1118 if (field
<0 || field
>=DirectVobSubXyOptions::INT_COUNT
)
1124 case DirectVobSubXyOptions::INT_LAYOUT_SIZE_OPT
:
1125 if (value
<0 || value
>=DirectVobSubXyOptions::LAYOUT_SIZE_OPT_COUNT
)
1127 return E_INVALIDARG
;
1131 CAutoLock
cAutoLock(&m_propsLock
);
1133 if(m_xy_int_opt
[field
] == value
) return S_FALSE
;
1134 m_xy_int_opt
[field
] = value
;
1139 STDMETHODIMP
CDirectVobSub::XySetSize( int field
, SIZE value
)
1141 if (field
<0 || field
>=DirectVobSubXyOptions::SIZE_COUNT
)
1147 case DirectVobSubXyOptions::SIZE_LAYOUT_WITH
:
1148 return E_INVALIDARG
;
1151 CAutoLock
cAutoLock(&m_propsLock
);
1153 if(m_xy_size_opt
[field
].cx
== value
.cx
&& m_xy_size_opt
[field
].cy
== value
.cy
) return S_FALSE
;
1154 m_xy_size_opt
[field
] = value
;
1159 STDMETHODIMP
CDirectVobSub::XySetRect( int field
, RECT value
)
1164 STDMETHODIMP
CDirectVobSub::XySetUlonglong( int field
, ULONGLONG value
)
1169 STDMETHODIMP
CDirectVobSub::XySetDouble( int field
, double value
)
1174 STDMETHODIMP
CDirectVobSub::XySetString( int field
, LPWSTR value
, int chars
)
1179 STDMETHODIMP
CDirectVobSub::XySetBin( int field
, LPVOID value
, int size
)
1181 CAutoLock
cAutoLock(&m_propsLock
);
1182 if (field
<0 || field
>=DirectVobSubXyOptions::BIN_COUNT
)
1188 case BIN_OUTPUT_COLOR_FORMAT
:
1189 if( size
!=GetOutputColorSpaceNumber() )
1190 return E_INVALIDARG
;
1191 if(value
&& memcmp(m_outputColorSpace
, value
, size
*sizeof(m_outputColorSpace
[0])))
1193 memcpy(m_outputColorSpace
, value
, size
*sizeof(m_outputColorSpace
[0]));
1197 case BIN_INPUT_COLOR_FORMAT
:
1198 if( size
!=GetInputColorSpaceNumber() )
1200 if( value
&& memcmp(m_inputColorSpace
, value
, size
*sizeof(m_inputColorSpace
[0])))
1202 memcpy(m_inputColorSpace
, value
, size
*sizeof(m_inputColorSpace
[0]));