Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI] Show the language of audio tracks in the audio settings dialog #2156

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions xbmc/cores/dvdplayer/DVDPlayer.cpp
Expand Up @@ -326,6 +326,7 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
s.type = STREAM_AUDIO;
s.id = i;
s.name = nav->GetAudioStreamLanguage(i);
s.language = nav->GetAudioStreamLanguage(i);
s.flags = CDemuxStream::FLAG_NONE;
s.filename = filename;
s.channels = 0;
Expand Down
15 changes: 15 additions & 0 deletions xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp
Expand Up @@ -37,6 +37,7 @@
#include "guilib/LocalizeStrings.h"
#include "pvr/PVRManager.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
#include "utils/LangCodeExpander.h"

using namespace std;
using namespace XFILE;
Expand Down Expand Up @@ -166,6 +167,20 @@ void CGUIDialogAudioSubtitleSettings::AddAudioStreams(unsigned int id)
if (strName.length() == 0)
strName = "Unnamed";

CStdString strLanguage;
g_application.m_pPlayer->GetAudioStreamLanguage(i, strLanguage);
if (strLanguage.length() > 0 && strLanguage.length() <= 3 && !g_LangCodeExpander.Lookup(strLanguage, strLanguage))
strLanguage = g_localizeStrings.Get(13205); // Unknown

// Check if the language is already given in the stream name.
// There are two cases for that:
// 1. the description of the stream is empty, cf. CDemuxStreamAudioFFmpeg::GetStreamName,
// then we have "English - AC3 Stereo" instead of "2/0 - AC3 Stereo" for example.
//
// 2. a dvd is played, cf. CSelectionStreams::Update
if (strName.Find(strLanguage) < 0)
strName.Format("%s - %s", strLanguage.c_str(), strName.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));
}
Expand Down