Skip to content

Instantly share code, notes, and snippets.

@pieh pieh/gist:244af9c006c12e0a8664 Secret
Created Sep 20, 2011

Embed
What would you like to do?
diff --git a/language/English/strings.xml b/language/English/strings.xml
index ac5063a..bb9d9c0 100644
--- a/language/English/strings.xml
+++ b/language/English/strings.xml
@@ -711,7 +711,7 @@
<string id="850">Invalid port number entered</string>
<string id="851">Valid port range is 1-65535</string>
<string id="852">Valid port range is 1024-65535</string>
-
+
<string id="1000">- Preview</string>
<string id="1001">Unable to connect</string>
<string id="1002">XBMC was unable to connect to the network location.</string>
@@ -1244,7 +1244,7 @@
<string id="13409">Top 250</string>
<string id="13410">Tune in on Last.fm</string>
<string id="13411">Minimum fan speed</string>
-
+ <string id="13412">3D Subtitles</string>
<string id="13413">Downloading</string>
<string id="13414">Include artists who appear only on compilations</string>
<string id="13415">Render method</string>
@@ -1264,6 +1264,8 @@
<string id="13429">Allow hardware acceleration (VDADecoder)</string>
<string id="13430">Allow hardware acceleration (OpenMax)</string>
<string id="13431">Pixel Shaders</string>
+ <string id="13432">Side By Side</string>
+ <string id="13433">Under / Over</string>
<string id="13500">A/V sync method</string>
<string id="13501">Audio clock</string>
diff --git a/xbmc/GUIDialogAudioSubtitleSettings.cpp b/xbmc/GUIDialogAudioSubtitleSettings.cpp
index a3cb680..36890fd 100644
--- a/xbmc/GUIDialogAudioSubtitleSettings.cpp
+++ b/xbmc/GUIDialogAudioSubtitleSettings.cpp
@@ -66,6 +66,7 @@ CGUIDialogAudioSubtitleSettings::~CGUIDialogAudioSubtitleSettings(void)
#define SUBTITLE_SETTINGS_STREAM 10
#define SUBTITLE_SETTINGS_BROWSER 11
#define AUDIO_SETTINGS_MAKE_DEFAULT 12
+#define SUBTITLE_3D_ENABLE 13
void CGUIDialogAudioSubtitleSettings::CreateSettings()
{
@@ -89,11 +90,14 @@ void CGUIDialogAudioSubtitleSettings::CreateSettings()
int settings[3] = { 338, 339, 420 }; //ANALOG, IEC958, HDMI
m_outputmode = g_guiSettings.GetInt("audiooutput.mode");
+ int subtitle3Dsettings[3] = { 16018, 13432, 13433 }; //None, Side By Side, Over Under
+ m_subtitle3DMode = g_guiSettings.GetInt("subtitles.mode3d");;
AddSpin(AUDIO_SETTINGS_DIGITAL_ANALOG, 337, &m_outputmode, 3, settings);
AddSeparator(7);
m_subtitleVisible = g_application.m_pPlayer->GetSubtitleVisible();
AddBool(SUBTITLE_SETTINGS_ENABLE, 13397, &m_subtitleVisible);
+ AddSpin(SUBTITLE_3D_ENABLE, 13412, &m_subtitle3DMode, 3, subtitle3Dsettings);
AddSlider(SUBTITLE_SETTINGS_DELAY, 22006, &g_settings.m_currentVideoSettings.m_SubtitleDelay, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange, FormatDelay);
AddSubtitleStreams(SUBTITLE_SETTINGS_STREAM);
AddButton(SUBTITLE_SETTINGS_BROWSER,13250);
@@ -265,6 +269,11 @@ void CGUIDialogAudioSubtitleSettings::OnSettingChanged(SettingInfo &setting)
g_settings.m_currentVideoSettings.m_SubtitleOn = m_subtitleVisible;
g_application.m_pPlayer->SetSubtitleVisible(g_settings.m_currentVideoSettings.m_SubtitleOn);
}
+ else if (setting.id == SUBTITLE_3D_ENABLE)
+ {
+ g_guiSettings.SetInt("subtitles.mode3d", m_subtitle3DMode);
+ g_settings.m_currentVideoSettings.m_Subtitle3DMode = m_subtitle3DMode;
+ }
else if (setting.id == SUBTITLE_SETTINGS_DELAY)
{
g_application.m_pPlayer->SetSubTitleDelay(g_settings.m_currentVideoSettings.m_SubtitleDelay);
diff --git a/xbmc/GUIDialogAudioSubtitleSettings.h b/xbmc/GUIDialogAudioSubtitleSettings.h
index 31eb698..215a702 100644
--- a/xbmc/GUIDialogAudioSubtitleSettings.h
+++ b/xbmc/GUIDialogAudioSubtitleSettings.h
@@ -46,4 +46,5 @@ protected:
int m_subtitleStream;
int m_outputmode;
bool m_subtitleVisible;
+ int m_subtitle3DMode;
};
diff --git a/xbmc/GUISettings.cpp b/xbmc/GUISettings.cpp
index 7bba5e9..5dda6f7 100644
--- a/xbmc/GUISettings.cpp
+++ b/xbmc/GUISettings.cpp
@@ -628,6 +628,7 @@ void CGUISettings::Initialize()
AddString(sub, "subtitles.charset", 735, "DEFAULT", SPIN_CONTROL_TEXT);
AddSeparator(sub, "subtitles.sep1");
AddPath(sub, "subtitles.custompath", 21366, "", BUTTON_CONTROL_PATH_INPUT, false, 657);
+ AddInt(sub, "subtitles.mode3d", 13412, 0, 0, 1, 2, SPIN_CONTROL_TEXT);
CSettingsCategory* dvd = AddCategory(5, "dvds", 14087);
AddBool(dvd, "dvds.autorun", 14088, false);
diff --git a/xbmc/GUIWindowFullScreen.cpp b/xbmc/GUIWindowFullScreen.cpp
index 934e51f..370270a 100644
--- a/xbmc/GUIWindowFullScreen.cpp
+++ b/xbmc/GUIWindowFullScreen.cpp
@@ -563,6 +563,7 @@ bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message)
CStdString fontPath = "special://xbmc/media/Fonts/";
fontPath += g_guiSettings.GetString("subtitles.font");
+
// We scale based on PAL4x3 - this at least ensures all sizing is constant across resolutions.
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);
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);
@@ -831,7 +832,7 @@ void CGUIWindowFullScreen::RenderTTFSubtitles()
if(!m_subsLayout)
return;
-
+
CStdString subtitleText = "How now brown cow";
if (g_application.m_pPlayer->GetCurrentSubtitle(subtitleText))
{
@@ -863,10 +864,28 @@ void CGUIWindowFullScreen::RenderTTFSubtitles()
float textWidth, textHeight;
m_subsLayout->GetTextExtent(textWidth, textHeight);
- float x = maxWidth * 0.5f + g_settings.m_ResInfo[res].Overscan.left;
- float y = g_settings.m_ResInfo[res].iSubtitles - textHeight;
-
- m_subsLayout->RenderOutline(x, y, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth);
+
+ float x = maxWidth * 0.5f + g_settings.m_ResInfo[res].Overscan.left;
+ float y = g_settings.m_ResInfo[res].iSubtitles - textHeight;
+ float x1 = maxWidth * 0.25f + g_settings.m_ResInfo[res].Overscan.left * 0.5f;
+ float x2 = maxWidth * 0.75f + g_settings.m_ResInfo[res].Overscan.left * 0.5f;
+ float y1 = g_settings.m_ResInfo[res].iHeight * 0.02f;
+ float y2 = g_settings.m_ResInfo[res].iHeight * 0.52f;
+
+ switch (g_settings.m_currentVideoSettings.m_Subtitle3DMode)
+ {
+ case 0:
+ m_subsLayout->RenderOutline(x, y, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth);
+ break;
+ case 1:
+ m_subsLayout->RenderOutline(x1, y1, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth / 2.2f);
+ m_subsLayout->RenderOutline(x2, y1, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth / 2.2f);
+ break;
+ case 2:
+ m_subsLayout->RenderOutline(x, y1, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth);
+ m_subsLayout->RenderOutline(x, y2, 0, 0xFF000000, XBFONT_CENTER_X, maxWidth);
+ break;
+ }
}
}
}
diff --git a/xbmc/GUIWindowSettingsCategory.cpp b/xbmc/GUIWindowSettingsCategory.cpp
index b27d66f..d58610c 100644
--- a/xbmc/GUIWindowSettingsCategory.cpp
+++ b/xbmc/GUIWindowSettingsCategory.cpp
@@ -413,6 +413,15 @@ void CGUIWindowSettingsCategory::CreateSettings()
pControl->AddLabel(g_localizeStrings.Get(741), FONT_STYLE_BOLD_ITALICS);
pControl->SetValue(pSettingInt->GetData());
}
+ else if (strSetting.Equals("subtitles.mode3d"))
+ {
+ CSettingInt *pSettingInt = (CSettingInt*)pSetting;
+ CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(strSetting)->GetID());
+ pControl->AddLabel(g_localizeStrings.Get(16018), 0);
+ pControl->AddLabel(g_localizeStrings.Get(13432), 1);
+ pControl->AddLabel(g_localizeStrings.Get(13433), 2);
+ pControl->SetValue(pSettingInt->GetData());
+ }
else if (strSetting.Equals("subtitles.color"))
{
CSettingInt *pSettingInt = (CSettingInt*)pSetting;
diff --git a/xbmc/settings/VideoSettings.h b/xbmc/settings/VideoSettings.h
index 1699802..9118cf3 100644
--- a/xbmc/settings/VideoSettings.h
+++ b/xbmc/settings/VideoSettings.h
@@ -94,6 +94,7 @@ public:
int m_SubtitleStream;
float m_SubtitleDelay;
bool m_SubtitleOn;
+ int m_Subtitle3DMode;
bool m_SubtitleCached;
float m_Brightness;
float m_Contrast;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.