00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "stdafx.h"
00023 #include "DirectVobSub.h"
00024 #include "VSFilter.h"
00025
00026 CDirectVobSub::CDirectVobSub()
00027 {
00028 AFX_MANAGE_STATE(AfxGetStaticModuleState());
00029
00030 BYTE* pData;
00031 UINT nSize;
00032
00033 m_iSelectedLanguage = 0;
00034 m_fHideSubtitles = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), 0);
00035 m_fDoPreBuffering = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DOPREBUFFERING), 1);
00036 m_fOverridePlacement = !!theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), 0);
00037 m_PlacementXperc = theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), 50);
00038 m_PlacementYperc = theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), 90);
00039 m_fBufferVobSub = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), 1);
00040 m_fOnlyShowForcedVobSubs = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), 0);
00041 m_fPolygonize = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), 0);
00042 m_defStyle <<= theApp.GetProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), _T(""));
00043 m_fFlipPicture = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), 0);
00044 m_fFlipSubtitles = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), 0);
00045 m_fOSD = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), 0);
00046 m_fSaveFullPath = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), 0);
00047 m_nReloaderDisableCount = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0) ? 1 : 0;
00048 m_SubtitleDelay = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), 0);
00049 m_SubtitleSpeedMul = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), 1000);
00050 m_SubtitleSpeedDiv = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), 1000);
00051 m_fMediaFPSEnabled = !!theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), 0);
00052 pData = NULL;
00053 if(theApp.GetProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), &pData, &nSize) && pData)
00054 {
00055 if(nSize != sizeof(m_MediaFPS)) m_MediaFPS = 25.0;
00056 else memcpy(&m_MediaFPS, pData, sizeof(m_MediaFPS));
00057 delete [] pData;
00058 }
00059 m_ZoomRect.left = m_ZoomRect.top = 0;
00060 m_ZoomRect.right = m_ZoomRect.bottom = 1;
00061
00062 m_fForced = false;
00063 }
00064
00065 CDirectVobSub::~CDirectVobSub()
00066 {
00067 CAutoLock cAutoLock(&m_propsLock);
00068 }
00069
00070 STDMETHODIMP CDirectVobSub::get_FileName(WCHAR* fn)
00071 {
00072 CAutoLock cAutoLock(&m_propsLock);
00073
00074 if(!fn) return E_POINTER;
00075
00076 #ifdef UNICODE
00077 wcscpy(fn, m_FileName);
00078 #else
00079 mbstowcs(fn, m_FileName, m_FileName.GetLength()+1);
00080 #endif
00081
00082 return S_OK;
00083 }
00084
00085 STDMETHODIMP CDirectVobSub::put_FileName(WCHAR* fn)
00086 {
00087 CAutoLock cAutoLock(&m_propsLock);
00088
00089 if(!fn) return E_POINTER;
00090
00091 CString tmp = fn;
00092 if(!m_FileName.Left(m_FileName.ReverseFind('.')+1).CompareNoCase(tmp.Left(tmp.ReverseFind('.')+1))) return S_FALSE;
00093
00094 #ifdef UNICODE
00095 m_FileName = fn;
00096 #else
00097 CHARSETINFO cs={0};
00098 ::TranslateCharsetInfo((DWORD *)DEFAULT_CHARSET, &cs, TCI_SRCCHARSET);
00099 CHAR* buff = m_FileName.GetBuffer(MAX_PATH*2);
00100 int len = WideCharToMultiByte(cs.ciACP, NULL, fn, -1, buff, MAX_PATH*2, NULL, NULL);
00101 m_FileName.ReleaseBuffer(len+1);
00102 #endif
00103
00104 return S_OK;
00105 }
00106
00107 STDMETHODIMP CDirectVobSub::get_LanguageCount(int* nLangs)
00108 {
00109 CAutoLock cAutoLock(&m_propsLock);
00110
00111 return nLangs ? *nLangs = 0, S_OK : E_POINTER;
00112 }
00113
00114 STDMETHODIMP CDirectVobSub::get_LanguageName(int iLanguage, WCHAR** ppName)
00115 {
00116 return S_OK;
00117 }
00118
00119 STDMETHODIMP CDirectVobSub::get_SelectedLanguage(int* iSelected)
00120 {
00121 CAutoLock cAutoLock(&m_propsLock);
00122
00123 return iSelected ? *iSelected = m_iSelectedLanguage, S_OK : E_POINTER;
00124 }
00125
00126 STDMETHODIMP CDirectVobSub::put_SelectedLanguage(int iSelected)
00127 {
00128 CAutoLock cAutoLock(&m_propsLock);
00129
00130 if(m_iSelectedLanguage == iSelected) return S_FALSE;
00131
00132 int nCount;
00133 if(FAILED(get_LanguageCount(&nCount))
00134 || iSelected < 0
00135 || iSelected >= nCount)
00136 return E_FAIL;
00137
00138 m_iSelectedLanguage = iSelected;
00139
00140 return S_OK;
00141 }
00142
00143 STDMETHODIMP CDirectVobSub::get_HideSubtitles(bool* fHideSubtitles)
00144 {
00145 CAutoLock cAutoLock(&m_propsLock);
00146
00147 return fHideSubtitles ? *fHideSubtitles = m_fHideSubtitles, S_OK : E_POINTER;
00148 }
00149
00150 STDMETHODIMP CDirectVobSub::put_HideSubtitles(bool fHideSubtitles)
00151 {
00152 CAutoLock cAutoLock(&m_propsLock);
00153
00154 if(m_fHideSubtitles == fHideSubtitles) return S_FALSE;
00155
00156 m_fHideSubtitles = fHideSubtitles;
00157
00158 return S_OK;
00159 }
00160
00161 STDMETHODIMP CDirectVobSub::get_PreBuffering(bool* fDoPreBuffering)
00162 {
00163 CAutoLock cAutoLock(&m_propsLock);
00164
00165 return fDoPreBuffering ? *fDoPreBuffering = m_fDoPreBuffering, S_OK : E_POINTER;
00166 }
00167
00168 STDMETHODIMP CDirectVobSub::put_PreBuffering(bool fDoPreBuffering)
00169 {
00170 CAutoLock cAutoLock(&m_propsLock);
00171
00172 if(m_fDoPreBuffering == fDoPreBuffering) return S_FALSE;
00173
00174 m_fDoPreBuffering = fDoPreBuffering;
00175
00176 return S_OK;
00177 }
00178
00179 STDMETHODIMP CDirectVobSub::get_Placement(bool* fOverridePlacement, int* xperc, int* yperc)
00180 {
00181 CAutoLock cAutoLock(&m_propsLock);
00182
00183 if(fOverridePlacement) *fOverridePlacement = m_fOverridePlacement;
00184 if(xperc) *xperc = m_PlacementXperc;
00185 if(yperc) *yperc = m_PlacementYperc;
00186
00187 return S_OK;
00188 }
00189
00190 STDMETHODIMP CDirectVobSub::put_Placement(bool fOverridePlacement, int xperc, int yperc)
00191 {
00192 CAutoLock cAutoLock(&m_propsLock);
00193
00194 if(m_fOverridePlacement == fOverridePlacement && m_PlacementXperc == xperc && m_PlacementYperc == yperc) return S_FALSE;
00195
00196 m_fOverridePlacement = fOverridePlacement;
00197 m_PlacementXperc = xperc;
00198 m_PlacementYperc = yperc;
00199
00200 return S_OK;
00201 }
00202
00203 STDMETHODIMP CDirectVobSub::get_VobSubSettings(bool* fBuffer, bool* fOnlyShowForcedSubs, bool* fPolygonize)
00204 {
00205 CAutoLock cAutoLock(&m_propsLock);
00206
00207 if(fBuffer) *fBuffer = m_fBufferVobSub;
00208 if(fOnlyShowForcedSubs) *fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
00209 if(fPolygonize) *fPolygonize = m_fPolygonize;
00210
00211 return S_OK;
00212 }
00213
00214 STDMETHODIMP CDirectVobSub::put_VobSubSettings(bool fBuffer, bool fOnlyShowForcedSubs, bool fPolygonize)
00215 {
00216 CAutoLock cAutoLock(&m_propsLock);
00217
00218 if(m_fBufferVobSub == fBuffer && m_fOnlyShowForcedVobSubs == fOnlyShowForcedSubs && m_fPolygonize == fPolygonize) return S_FALSE;
00219
00220 m_fBufferVobSub = fBuffer;
00221 m_fOnlyShowForcedVobSubs = fOnlyShowForcedSubs;
00222 m_fPolygonize = fPolygonize;
00223
00224 return S_OK;
00225 }
00226
00227 STDMETHODIMP CDirectVobSub::get_TextSettings(void* lf, int lflen, COLORREF* color, bool* fShadow, bool* fOutline, bool* fAdvancedRenderer)
00228 {
00229 CAutoLock cAutoLock(&m_propsLock);
00230
00231 if(lf)
00232 {
00233 if(lflen == sizeof(LOGFONTA))
00234 strcpy(((LOGFONTA*)lf)->lfFaceName, CStringA(m_defStyle.fontName));
00235 else if(lflen == sizeof(LOGFONTW))
00236 wcscpy(((LOGFONTW*)lf)->lfFaceName, CStringW(m_defStyle.fontName));
00237 else
00238 return E_INVALIDARG;
00239
00240 ((LOGFONT*)lf)->lfCharSet = m_defStyle.charSet;
00241 ((LOGFONT*)lf)->lfItalic = m_defStyle.fItalic;
00242 ((LOGFONT*)lf)->lfHeight = m_defStyle.fontSize;
00243 ((LOGFONT*)lf)->lfWeight = m_defStyle.fontWeight;
00244 ((LOGFONT*)lf)->lfStrikeOut = m_defStyle.fStrikeOut;
00245 ((LOGFONT*)lf)->lfUnderline = m_defStyle.fUnderline;
00246 }
00247
00248 if(color) *color = m_defStyle.colors[0];
00249 if(fShadow) *fShadow = m_defStyle.shadowDepth>0;
00250 if(fOutline) *fOutline = m_defStyle.outlineWidth>0;
00251 if(fAdvancedRenderer) *fAdvancedRenderer = m_fAdvancedRenderer;
00252
00253 return S_OK;
00254 }
00255
00256 STDMETHODIMP CDirectVobSub::put_TextSettings(void* lf, int lflen, COLORREF color, bool fShadow, bool fOutline, bool fAdvancedRenderer)
00257 {
00258 CAutoLock cAutoLock(&m_propsLock);
00259
00260 if(lf)
00261 {
00262 if(lflen == sizeof(LOGFONTA))
00263 m_defStyle.fontName = ((LOGFONTA*)lf)->lfFaceName;
00264 else if(lflen == sizeof(LOGFONTW))
00265 m_defStyle.fontName = ((LOGFONTW*)lf)->lfFaceName;
00266 else
00267 return E_INVALIDARG;
00268
00269 m_defStyle.charSet = ((LOGFONT*)lf)->lfCharSet;
00270 m_defStyle.fItalic = !!((LOGFONT*)lf)->lfItalic;
00271 m_defStyle.fontSize = ((LOGFONT*)lf)->lfHeight;
00272 m_defStyle.fontWeight = ((LOGFONT*)lf)->lfWeight;
00273 m_defStyle.fStrikeOut = !!((LOGFONT*)lf)->lfStrikeOut;
00274 m_defStyle.fUnderline = !!((LOGFONT*)lf)->lfUnderline;
00275
00276 if(m_defStyle.fontSize < 0)
00277 {
00278 HDC hdc = ::GetDC(0);
00279 m_defStyle.fontSize = -m_defStyle.fontSize * 72 / GetDeviceCaps(hdc, LOGPIXELSY);
00280 ::ReleaseDC(0, hdc);
00281 }
00282
00283 }
00284
00285 m_defStyle.colors[0] = color;
00286 m_defStyle.shadowDepth = fShadow?2:0;
00287 m_defStyle.outlineWidth = fOutline?2:0;
00288
00289 return S_OK;
00290
00291 }
00292
00293 STDMETHODIMP CDirectVobSub::get_Flip(bool* fPicture, bool* fSubtitles)
00294 {
00295 CAutoLock cAutoLock(&m_propsLock);
00296
00297 if(fPicture) *fPicture = m_fFlipPicture;
00298 if(fSubtitles) *fSubtitles = m_fFlipSubtitles;
00299
00300 return S_OK;
00301 }
00302
00303 STDMETHODIMP CDirectVobSub::put_Flip(bool fPicture, bool fSubtitles)
00304 {
00305 CAutoLock cAutoLock(&m_propsLock);
00306
00307 if(m_fFlipPicture == fPicture && m_fFlipSubtitles == fSubtitles) return S_FALSE;
00308
00309 m_fFlipPicture = fPicture;
00310 m_fFlipSubtitles = fSubtitles;
00311
00312 return S_OK;
00313 }
00314
00315 STDMETHODIMP CDirectVobSub::get_OSD(bool* fOSD)
00316 {
00317 CAutoLock cAutoLock(&m_propsLock);
00318
00319 return fOSD ? *fOSD = m_fOSD, S_OK : E_POINTER;
00320 }
00321
00322 STDMETHODIMP CDirectVobSub::put_OSD(bool fOSD)
00323 {
00324 CAutoLock cAutoLock(&m_propsLock);
00325
00326 if(m_fOSD == fOSD) return S_FALSE;
00327
00328 m_fOSD = fOSD;
00329
00330 return S_OK;
00331 }
00332
00333 STDMETHODIMP CDirectVobSub::get_SaveFullPath(bool* fSaveFullPath)
00334 {
00335 CAutoLock cAutoLock(&m_propsLock);
00336
00337 return fSaveFullPath ? *fSaveFullPath = m_fSaveFullPath, S_OK : E_POINTER;
00338 }
00339
00340 STDMETHODIMP CDirectVobSub::put_SaveFullPath(bool fSaveFullPath)
00341 {
00342 CAutoLock cAutoLock(&m_propsLock);
00343
00344 if(m_fSaveFullPath == fSaveFullPath) return S_FALSE;
00345
00346 m_fSaveFullPath = fSaveFullPath;
00347
00348 return S_OK;
00349 }
00350
00351 STDMETHODIMP CDirectVobSub::get_SubtitleTiming(int* delay, int* speedmul, int* speeddiv)
00352 {
00353 CAutoLock cAutoLock(&m_propsLock);
00354
00355 if(delay) *delay = m_SubtitleDelay;
00356 if(speedmul) *speedmul = m_SubtitleSpeedMul;
00357 if(speeddiv) *speeddiv = m_SubtitleSpeedDiv;
00358
00359 return S_OK;
00360 }
00361
00362 STDMETHODIMP CDirectVobSub::put_SubtitleTiming(int delay, int speedmul, int speeddiv)
00363 {
00364 CAutoLock cAutoLock(&m_propsLock);
00365
00366 if(m_SubtitleDelay == delay && m_SubtitleSpeedMul == speedmul && m_SubtitleSpeedDiv == speeddiv) return S_FALSE;
00367
00368 m_SubtitleDelay = delay;
00369 m_SubtitleSpeedMul = speedmul;
00370 if(speeddiv > 0) m_SubtitleSpeedDiv = speeddiv;
00371
00372 return S_OK;
00373 }
00374
00375 STDMETHODIMP CDirectVobSub::get_MediaFPS(bool* fEnabled, double* fps)
00376 {
00377 CAutoLock cAutoLock(&m_propsLock);
00378
00379 if(fEnabled) *fEnabled = m_fMediaFPSEnabled;
00380 if(fps) *fps = m_MediaFPS;
00381
00382 return S_OK;
00383 }
00384
00385 STDMETHODIMP CDirectVobSub::put_MediaFPS(bool fEnabled, double fps)
00386 {
00387 CAutoLock cAutoLock(&m_propsLock);
00388
00389 if(m_fMediaFPSEnabled == fEnabled && m_MediaFPS == fps) return S_FALSE;
00390
00391 m_fMediaFPSEnabled = fEnabled;
00392 if(fps > 0) m_MediaFPS = fps;
00393
00394 return S_OK;
00395 }
00396
00397 STDMETHODIMP CDirectVobSub::get_ZoomRect(NORMALIZEDRECT* rect)
00398 {
00399 CAutoLock cAutoLock(&m_propsLock);
00400
00401 if(!rect) return E_POINTER;
00402
00403 *rect = m_ZoomRect;
00404
00405 return S_OK;
00406 }
00407
00408 STDMETHODIMP CDirectVobSub::put_ZoomRect(NORMALIZEDRECT* rect)
00409 {
00410 CAutoLock cAutoLock(&m_propsLock);
00411
00412 if(!rect) return E_POINTER;
00413
00414 if(!memcmp(&m_ZoomRect, rect, sizeof(m_ZoomRect))) return S_FALSE;
00415
00416 m_ZoomRect = *rect;
00417
00418 return S_OK;
00419 }
00420
00421 STDMETHODIMP CDirectVobSub::UpdateRegistry()
00422 {
00423 AFX_MANAGE_STATE(AfxGetStaticModuleState());
00424
00425 CAutoLock cAutoLock(&m_propsLock);
00426
00427 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), m_fHideSubtitles);
00428 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DOPREBUFFERING), m_fDoPreBuffering);
00429 theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), m_fOverridePlacement);
00430 theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), m_PlacementXperc);
00431 theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), m_PlacementYperc);
00432 theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), m_fBufferVobSub);
00433 theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), m_fOnlyShowForcedVobSubs);
00434 theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), m_fPolygonize);
00435 CString style;
00436 theApp.WriteProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), style <<= m_defStyle);
00437 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), m_fFlipPicture);
00438 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), m_fFlipSubtitles);
00439 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), m_fOSD);
00440 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), m_fSaveFullPath);
00441 theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), m_SubtitleDelay);
00442 theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), m_SubtitleSpeedMul);
00443 theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), m_SubtitleSpeedDiv);
00444 theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), m_fMediaFPSEnabled);
00445 theApp.WriteProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), (BYTE*)&m_MediaFPS, sizeof(m_MediaFPS));
00446
00447 return S_OK;
00448 }
00449
00450 STDMETHODIMP CDirectVobSub::HasConfigDialog(int iSelected)
00451 {
00452 return E_NOTIMPL;
00453 }
00454
00455 STDMETHODIMP CDirectVobSub::ShowConfigDialog(int iSelected, HWND hWndParent)
00456 {
00457 return E_NOTIMPL;
00458 }
00459
00460 STDMETHODIMP CDirectVobSub::IsSubtitleReloaderLocked(bool* fLocked)
00461 {
00462 CAutoLock cAutoLock(&m_propsLock);
00463
00464 if(!fLocked) return E_POINTER;
00465
00466 bool fDisabled;
00467 get_SubtitleReloader(&fDisabled);
00468
00469 *fLocked = fDisabled || m_nReloaderDisableCount > 0;
00470
00471 return S_OK;
00472 }
00473
00474 STDMETHODIMP CDirectVobSub::LockSubtitleReloader(bool fLock)
00475 {
00476 CAutoLock cAutoLock(&m_propsLock);
00477
00478 if(fLock) m_nReloaderDisableCount++;
00479 else m_nReloaderDisableCount--;
00480
00481 ASSERT(m_nReloaderDisableCount >= 0);
00482 if(m_nReloaderDisableCount < 0) m_nReloaderDisableCount = 0;
00483
00484 return S_OK;
00485 }
00486
00487 STDMETHODIMP CDirectVobSub::get_SubtitleReloader(bool* fDisabled)
00488 {
00489 AFX_MANAGE_STATE(AfxGetStaticModuleState());
00490
00491 CAutoLock cAutoLock(&m_propsLock);
00492
00493 if(fDisabled) *fDisabled = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0);
00494
00495 return S_OK;
00496 }
00497
00498 STDMETHODIMP CDirectVobSub::put_SubtitleReloader(bool fDisable)
00499 {
00500 AFX_MANAGE_STATE(AfxGetStaticModuleState());
00501
00502 CAutoLock cAutoLock(&m_propsLock);
00503
00504 bool b;
00505 get_SubtitleReloader(&b);
00506 if(b == fDisable) return S_FALSE;
00507
00508 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), fDisable);
00509
00510 return S_OK;
00511 }
00512
00513 STDMETHODIMP CDirectVobSub::get_ExtendPicture(int* horizontal, int* vertical, int* resx2, int* resx2minw, int* resx2minh)
00514 {
00515 AFX_MANAGE_STATE(AfxGetStaticModuleState());
00516
00517 CAutoLock cAutoLock(&m_propsLock);
00518
00519 if(horizontal) *horizontal = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), 0) & 1;
00520 if(vertical) *vertical = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), 1);
00521 if(resx2) *resx2 = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), 2) & 3;
00522 if(resx2minw) *resx2minw = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), 384);
00523 if(resx2minh) *resx2minh = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), 288);
00524
00525 return S_OK;
00526 }
00527
00528 STDMETHODIMP CDirectVobSub::put_ExtendPicture(int horizontal, int vertical, int resx2, int resx2minw, int resx2minh)
00529 {
00530 AFX_MANAGE_STATE(AfxGetStaticModuleState());
00531
00532 CAutoLock cAutoLock(&m_propsLock);
00533
00534 int i[5];
00535 get_ExtendPicture(i, i+1, i+2, i+3, i+4);
00536 if(i[0] == horizontal && i[1] == vertical && i[2] == resx2 && i[3] == resx2minw && i[4] == resx2minh) return S_FALSE;
00537
00538 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), horizontal & 1);
00539 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), vertical);
00540 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), resx2 & 3);
00541 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), resx2minw);
00542 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), resx2minh);
00543
00544 return S_OK;
00545 }
00546
00547 STDMETHODIMP CDirectVobSub::get_LoadSettings(int* level, bool* fExternalLoad, bool* fWebLoad, bool* fEmbeddedLoad)
00548 {
00549 AFX_MANAGE_STATE(AfxGetStaticModuleState());
00550
00551 CAutoLock cAutoLock(&m_propsLock);
00552
00553 if(level) *level = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), 0) & 3;
00554 if(fExternalLoad) *fExternalLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), 1);
00555 if(fWebLoad) *fWebLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), 0);
00556 if(fEmbeddedLoad) *fEmbeddedLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), 1);
00557
00558 return S_OK;
00559 }
00560
00561 STDMETHODIMP CDirectVobSub::put_LoadSettings(int level, bool fExternalLoad, bool fWebLoad, bool fEmbeddedLoad)
00562 {
00563 AFX_MANAGE_STATE(AfxGetStaticModuleState());
00564
00565 CAutoLock cAutoLock(&m_propsLock);
00566
00567 int i;
00568 bool b[3];
00569 get_LoadSettings(&i, b, b+1, b+2);
00570 if(i == level && b[0] == fExternalLoad && b[1] == fWebLoad && b[2] == fEmbeddedLoad) return S_FALSE;
00571
00572 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), level & 3);
00573 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), fExternalLoad);
00574 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), fWebLoad);
00575 theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), fEmbeddedLoad);
00576
00577 return S_OK;
00578 }
00579
00580
00581
00582 STDMETHODIMP CDirectVobSub::AdviseSubClock(ISubClock* pSubClock)
00583 {
00584 m_pSubClock = pSubClock;
00585 return S_OK;
00586 }
00587
00588 STDMETHODIMP_(bool) CDirectVobSub::get_Forced()
00589 {
00590 return m_fForced;
00591 }
00592
00593 STDMETHODIMP CDirectVobSub::put_Forced(bool fForced)
00594 {
00595 m_fForced = fForced;
00596 return S_OK;
00597 }
00598
00599 STDMETHODIMP CDirectVobSub::get_TextSettings(STSStyle* pDefStyle)
00600 {
00601 CheckPointer(pDefStyle, E_POINTER);
00602
00603 CAutoLock cAutoLock(&m_propsLock);
00604
00605 *pDefStyle = m_defStyle;
00606
00607 return S_OK;
00608 }
00609
00610 STDMETHODIMP CDirectVobSub::put_TextSettings(STSStyle* pDefStyle)
00611 {
00612 CheckPointer(pDefStyle, E_POINTER);
00613
00614 CAutoLock cAutoLock(&m_propsLock);
00615
00616 if(!memcmp(&m_defStyle, pDefStyle, sizeof(m_defStyle)))
00617 return S_FALSE;
00618
00619 m_defStyle = *pDefStyle;
00620
00621 return S_OK;
00622 }
00623
00624
00625
00626 STDMETHODIMP_(DWORD) CDirectVobSub::GetFilterVersion()
00627 {
00628 return 0x0234;
00629 }