Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

changed: ensure we're displaying the subtitle language when switching…

…/selecting subtitles (partially addresses #11715)

Currently we're only displaying the subtitle name which is not neccessarily the
actual subtitle language. This change takes care of the region code found in
the subtitle stream. In case the language is different to the subtitle name it
is appended to the string (eg. 'subtitle1 [English]').
  • Loading branch information...
commit 57be7138d04c265882ee7b50b07f3950e676786d 1 parent 0a823cd
vdrfan authored
View
1  xbmc/cores/IPlayer.h
@@ -109,6 +109,7 @@ class IPlayer
virtual int GetSubtitleCount() { return 0; }
virtual int GetSubtitle() { return -1; }
virtual void GetSubtitleName(int iStream, CStdString &strStreamName){};
+ virtual void GetSubtitleLanguage(int iStream, CStdString &strStreamLang){};
virtual void SetSubtitle(int iStream){};
virtual bool GetSubtitleVisible(){ return false;};
virtual void SetSubtitleVisible(bool bVisible){};
View
10 xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -39,6 +39,9 @@
#include "DVDFileInfo.h"
+#include "utils/LangCodeExpander.h"
+#include "guilib/LocalizeStrings.h"
+
#include "utils/URIUtils.h"
#include "GUIInfoManager.h"
#include "guilib/GUIWindowManager.h"
@@ -2471,6 +2474,13 @@ void CDVDPlayer::GetSubtitleName(int iStream, CStdString &strStreamName)
strStreamName += "(Invalid)";
}
+void CDVDPlayer::GetSubtitleLanguage(int iStream, CStdString &strStreamLang)
+{
+ SelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, iStream);
+ if (!g_LangCodeExpander.Lookup(strStreamLang, s.language))
+ strStreamLang = g_localizeStrings.Get(13205); // Unknown
+}
+
void CDVDPlayer::SetSubtitle(int iStream)
{
m_messenger.Put(new CDVDMsgPlayerSetSubtitleStream(iStream));
View
1  xbmc/cores/dvdplayer/DVDPlayer.h
@@ -177,6 +177,7 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
virtual int GetSubtitleCount();
virtual int GetSubtitle();
virtual void GetSubtitleName(int iStream, CStdString &strStreamName);
+ virtual void GetSubtitleLanguage(int iStream, CStdString &strStreamLang);
virtual void SetSubtitle(int iStream);
virtual bool GetSubtitleVisible();
virtual void SetSubtitleVisible(bool bVisible);
View
6 xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp
@@ -188,6 +188,12 @@ void CGUIDialogAudioSubtitleSettings::AddSubtitleStreams(unsigned int id)
if (strName.length() == 0)
strName = "Unnamed";
+ CStdString strLanguage;
+ g_application.m_pPlayer->GetSubtitleLanguage(i, strLanguage);
+
+ if (strName != strLanguage)
+ strName.Format("%s [%s]", strName.c_str(), strLanguage.c_str());
+
strItem.Format("%s (%i/%i)", strName.c_str(), i + 1, (int)setting.max + 1);
setting.entry.push_back(make_pair(setting.entry.size(), strItem));
View
14 xbmc/video/windows/GUIWindowFullScreen.cpp
@@ -258,9 +258,14 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)
{
g_settings.m_currentVideoSettings.m_SubtitleOn = !g_settings.m_currentVideoSettings.m_SubtitleOn;
g_application.m_pPlayer->SetSubtitleVisible(g_settings.m_currentVideoSettings.m_SubtitleOn);
- CStdString sub;
+ CStdString sub, lang;
if (g_settings.m_currentVideoSettings.m_SubtitleOn)
+ {
g_application.m_pPlayer->GetSubtitleName(g_application.m_pPlayer->GetSubtitle(),sub);
+ g_application.m_pPlayer->GetSubtitleLanguage(g_application.m_pPlayer->GetSubtitle(),lang);
+ if (sub != lang)
+ sub.Format("%s [%s]", sub.c_str(), lang.c_str());
+ }
else
sub = g_localizeStrings.Get(1223);
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info,
@@ -305,9 +310,14 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)
g_application.m_pPlayer->SetSubtitleVisible(true);
}
- CStdString sub;
+ CStdString sub, lang;
if (g_settings.m_currentVideoSettings.m_SubtitleOn)
+ {
g_application.m_pPlayer->GetSubtitleName(g_settings.m_currentVideoSettings.m_SubtitleStream,sub);
+ g_application.m_pPlayer->GetSubtitleLanguage(g_settings.m_currentVideoSettings.m_SubtitleStream,lang);
+ if (sub != lang)
+ sub.Format("%s [%s]", sub.c_str(), lang.c_str());
+ }
else
sub = g_localizeStrings.Get(1223);
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime);
Please sign in to comment.
Something went wrong with that request. Please try again.