Advertisement
Guest User

xbmc patch for subtitle video render stutter & lingering tex

a guest
Mar 15th, 2011
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.13 KB | None | 0 0
  1. diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
  2. index 563ce78..61813f9 100644
  3. --- a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
  4. +++ b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
  5. @@ -28,6 +28,7 @@
  6. #include "utils/Win32Exception.h"
  7. #include "utils/log.h"
  8. #include "utils/EndianSwap.h"
  9. +#include "settings/AdvancedSettings.h"
  10.  
  11. CDVDOverlayCodecFFmpeg::CDVDOverlayCodecFFmpeg() : CDVDOverlayCodec("FFmpeg Subtitle Decoder")
  12. {
  13. @@ -245,7 +246,8 @@ CDVDOverlay* CDVDOverlayCodecFFmpeg::GetOverlay()
  14. CDVDOverlayImage* overlay = new CDVDOverlayImage();
  15.  
  16. overlay->iPTSStartTime = DVD_MSEC_TO_TIME(m_Subtitle.start_display_time);
  17. - overlay->iPTSStopTime = DVD_MSEC_TO_TIME(m_Subtitle.end_display_time);
  18. + //ffmpeg pgssub default to 20 seconds which is so annoying that we override with our own advanced setting if less
  19. + overlay->iPTSStopTime = std::min(DVD_SEC_TO_TIME(g_advancedSettings.m_videoSubsOverlayMaxLinger), DVD_MSEC_TO_TIME(m_Subtitle.end_display_time));
  20. overlay->replace = true;
  21. overlay->linesize = rect.w;
  22. overlay->data = (BYTE*)malloc(rect.w * rect.h);
  23. diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp
  24. index 9267b6f..d4e0cc0 100644
  25. --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp
  26. +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp
  27. @@ -3314,7 +3314,7 @@ bool CDVDPlayer::GetCurrentSubtitle(CStdString& strSubtitle)
  28. m_dvdPlayerSubtitle.GetCurrentSubtitle(strSubtitle, pts - m_dvdPlayerVideo.GetSubtitleDelay());
  29.  
  30. // In case we stalled, don't output any subs
  31. - if (m_dvdPlayerVideo.IsStalled() || m_dvdPlayerAudio.IsStalled())
  32. + if (m_dvdPlayerVideo.IsStalled())
  33. strSubtitle = m_lastSub;
  34. else
  35. m_lastSub = strSubtitle;
  36. diff --git a/xbmc/guilib/GUIFontManager.cpp b/xbmc/guilib/GUIFontManager.cpp
  37. index 98c4bd0..96576e0 100644
  38. --- a/xbmc/guilib/GUIFontManager.cpp
  39. +++ b/xbmc/guilib/GUIFontManager.cpp
  40. @@ -75,7 +75,7 @@ void GUIFontManager::RescaleFontSizeAndAspect(float *size, float *aspect, RESOLU
  41. *size /= g_graphicsContext.GetGUIScaleY();
  42. }
  43.  
  44. -CGUIFont* GUIFontManager::LoadTTF(const CStdString& strFontName, const CStdString& strFilename, color_t textColor, color_t shadowColor, const int iSize, const int iStyle, bool border, float lineSpacing, float aspect, RESOLUTION sourceRes, bool preserveAspect)
  45. +CGUIFont* GUIFontManager::LoadTTF(const CStdString& strFontName, const CStdString& strFilename, color_t textColor, color_t shadowColor, const int iSize, const int iStyle, bool border, float lineSpacing, float aspect, RESOLUTION sourceRes, bool preserveAspect, bool precache /*= false */)
  46. {
  47. float originalAspect = aspect;
  48.  
  49. @@ -121,7 +121,7 @@ CGUIFont* GUIFontManager::LoadTTF(const CStdString& strFontName, const CStdStrin
  50. if (!pFontFile)
  51. {
  52. pFontFile = new CGUIFontTTF(TTFfontName);
  53. - bool bFontLoaded = pFontFile->Load(strPath, newSize, aspect, 1.0f, border);
  54. + bool bFontLoaded = pFontFile->Load(strPath, newSize, aspect, 1.0f, border, precache);
  55.  
  56. if (!bFontLoaded)
  57. {
  58. diff --git a/xbmc/guilib/GUIFontManager.h b/xbmc/guilib/GUIFontManager.h
  59. index acdc46b..bf0764f 100644
  60. --- a/xbmc/guilib/GUIFontManager.h
  61. +++ b/xbmc/guilib/GUIFontManager.h
  62. @@ -63,7 +63,8 @@ public:
  63.  
  64. void Unload(const CStdString& strFontName);
  65. void LoadFonts(const CStdString& strFontSet);
  66. - CGUIFont* LoadTTF(const CStdString& strFontName, const CStdString& strFilename, color_t textColor, color_t shadowColor, const int iSize, const int iStyle, bool border = false, float lineSpacing = 1.0f, float aspect = 1.0f, RESOLUTION res = RES_INVALID, bool preserveAspect = false);
  67. + CGUIFont* LoadTTF(const CStdString& strFontName, const CStdString& strFilename, color_t textColor, color_t shadowColor, const int iSize, const int iStyle, bool border = false, float lineSpacing = 1.0f, float aspect = 1.0f, RESOLUTION res = RES_INVALID, bool preserveAspect = false, bool precache = false);
  68. +
  69. CGUIFont* GetFont(const CStdString& strFontName, bool fallback = true);
  70.  
  71. /*! \brief return a default font
  72. diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp
  73. index b72de5c..d976682 100644
  74. --- a/xbmc/guilib/GUIFontTTF.cpp
  75. +++ b/xbmc/guilib/GUIFontTTF.cpp
  76. @@ -28,6 +28,8 @@
  77. #include "utils/MathUtils.h"
  78. #include "utils/log.h"
  79. #include "windowing/WindowingFactory.h"
  80. +#include "utils/TimeUtils.h"
  81. +#include "settings/AdvancedSettings.h"
  82.  
  83. #include <math.h>
  84.  
  85. @@ -226,7 +228,7 @@ void CGUIFontTTFBase::Clear()
  86. m_vertex_count = 0;
  87. }
  88.  
  89. -bool CGUIFontTTFBase::Load(const CStdString& strFilename, float height, float aspect, float lineSpacing, bool border)
  90. +bool CGUIFontTTFBase::Load(const CStdString& strFilename, float height, float aspect, float lineSpacing, bool border, bool precache /* = false */)
  91. {
  92. // we now know that this object is unique - only the GUIFont objects are non-unique, so no need
  93. // for reference tracking these fonts
  94. @@ -247,6 +249,10 @@ bool CGUIFontTTFBase::Load(const CStdString& strFilename, float height, float as
  95. FT_Pos strength = FT_MulFix( m_face->units_per_EM, m_face->size->metrics.y_scale) / 12;
  96. if (strength < 128)
  97. strength = 128;
  98. + // I don't see why strength should make m_CellHeight more than double and it uses up valuable texture space and CPU so clamp to double for large values
  99. + else if (strength > 256 && strength > (int)m_cellHeight)
  100. + strength = m_cellHeight;
  101. +
  102. m_cellHeight += 2*strength;
  103.  
  104. if (m_stroker)
  105. @@ -302,9 +308,63 @@ bool CGUIFontTTFBase::Load(const CStdString& strFilename, float height, float as
  106. Character *ellipse = GetCharacter(L'.');
  107. if (ellipse) m_ellipsesWidth = ellipse->advance;
  108.  
  109. + if (precache)
  110. + {
  111. + int64_t start = CurrentHostCounter();
  112. + CGUIFontTTFBase::PreCacheCharacters();
  113. + CLog::Log(LOGDEBUG, "CGUIFontTTFBase::Load finished pre-caching characters in %i ms (currently cached %i)", (int)((CurrentHostCounter() - start) * 1000 / CurrentHostFrequency()), m_numChars);
  114. + }
  115. +
  116. return true;
  117. }
  118.  
  119. +bool CGUIFontTTFBase::PreCacheCharacters()
  120. +{
  121. + int count = 0;
  122. + if ((int)g_advancedSettings.m_SubsTTFPreCacheCodes.size() > 0)
  123. + {
  124. + CLog::Log(LOGNOTICE, "CGUIFontTTFBase::PreCacheCharacters Pre-caching custom character codes in 4 styles");
  125. + for (int i = 0; i < (int)g_advancedSettings.m_SubsTTFPreCacheCodes.size(); i++)
  126. + {
  127. + if ((int)g_advancedSettings.m_SubsTTFPreCacheCodes[i] == 13)
  128. + continue; //line breaks don't get cached
  129. + for (uint32_t style = 0; style <= 3; style++)
  130. + {
  131. + if (! GetCharacter((character_t)(g_advancedSettings.m_SubsTTFPreCacheCodes[i] | ((style & 3) << 24))))
  132. + {
  133. + CLog::Log(LOGWARNING, "CGUIFontTTFBase::PreCacheCharacters failure to cache character, aborting pre-caching");
  134. + return false;
  135. + }
  136. + count++;
  137. + }
  138. + }
  139. + }
  140. + else
  141. + {
  142. + CLog::Log(LOGNOTICE, "CGUIFontTTFBase::PreCacheCharacters Pre-caching character codes 0-255 in 4 styles");
  143. + for (uint32_t i = 0; i < 256; i++)
  144. + {
  145. + if ((int)i == 13)
  146. + continue; //line breaks don't get cached
  147. + for (uint32_t style = 0; style <= 3; style++)
  148. + {
  149. + if (! GetCharacter((character_t)(i | ((style & 3) << 24))))
  150. + {
  151. + CLog::Log(LOGWARNING, "CGUIFontTTFBase::PreCacheCharacters failure to cache character, aborting pre-caching");
  152. + return false;
  153. + }
  154. + count++;
  155. + }
  156. + }
  157. + }
  158. + if (m_numChars < count)
  159. + {
  160. + //issue a warning that we may have missed some - due to problems along the way (eg max raster size exceeded)
  161. + CLog::Log(LOGWARNING, "CGUIFontTTFBase::PreCacheCharacters cached character count is less than the attempted pre-cache number - a problem may have occurred [attempts: %i, total cached: %i]", count, m_numChars);
  162. + }
  163. + return true;
  164. +}
  165. +
  166. void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors, const vecText &text, uint32_t alignment, float maxPixelWidth, bool scrolling)
  167. {
  168. Begin();
  169. @@ -504,7 +564,7 @@ CGUIFontTTFBase::Character* CGUIFontTTFBase::GetCharacter(character_t chr)
  170. if (nestedBeginCount) End();
  171. if (!CacheCharacter(letter, style, m_char + low))
  172. { // unable to cache character - try clearing them all out and starting over
  173. - CLog::Log(LOGDEBUG, "GUIFontTTF::GetCharacter: Unable to cache character. Clearing character cache of %i characters", m_numChars);
  174. + CLog::Log(LOGWARNING, "GUIFontTTF::GetCharacter: Unable to cache character. Clearing character cache of %i characters", m_numChars);
  175. ClearCharacterCache();
  176. low = 0;
  177. if (!CacheCharacter(letter, style, m_char + low))
  178. @@ -539,7 +599,7 @@ bool CGUIFontTTFBase::CacheCharacter(wchar_t letter, uint32_t style, Character *
  179. FT_Glyph glyph = NULL;
  180. if (FT_Load_Glyph( m_face, glyph_index, FT_LOAD_TARGET_LIGHT ))
  181. {
  182. - CLog::Log(LOGDEBUG, "%s Failed to load glyph %x", __FUNCTION__, letter);
  183. + CLog::Log(LOGWARNING, "%s Failed to load glyph %x", __FUNCTION__, letter);
  184. return false;
  185. }
  186. // make bold if applicable
  187. @@ -551,7 +611,7 @@ bool CGUIFontTTFBase::CacheCharacter(wchar_t letter, uint32_t style, Character *
  188. // grab the glyph
  189. if (FT_Get_Glyph(m_face->glyph, &glyph))
  190. {
  191. - CLog::Log(LOGDEBUG, "%s Failed to get glyph %x", __FUNCTION__, letter);
  192. + CLog::Log(LOGWARNING, "%s Failed to get glyph %x", __FUNCTION__, letter);
  193. return false;
  194. }
  195. if (m_stroker)
  196. @@ -559,7 +619,7 @@ bool CGUIFontTTFBase::CacheCharacter(wchar_t letter, uint32_t style, Character *
  197. // render the glyph
  198. if (FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, NULL, 1))
  199. {
  200. - CLog::Log(LOGDEBUG, "%s Failed to render glyph %x to a bitmap", __FUNCTION__, letter);
  201. + CLog::Log(LOGWARNING, "%s Failed to render glyph %x to a bitmap", __FUNCTION__, letter);
  202. return false;
  203. }
  204. FT_BitmapGlyph bitGlyph = (FT_BitmapGlyph)glyph;
  205. @@ -582,7 +642,7 @@ bool CGUIFontTTFBase::CacheCharacter(wchar_t letter, uint32_t style, Character *
  206. // check for max height
  207. if (newHeight > g_Windowing.GetMaxTextureSize())
  208. {
  209. - CLog::Log(LOGDEBUG, "GUIFontTTF::CacheCharacter: New cache texture is too large (%u > %u pixels long)", newHeight, g_Windowing.GetMaxTextureSize());
  210. + CLog::Log(LOGWARNING, "GUIFontTTF::CacheCharacter: New cache texture is too large (%u > %u pixels long)", newHeight, g_Windowing.GetMaxTextureSize());
  211. FT_Done_Glyph(glyph);
  212. return false;
  213. }
  214. @@ -592,7 +652,7 @@ bool CGUIFontTTFBase::CacheCharacter(wchar_t letter, uint32_t style, Character *
  215. if(newTexture == NULL)
  216. {
  217. FT_Done_Glyph(glyph);
  218. - CLog::Log(LOGDEBUG, "GUIFontTTF::CacheCharacter: Failed to allocate new texture of height %u", newHeight);
  219. + CLog::Log(LOGWARNING, "GUIFontTTF::CacheCharacter: Failed to allocate new texture of height %u", newHeight);
  220. return false;
  221. }
  222. m_texture = newTexture;
  223. diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h
  224. index c509ad0..7230aff 100644
  225. --- a/xbmc/guilib/GUIFontTTF.h
  226. +++ b/xbmc/guilib/GUIFontTTF.h
  227. @@ -72,7 +72,7 @@ public:
  228.  
  229. void Clear();
  230.  
  231. - bool Load(const CStdString& strFilename, float height = 20.0f, float aspect = 1.0f, float lineSpacing = 1.0f, bool border = false);
  232. + bool Load(const CStdString& strFilename, float height = 20.0f, float aspect = 1.0f, float lineSpacing = 1.0f, bool border = false, bool precache = false);
  233.  
  234. virtual void Begin() = 0;
  235. virtual void End() = 0;
  236. @@ -107,6 +107,7 @@ protected:
  237. bool CacheCharacter(wchar_t letter, uint32_t style, Character *ch);
  238. void RenderCharacter(float posX, float posY, const Character *ch, color_t color, bool roundX);
  239. void ClearCharacterCache();
  240. + bool PreCacheCharacters();
  241.  
  242. virtual CBaseTexture* ReallocTexture(unsigned int& newHeight) = 0;
  243. virtual bool CopyCharToTexture(FT_BitmapGlyph bitGlyph, Character *ch) = 0;
  244. diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp
  245. index 17b2476..3a76a24 100644
  246. --- a/xbmc/settings/AdvancedSettings.cpp
  247. +++ b/xbmc/settings/AdvancedSettings.cpp
  248. @@ -64,6 +64,10 @@ void CAdvancedSettings::Initialize()
  249. m_audioPlayCountMinimumPercent = 90.0f;
  250. m_audioHost = "default";
  251.  
  252. + m_videoSubsTTFPreCache = false;
  253. + m_videoSubsTTFBorderFontDisable = false;
  254. + m_videoSubsOverlayMaxLinger = 5;
  255. +
  256. m_videoSubsDelayRange = 10;
  257. m_videoAudioDelayRange = 10;
  258. m_videoSmallStepBackSeconds = 7;
  259. @@ -430,6 +434,56 @@ bool CAdvancedSettings::Load()
  260. XMLUtils::GetFloat(pElement,"autoscalemaxfps",m_videoAutoScaleMaxFps, 0.0f, 1000.0f);
  261. XMLUtils::GetBoolean(pElement,"allowmpeg4vdpau",m_videoAllowMpeg4VDPAU);
  262.  
  263. + XMLUtils::GetBoolean(pElement, "substtfprecache", m_videoSubsTTFPreCache);
  264. + XMLUtils::GetBoolean(pElement, "substtfborderfontdisable", m_videoSubsTTFBorderFontDisable);
  265. + XMLUtils::GetInt(pElement, "subsoverlaymaxlinger", m_videoSubsOverlayMaxLinger, 0, 30);
  266. +
  267. + TiXmlElement* pSubsTTFPreCacheCodes = pElement->FirstChildElement("substtfprecachecodes");
  268. + if (pSubsTTFPreCacheCodes)
  269. + {
  270. + m_SubsTTFPreCacheCodes.clear();
  271. + TiXmlNode* pAdd = pSubsTTFPreCacheCodes->FirstChild("add");
  272. +
  273. + while (pAdd)
  274. + {
  275. +
  276. + CStdString strAdd;
  277. + if (pAdd)
  278. + strAdd = pAdd->FirstChild()->Value();
  279. + if (!strAdd.IsEmpty())
  280. + {
  281. +
  282. + CStdStringArray components;
  283. + StringUtils::SplitString(strAdd,",",components);
  284. + for (unsigned int i=0;i<components.size();++i)
  285. + {
  286. + // check for a range
  287. + CLog::Log(LOGDEBUG,"Advanced Settings Load substtf pre-cache code add %s", components[i].c_str());
  288. + CStdStringArray rangecomponents;
  289. + StringUtils::SplitString(components[i],"-",rangecomponents);
  290. + if (rangecomponents.size() == 2)
  291. + {
  292. + unsigned int min = strtoul(rangecomponents[0].c_str(), NULL, 0);
  293. + unsigned int max = strtoul(rangecomponents[1].c_str(), NULL, 0);
  294. + for (unsigned int j=min; j<=max; j++)
  295. + {
  296. + m_SubsTTFPreCacheCodes.push_back(j);
  297. + }
  298. + }
  299. + else
  300. + {
  301. + // not sure which c++ method is provided for better than strtoul conversion but for now the 0 issue is not worth worrying about as we may as well cache it anyway
  302. + unsigned int code = strtoul(components[i].c_str(), NULL, 0);
  303. + m_SubsTTFPreCacheCodes.push_back(code);
  304. + }
  305. + }
  306. + }
  307. +
  308. + // get next one
  309. + pAdd = pAdd->NextSibling("add");
  310. + }
  311. + }
  312. +
  313. TiXmlElement* pAdjustRefreshrate = pElement->FirstChildElement("adjustrefreshrate");
  314. if (pAdjustRefreshrate)
  315. {
  316. diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h
  317. index 571b3ad..df3d9ff 100644
  318. --- a/xbmc/settings/AdvancedSettings.h
  319. +++ b/xbmc/settings/AdvancedSettings.h
  320. @@ -206,6 +206,11 @@ class CAdvancedSettings
  321. CStdString m_videoItemSeparator;
  322. std::vector<CStdString> m_musicTagsFromFileFilters;
  323.  
  324. + bool m_videoSubsTTFPreCache;
  325. + bool m_videoSubsTTFBorderFontDisable;
  326. + int m_videoSubsOverlayMaxLinger;
  327. + std::vector<unsigned int> m_SubsTTFPreCacheCodes;
  328. +
  329. bool m_bVideoLibraryHideAllItems;
  330. bool m_bVideoLibraryAllItemsOnBottom;
  331. int m_iVideoLibraryRecentlyAddedItems;
  332. diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp
  333. index de31f14..53c56c7 100644
  334. --- a/xbmc/video/windows/GUIWindowFullScreen.cpp
  335. +++ b/xbmc/video/windows/GUIWindowFullScreen.cpp
  336. @@ -586,12 +586,22 @@ bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message)
  337. fontPath += g_guiSettings.GetString("subtitles.font");
  338.  
  339. // We scale based on PAL4x3 - this at least ensures all sizing is constant across resolutions.
  340. - CGUIFont *subFont = g_fontManager.LoadTTF("__subtitle__", fontPath, color[g_guiSettings.GetInt("subtitles.color")], 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), false, 1.0f, 1.0f, RES_PAL_4x3, true);
  341. - CGUIFont *borderFont = g_fontManager.LoadTTF("__subtitleborder__", fontPath, 0xFF000000, 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), true, 1.0f, 1.0f, RES_PAL_4x3, true);
  342. - if (!subFont || !borderFont)
  343. + bool precache = g_advancedSettings.m_videoSubsTTFPreCache;
  344. + CLog::Log(LOGDEBUG, "CGUIWindowFullScreen::OnMessage g_advancedSettings.m_videoSubsTTFPreCache: %i, g_advancedSettings.m_videoSubsTTFBorderFontDisable: %i", (int)g_advancedSettings.m_videoSubsTTFPreCache, (int)g_advancedSettings.m_videoSubsTTFBorderFontDisable);
  345. + CGUIFont *subFont = g_fontManager.LoadTTF("__subtitle__", fontPath, color[g_guiSettings.GetInt("subtitles.color")], 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), false, 1.0f, 1.0f, RES_PAL_4x3, true, precache);
  346. + CGUIFont *borderFont = NULL;
  347. + bool borderfontenabled = !g_advancedSettings.m_videoSubsTTFBorderFontDisable;
  348. + if (borderfontenabled)
  349. + borderFont = g_fontManager.LoadTTF("__subtitleborder__", fontPath, 0xFF000000, 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), true, 1.0f, 1.0f, RES_PAL_4x3, true, precache);
  350. +
  351. + if (!subFont || (borderfontenabled && !borderFont))
  352. CLog::Log(LOGERROR, "CGUIWindowFullScreen::OnMessage(WINDOW_INIT) - Unable to load subtitle font");
  353. else
  354. + {
  355. m_subsLayout = new CGUITextLayout(subFont, true, 0, borderFont);
  356. + //force some subtitles to render initially render to pre-initialise that area to avoid video render delays later
  357. + RenderTTFSubtitles(true);
  358. + }
  359. }
  360. else
  361. m_subsLayout = NULL;
  362. @@ -846,10 +856,10 @@ void CGUIWindowFullScreen::Render()
  363. CGUIWindow::Render();
  364. }
  365.  
  366. -void CGUIWindowFullScreen::RenderTTFSubtitles()
  367. +void CGUIWindowFullScreen::RenderTTFSubtitles(bool forcetest /* = false */)
  368. {
  369. if ((g_application.GetCurrentPlayer() == EPC_MPLAYER || g_application.GetCurrentPlayer() == EPC_DVDPLAYER) &&
  370. - CUtil::IsUsingTTFSubtitles() && (g_application.m_pPlayer->GetSubtitleVisible()))
  371. + CUtil::IsUsingTTFSubtitles() && (forcetest || g_application.m_pPlayer->GetSubtitleVisible()))
  372. {
  373. CSingleLock lock (m_fontLock);
  374.  
  375. @@ -857,8 +867,11 @@ void CGUIWindowFullScreen::RenderTTFSubtitles()
  376. return;
  377.  
  378. CStdString subtitleText = "How now brown cow";
  379. - if (g_application.m_pPlayer->GetCurrentSubtitle(subtitleText))
  380. + if (forcetest || g_application.m_pPlayer->GetCurrentSubtitle(subtitleText))
  381. {
  382. + if (forcetest)
  383. + subtitleText = "INVISIBLE SUBS FOR INIT";
  384. +
  385. // Remove HTML-like tags from the subtitles until
  386. subtitleText.Replace("\\r", "");
  387. subtitleText.Replace("\r", "");
  388. @@ -890,7 +903,10 @@ void CGUIWindowFullScreen::RenderTTFSubtitles()
  389. float x = maxWidth * 0.5f + g_settings.m_ResInfo[res].Overscan.left;
  390. float y = g_settings.m_ResInfo[res].iSubtitles - textHeight;
  391.  
  392. - m_subsLayout->RenderOutline(x, y, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth);
  393. + if (forcetest)
  394. + m_subsLayout->RenderOutline(x, y, 0x00FFFFFF, 0x00FFFFFF, XBFONT_CENTER_X, maxWidth); //00 alpha=transparent, FF red FF green FF blue (note 0x0 does not work)
  395. + else
  396. + m_subsLayout->RenderOutline(x, y, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth);
  397. }
  398. }
  399. }
  400. diff --git a/xbmc/video/windows/GUIWindowFullScreen.h b/xbmc/video/windows/GUIWindowFullScreen.h
  401. index 26e7ba5..8ff04b1 100644
  402. --- a/xbmc/video/windows/GUIWindowFullScreen.h
  403. +++ b/xbmc/video/windows/GUIWindowFullScreen.h
  404. @@ -48,7 +48,7 @@ protected:
  405. virtual void OnDeinitWindow(int nextWindow) {}; // no out window animation for fullscreen video
  406.  
  407. private:
  408. - void RenderTTFSubtitles();
  409. + void RenderTTFSubtitles(bool forcetest = false);
  410. void SeekChapter(int iChapter);
  411. void ToggleOSD();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement