Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2162 from ace20022/unify_stream_lang

Unify the assignment and usage of the name and language of streams
  • Loading branch information...
commit c3c7fd3eff5e2b099c61468dae31aa024b42a573 2 parents ccdba4e + 2e171e6
Arne Morten Kvarving authored
View
30 language/English/strings.po
@@ -11746,3 +11746,33 @@ msgstr ""
msgctxt "#36042"
msgid "Use limited color range (16-235)"
msgstr ""
+
+#: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
+msgctxt "#37000"
+msgid "(Visually Impaired)"
+msgstr ""
+
+#: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
+msgctxt "#37001"
+msgid "(Directors Comments)"
+msgstr ""
+
+#: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
+msgctxt "#37002"
+msgid "(Directors Comments 2)"
+msgstr ""
+
+#: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
+msgctxt "#37011"
+msgid "(CC)"
+msgstr ""
+
+#: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
+msgctxt "#37012"
+msgid "(Forced)"
+msgstr ""
+
+#: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
+msgctxt "#37013"
+msgid "(Directors Comments)"
+msgstr ""
View
23 lib/libdvd/libdvdnav/src/dvdnav.c
@@ -925,27 +925,10 @@ uint16_t dvdnav_audio_stream_format(dvdnav_t *this, uint8_t stream) {
attr = vm_get_audio_attr(this->vm, stream);
pthread_mutex_unlock(&this->vm_lock);
- switch(attr.audio_format) {
- case 0:
- format = DVDNAV_FORMAT_AC3;
- break;
- case 2: /* MPEG-1 or MPEG-2 without extension bitstream. */
- case 3: /* MPEG-2 with extension bitstream. */
- format = DVDNAV_FORMAT_MPEGAUDIO;
- break;
- case 4:
- format = DVDNAV_FORMAT_LPCM;
- break;
- case 6:
- format = DVDNAV_FORMAT_DTS;
- break;
- case 7:
- format = DVDNAV_FORMAT_SDDS;
- break;
- default:
+ if (attr.audio_format >=0 && attr.audio_format <= 7)
+ format = attr.audio_format;
+ else
format = 0xffff;
- break;
- }
return format;
}
View
13 lib/libdvd/libdvdnav/src/dvdnav/dvd_types.h
@@ -161,14 +161,13 @@ typedef enum {
/* The audio format */
typedef enum {
DVD_AUDIO_FORMAT_AC3 = 0,
- DVD_AUDIO_FORMAT_MPEG1 = 1,
- DVD_AUDIO_FORMAT_MPEG1_DRC = 2,
- DVD_AUDIO_FORMAT_MPEG2 = 3,
- DVD_AUDIO_FORMAT_MPEG2_DRC = 4,
- DVD_AUDIO_FORMAT_LPCM = 5,
+ DVD_AUDIO_FORMAT_UNKNOWN_1 = 1,
+ DVD_AUDIO_FORMAT_MPEG = 2,
+ DVD_AUDIO_FORMAT_MPEG2_EXT = 3,
+ DVD_AUDIO_FORMAT_LPCM = 4,
+ DVD_AUDIO_FORMAT_UNKNOWN_5 = 5,
DVD_AUDIO_FORMAT_DTS = 6,
- DVD_AUDIO_FORMAT_SDDS = 7,
- DVD_AUDIO_FORMAT_Other = 8
+ DVD_AUDIO_FORMAT_SDDS = 7
} DVDAudioFormat_t;
/* Audio language extension */
View
16 lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h
@@ -32,11 +32,11 @@
extern "C" {
#endif
-# include <dvdnav/dvd_types.h>
-# include <dvdread/dvd_reader.h>
-# include <dvdread/nav_types.h>
-# include <dvdread/ifo_types.h> /* For vm_cmd_t */
-# include <dvdnav/dvdnav_events.h>
+#include <dvdnav/dvd_types.h>
+#include <dvdread/dvd_reader.h>
+#include <dvdread/nav_types.h>
+#include <dvdread/ifo_types.h> /* For vm_cmd_t */
+#include <dvdnav/dvdnav_events.h>
@@ -63,12 +63,6 @@ typedef int32_t dvdnav_status_t;
#define DVDNAV_STATUS_ERR 0
#define DVDNAV_STATUS_OK 1
-#define DVDNAV_FORMAT_AC3 0
-#define DVDNAV_FORMAT_MPEGAUDIO 3
-#define DVDNAV_FORMAT_LPCM 4
-#define DVDNAV_FORMAT_DTS 5
-#define DVDNAV_FORMAT_SDDS 6
-
/*********************************************************************
* initialisation & housekeeping functions *
*********************************************************************/
View
23 lib/libdvd/patches/libdvdnav_correct_audio_format_enum.diff
@@ -0,0 +1,23 @@
+--- libdvdnav-4.2.0/src/dvdnav/dvd_types.h Wed Mar 20 08:51:10 2013
++++ lib/libdvd/libdvdnav/src/dvdnav/dvd_types.h Wed Mar 20 12:22:25 2013
+@@ -161,14 +161,13 @@
+ /* The audio format */
+ typedef enum {
+ DVD_AUDIO_FORMAT_AC3 = 0,
+- DVD_AUDIO_FORMAT_MPEG1 = 1,
+- DVD_AUDIO_FORMAT_MPEG1_DRC = 2,
+- DVD_AUDIO_FORMAT_MPEG2 = 3,
+- DVD_AUDIO_FORMAT_MPEG2_DRC = 4,
+- DVD_AUDIO_FORMAT_LPCM = 5,
++ DVD_AUDIO_FORMAT_UNKNOWN_1 = 1,
++ DVD_AUDIO_FORMAT_MPEG = 2,
++ DVD_AUDIO_FORMAT_MPEG2_EXT = 3,
++ DVD_AUDIO_FORMAT_LPCM = 4,
++ DVD_AUDIO_FORMAT_UNKNOWN_5 = 5,
+ DVD_AUDIO_FORMAT_DTS = 6,
+- DVD_AUDIO_FORMAT_SDDS = 7,
+- DVD_AUDIO_FORMAT_Other = 8
++ DVD_AUDIO_FORMAT_SDDS = 7
+ } DVDAudioFormat_t;
+
+ /* Audio language extension */
View
33 lib/libdvd/patches/libdvdnav_correct_dvdnav_audio_stream_format.diff
@@ -0,0 +1,33 @@
+--- libdvdnav-4.2.0/src/dvdnav.c Wed Mar 20 11:38:53 2013
++++ lib/libdvd/libdvdnav/src/dvdnav.c Wed Mar 20 13:20:35 2013
+@@ -907,27 +925,10 @@
+ attr = vm_get_audio_attr(this->vm, stream);
+ pthread_mutex_unlock(&this->vm_lock);
+
+- switch(attr.audio_format) {
+- case 0:
+- format = DVDNAV_FORMAT_AC3;
+- break;
+- case 2: /* MPEG-1 or MPEG-2 without extension bitstream. */
+- case 3: /* MPEG-2 with extension bitstream. */
+- format = DVDNAV_FORMAT_MPEGAUDIO;
+- break;
+- case 4:
+- format = DVDNAV_FORMAT_LPCM;
+- break;
+- case 6:
+- format = DVDNAV_FORMAT_DTS;
+- break;
+- case 7:
+- format = DVDNAV_FORMAT_SDDS;
+- break;
+- default:
++ if (attr.audio_format >=0 && attr.audio_format <= 7)
++ format = attr.audio_format;
++ else
+ format = 0xffff;
+- break;
+- }
+
+ return format;
+ }
View
15 lib/libdvd/patches/libdvdnav_remove_unneeded_defines.diff
@@ -0,0 +1,15 @@
+--- libdvdnav-4.2.0/src/dvdnav/dvdnav.h Wed Mar 20 11:38:52 2013
++++ lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h Wed Mar 20 13:19:13 2013
+@@ -63,12 +63,6 @@
+ #define DVDNAV_STATUS_ERR 0
+ #define DVDNAV_STATUS_OK 1
+
+-#define DVDNAV_FORMAT_AC3 0
+-#define DVDNAV_FORMAT_MPEGAUDIO 3
+-#define DVDNAV_FORMAT_LPCM 4
+-#define DVDNAV_FORMAT_DTS 5
+-#define DVDNAV_FORMAT_SDDS 6
+-
+ /*********************************************************************
+ * initialisation & housekeeping functions *
+ *********************************************************************/
View
71 xbmc/cores/amlplayer/AMLPlayer.cpp
@@ -914,24 +914,9 @@ void CAMLPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &inf
if (index > (int)m_subtitle_streams.size() -1 || index < 0)
return;
- if (m_subtitle_streams[m_subtitle_index]->source == STREAM_SOURCE_NONE)
- {
- if ( m_subtitle_streams[index]->language.size())
- {
- CStdString name;
- g_LangCodeExpander.Lookup(name, m_subtitle_streams[index]->language);
- info.name = name;
- }
- else
- info.name = g_localizeStrings.Get(13205); // Unknown
- }
- else
- {
- if(m_subtitle_streams[m_subtitle_index]->name.length() > 0)
- info.name = m_subtitle_streams[m_subtitle_index]->name;
- else
- info.name = g_localizeStrings.Get(13205); // Unknown
- }
+ info.language = m_subtitle_streams[index]->language;
+ info.name = m_subtitle_streams[m_subtitle_index]->name;
+
if (m_log_level > 5)
CLog::Log(LOGDEBUG, "CAMLPlayer::GetSubtitleName, iStream(%d)", index);
}
@@ -1105,20 +1090,36 @@ void CAMLPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
info.bitrate = m_audio_streams[index]->bit_rate;
- if ( m_audio_streams[index]->language.size())
- info.language = m_audio_streams[index]->language;
+ info.language = m_audio_streams[index]->language;
info.channels = m_audio_streams[index]->channel;
info.audioCodecName = AudioCodecName(m_audio_streams[index]->format);
- info.name.Format("Undefined");
-
- if ( m_audio_streams[index]->language.size())
+ if (info.audioCodecName.size())
+ info.name = info.audioCodecName + " ";
+
+ switch(info.channels)
{
- CStdString name;
- g_LangCodeExpander.Lookup( name, m_audio_streams[index]->language);
- info.name = name;
+ case 1:
+ info.name += "Mono";
+ break;
+ case 2:
+ info.name += "Stereo";
+ break;
+ case 6:
+ info.name += "5.1";
+ break;
+ case 7:
+ info.name += "6.1";
+ break;
+ case 8:
+ info.name += "7.1";
+ break;
+ default:
+ char temp[32];
+ sprintf(temp, "%d-chs", info.channels);
+ info.name += temp;
}
}
@@ -1929,7 +1930,16 @@ bool CAMLPlayer::WaitForFormatValid(int timeout_ms)
info->format = media_info.audio_info[i]->aformat;
#if !defined(TARGET_ANDROID)
if (media_info.audio_info[i]->audio_language[0] != 0)
+ {
info->language = std::string(media_info.audio_info[i]->audio_language, 3);
+
+ if (info->language.length() == 2)
+ {
+ CStdString lang;
+ g_LangCodeExpander.ConvertToThreeCharCode(lang, info->language);
+ info->language = lang;
+ }
+ }
#endif
m_audio_streams.push_back(info);
}
@@ -1953,7 +1963,16 @@ bool CAMLPlayer::WaitForFormatValid(int timeout_ms)
info->id = media_info.sub_info[i]->id;
info->type = STREAM_SUBTITLE;
if (media_info.sub_info[i]->sub_language && media_info.sub_info[i]->sub_language[0] != 0)
+ {
info->language = std::string(media_info.sub_info[i]->sub_language, 3);
+
+ if (info->language.length() == 2)
+ {
+ CStdString lang;
+ g_LangCodeExpander.ConvertToThreeCharCode(lang, info->language);
+ info->language = lang;
+ }
+ }
m_subtitle_streams.push_back(info);
}
m_subtitle_index = media_info.stream_info.cur_sub_index;
View
14 xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.cpp
@@ -20,7 +20,6 @@
#include "DVDDemux.h"
#include "DVDCodecs/DVDCodecs.h"
-#include "utils/LangCodeExpander.h"
void CDemuxStreamTeletext::GetStreamInfo(std::string& strInfo)
{
@@ -44,15 +43,17 @@ void CDemuxStreamAudio::GetStreamType(std::string& strInfo)
strcpy(sInfo, "DTS ");
}
else if (codec == CODEC_ID_MP2) strcpy(sInfo, "MP2 ");
+ else if (codec == CODEC_ID_TRUEHD) strcpy(sInfo, "Dolby TrueHD ");
else strcpy(sInfo, "");
if (iChannels == 1) strcat(sInfo, "Mono");
else if (iChannels == 2) strcat(sInfo, "Stereo");
else if (iChannels == 6) strcat(sInfo, "5.1");
+ else if (iChannels == 8) strcat(sInfo, "7.1");
else if (iChannels != 0)
{
char temp[32];
- sprintf(temp, " %d %s", iChannels, "Channels");
+ sprintf(temp, " %d%s", iChannels, "-chs");
strcat(sInfo, temp);
}
strInfo = sInfo;
@@ -168,14 +169,7 @@ CDemuxStreamTeletext* CDVDDemux::GetStreamFromTeletextId(int iTeletextIndex)
void CDemuxStream::GetStreamName( std::string& strInfo )
{
- if( language[0] == 0 )
- strInfo = "";
- else
- {
- CStdString name;
- g_LangCodeExpander.Lookup( name, language );
- strInfo = name;
- }
+ strInfo = "";
}
AVDiscard CDemuxStream::GetDiscard()
View
195 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
@@ -27,6 +27,8 @@
#include "utils/log.h"
#include "guilib/Geometry.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
+#include "guilib/LocalizeStrings.h"
#if defined(TARGET_DARWIN)
#include "osx/CocoaInterface.h"
#endif
@@ -822,52 +824,61 @@ int CDVDInputStreamNavigator::GetActiveSubtitleStream()
return activeStream;
}
-std::string CDVDInputStreamNavigator::GetSubtitleStreamLanguage(int iId)
+bool CDVDInputStreamNavigator::GetSubtitleStreamInfo(const int iId, DVDNavStreamInfo &info)
{
- if (!m_dvdnav) return NULL;
-
- CStdString strLanguage;
+ if (!m_dvdnav) return false;
- subp_attr_t subp_attributes;
int streamId = ConvertSubtitleStreamId_XBMCToExternal(iId);
+ subp_attr_t subp_attributes;
+
if( m_dll.dvdnav_get_stitle_info(m_dvdnav, streamId, &subp_attributes) == DVDNAV_STATUS_OK )
{
+ SetSubtitleStreamName(info, subp_attributes);
- if (subp_attributes.type == DVD_SUBPICTURE_TYPE_Language ||
- subp_attributes.type == DVD_SUBPICTURE_TYPE_NotSpecified)
- {
- if (!g_LangCodeExpander.Lookup(strLanguage, subp_attributes.lang_code)) strLanguage = "Unknown";
+ char lang[3];
+ lang[2] = 0;
+ lang[1] = (subp_attributes.lang_code & 255);
+ lang[0] = (subp_attributes.lang_code >> 8) & 255;
- switch (subp_attributes.lang_extension)
- {
- case DVD_SUBPICTURE_LANG_EXT_NotSpecified:
- case DVD_SUBPICTURE_LANG_EXT_NormalCaptions:
- case DVD_SUBPICTURE_LANG_EXT_BigCaptions:
- case DVD_SUBPICTURE_LANG_EXT_ChildrensCaptions:
- break;
+ CStdString temp;
+ g_LangCodeExpander.ConvertToThreeCharCode(temp, lang);
+ info.language = temp;
- case DVD_SUBPICTURE_LANG_EXT_NormalCC:
- case DVD_SUBPICTURE_LANG_EXT_BigCC:
- case DVD_SUBPICTURE_LANG_EXT_ChildrensCC:
- strLanguage+= " (CC)";
- break;
- case DVD_SUBPICTURE_LANG_EXT_Forced:
- strLanguage+= " (Forced)";
- break;
- case DVD_SUBPICTURE_LANG_EXT_NormalDirectorsComments:
- case DVD_SUBPICTURE_LANG_EXT_BigDirectorsComments:
- case DVD_SUBPICTURE_LANG_EXT_ChildrensDirectorsComments:
- strLanguage+= " (Directors Comments)";
- break;
- }
- }
- else
+ return true;
+ }
+ return false;
+}
+
+void CDVDInputStreamNavigator::SetSubtitleStreamName(DVDNavStreamInfo &info, const subp_attr_t subp_attributes)
+{
+ if (subp_attributes.type == DVD_SUBPICTURE_TYPE_Language ||
+ subp_attributes.type == DVD_SUBPICTURE_TYPE_NotSpecified)
+ {
+ switch (subp_attributes.lang_extension)
{
- strLanguage = "Unknown";
+ case DVD_SUBPICTURE_LANG_EXT_NotSpecified:
+ case DVD_SUBPICTURE_LANG_EXT_NormalCaptions:
+ case DVD_SUBPICTURE_LANG_EXT_BigCaptions:
+ case DVD_SUBPICTURE_LANG_EXT_ChildrensCaptions:
+ break;
+
+ case DVD_SUBPICTURE_LANG_EXT_NormalCC:
+ case DVD_SUBPICTURE_LANG_EXT_BigCC:
+ case DVD_SUBPICTURE_LANG_EXT_ChildrensCC:
+ info.name += g_localizeStrings.Get(37011);
+ break;
+ case DVD_SUBPICTURE_LANG_EXT_Forced:
+ info.name += g_localizeStrings.Get(37012);
+ break;
+ case DVD_SUBPICTURE_LANG_EXT_NormalDirectorsComments:
+ case DVD_SUBPICTURE_LANG_EXT_BigDirectorsComments:
+ case DVD_SUBPICTURE_LANG_EXT_ChildrensDirectorsComments:
+ info.name += g_localizeStrings.Get(37013);
+ break;
+ default:
+ break;
}
}
-
- return strLanguage;
}
int CDVDInputStreamNavigator::GetSubTitleStreamCount()
@@ -925,37 +936,105 @@ int CDVDInputStreamNavigator::GetActiveAudioStream()
return activeStream;
}
-std::string CDVDInputStreamNavigator::GetAudioStreamLanguage(int iId)
+void CDVDInputStreamNavigator::SetAudioStreamName(DVDNavStreamInfo &info, const audio_attr_t audio_attributes)
{
- if (!m_dvdnav) return NULL;
+ switch( audio_attributes.code_extension )
+ {
+ case DVD_AUDIO_LANG_EXT_VisuallyImpaired:
+ info.name = g_localizeStrings.Get(37000);
+ break;
+ case DVD_AUDIO_LANG_EXT_DirectorsComments1:
+ info.name = g_localizeStrings.Get(37001);
+ break;
+ case DVD_AUDIO_LANG_EXT_DirectorsComments2:
+ info.name = g_localizeStrings.Get(37002);
+ break;
+ case DVD_AUDIO_LANG_EXT_NotSpecified:
+ case DVD_AUDIO_LANG_EXT_NormalCaptions:
+ default:
+ break;
+ }
- CStdString strLanguage;
+ switch(audio_attributes.audio_format)
+ {
+ case DVD_AUDIO_FORMAT_AC3:
+ info.name += " AC3";
+ break;
+ case DVD_AUDIO_FORMAT_UNKNOWN_1:
+ info.name += " UNKNOWN #1";
+ break;
+ case DVD_AUDIO_FORMAT_MPEG:
+ info.name += " MPEG AUDIO";
+ break;
+ case DVD_AUDIO_FORMAT_MPEG2_EXT:
+ info.name += " MP2 Ext.";
+ break;
+ case DVD_AUDIO_FORMAT_LPCM:
+ info.name += " LPCM";
+ break;
+ case DVD_AUDIO_FORMAT_UNKNOWN_5:
+ info.name += " UNKNOWN #5";
+ break;
+ case DVD_AUDIO_FORMAT_DTS:
+ info.name += " DTS";
+ break;
+ case DVD_AUDIO_FORMAT_SDDS:
+ info.name += " SDDS";
+ break;
+ default:
+ info.name += " Other";
+ break;
+ }
+
+ switch(audio_attributes.channels + 1)
+ {
+ case 1:
+ info.name += " Mono";
+ break;
+ case 2:
+ info.name += " Stereo";
+ break;
+ case 6:
+ info.name += " 5.1";
+ break;
+ case 7:
+ info.name += " 6.1";
+ break;
+ default:
+ char temp[32];
+ sprintf(temp, " %d-chs", audio_attributes.channels + 1);
+ info.name += temp;
+ }
+
+ StringUtils::TrimLeft(info.name);
+
+}
+
+bool CDVDInputStreamNavigator::GetAudioStreamInfo(const int iId, DVDNavStreamInfo &info)
+{
+ if (!m_dvdnav) return false;
- audio_attr_t audio_attributes;
int streamId = ConvertAudioStreamId_XBMCToExternal(iId);
+ audio_attr_t audio_attributes;
+
if( m_dll.dvdnav_get_audio_info(m_dvdnav, streamId, &audio_attributes) == DVDNAV_STATUS_OK )
{
- if (!g_LangCodeExpander.Lookup(strLanguage, audio_attributes.lang_code)) strLanguage = "Unknown";
+ SetAudioStreamName(info, audio_attributes);
- switch( audio_attributes.lang_extension )
- {
- case DVD_AUDIO_LANG_EXT_VisuallyImpaired:
- strLanguage+= " (Visually Impaired)";
- break;
- case DVD_AUDIO_LANG_EXT_DirectorsComments1:
- strLanguage+= " (Directors Comments)";
- break;
- case DVD_AUDIO_LANG_EXT_DirectorsComments2:
- strLanguage+= " (Directors Comments 2)";
- break;
- case DVD_AUDIO_LANG_EXT_NotSpecified:
- case DVD_AUDIO_LANG_EXT_NormalCaptions:
- default:
- break;
- }
- }
+ char lang[3];
+ lang[2] = 0;
+ lang[1] = (audio_attributes.lang_code & 255);
+ lang[0] = (audio_attributes.lang_code >> 8) & 255;
+
+ CStdString temp;
+ g_LangCodeExpander.ConvertToThreeCharCode(temp, lang);
+ info.language = temp;
+
+ info.channels = audio_attributes.channels + 1;
- return strLanguage;
+ return true;
+ }
+ return false;
}
int CDVDInputStreamNavigator::GetAudioStreamCount()
View
16 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h
@@ -44,6 +44,15 @@ class CDVDOverlayPicture;
struct dvdnav_s;
+struct DVDNavStreamInfo
+{
+ std::string name;
+ std::string language;
+ int channels;
+
+ DVDNavStreamInfo() : channels(0) {}
+};
+
class DVDNavResult
{
public:
@@ -96,17 +105,17 @@ class CDVDInputStreamNavigator
bool IsInMenu() { return m_bInMenu; }
int GetActiveSubtitleStream();
- std::string GetSubtitleStreamLanguage(int iId);
int GetSubTitleStreamCount();
+ bool GetSubtitleStreamInfo(const int iId, DVDNavStreamInfo &info);
bool SetActiveSubtitleStream(int iId);
void EnableSubtitleStream(bool bEnable);
bool IsSubtitleStreamEnabled();
int GetActiveAudioStream();
- std::string GetAudioStreamLanguage(int iId);
int GetAudioStreamCount();
bool SetActiveAudioStream(int iId);
+ bool GetAudioStreamInfo(const int iId, DVDNavStreamInfo &info);
bool GetState(std::string &xmlstate);
bool SetState(const std::string &xmlstate);
@@ -145,6 +154,9 @@ class CDVDInputStreamNavigator
int ConvertSubtitleStreamId_XBMCToExternal(int id);
int ConvertSubtitleStreamId_ExternalToXBMC(int id);
+ void SetAudioStreamName(DVDNavStreamInfo &info, const audio_attr_t audio_attributes);
+ void SetSubtitleStreamName(DVDNavStreamInfo &info, const subp_attr_t subp_attributes);
+
DllDvdNav m_dll;
bool m_bCheckButtons;
bool m_bEOF;
View
17 xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvd_types.h
@@ -163,15 +163,14 @@ typedef enum {
/* The audio format */
typedef enum {
- DVD_AUDIO_FORMAT_AC3 = 0,
- DVD_AUDIO_FORMAT_MPEG1 = 1,
- DVD_AUDIO_FORMAT_MPEG1_DRC = 2,
- DVD_AUDIO_FORMAT_MPEG2 = 3,
- DVD_AUDIO_FORMAT_MPEG2_DRC = 4,
- DVD_AUDIO_FORMAT_LPCM = 5,
- DVD_AUDIO_FORMAT_DTS = 6,
- DVD_AUDIO_FORMAT_SDDS = 7,
- DVD_AUDIO_FORMAT_Other = 8
+ DVD_AUDIO_FORMAT_AC3 = 0,
+ DVD_AUDIO_FORMAT_UNKNOWN_1 = 1,
+ DVD_AUDIO_FORMAT_MPEG = 2,
+ DVD_AUDIO_FORMAT_MPEG2_EXT = 3,
+ DVD_AUDIO_FORMAT_LPCM = 4,
+ DVD_AUDIO_FORMAT_UNKNOWN_5 = 5,
+ DVD_AUDIO_FORMAT_DTS = 6,
+ DVD_AUDIO_FORMAT_SDDS = 7
} DVDAudioFormat_t;
/* Audio language extension */
View
32 xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -319,10 +319,14 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
s.source = source;
s.type = STREAM_AUDIO;
s.id = i;
- s.name = nav->GetAudioStreamLanguage(i);
s.flags = CDemuxStream::FLAG_NONE;
s.filename = filename;
- s.channels = 0;
+
+ DVDNavStreamInfo info;
+ nav->GetAudioStreamInfo(i, info);
+ s.name = info.name;
+ s.language = info.language;
+ s.channels = info.channels;
Update(s);
}
@@ -333,10 +337,14 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
s.source = source;
s.type = STREAM_SUBTITLE;
s.id = i;
- s.name = nav->GetSubtitleStreamLanguage(i);
s.flags = CDemuxStream::FLAG_NONE;
s.filename = filename;
s.channels = 0;
+
+ DVDNavStreamInfo info;
+ nav->GetSubtitleStreamInfo(i, info);
+ s.name = info.name;
+ s.language = info.language;
Update(s);
}
}
@@ -362,6 +370,14 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
s.type = stream->type;
s.id = stream->iId;
s.language = stream->language;
+
+ if (s.language.length() == 2)
+ {
+ CStdString lang;
+ g_LangCodeExpander.ConvertToThreeCharCode(lang, stream->language);
+ s.language = lang;
+ }
+
s.flags = stream->flags;
s.filename = demuxer->GetFileName();
stream->GetStreamName(s.name);
@@ -2692,17 +2708,11 @@ void CDVDPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &inf
SelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, index);
if(s.name.length() > 0)
info.name = s.name;
- else
- info.name = g_localizeStrings.Get(13205); // Unknown
if(s.type == STREAM_NONE)
info.name += "(Invalid)";
- CStdString strStreamLang;
- if (!g_LangCodeExpander.Lookup(strStreamLang, s.language))
- info.language = g_localizeStrings.Get(13205); // Unknown
- else
- info.language = strStreamLang;
+ info.language = s.language;
}
void CDVDPlayer::SetSubtitle(int iStream)
@@ -3836,8 +3846,6 @@ void CDVDPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
if(s.name.length() > 0)
info.name = s.name;
- else
- info.name += "Unknown";
if(s.type == STREAM_NONE)
info.name += " (Invalid)";
View
32 xbmc/cores/omxplayer/OMXPlayer.cpp
@@ -319,10 +319,14 @@ void COMXSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
s.source = source;
s.type = STREAM_AUDIO;
s.id = i;
- s.name = nav->GetAudioStreamLanguage(i);
s.flags = CDemuxStream::FLAG_NONE;
s.filename = filename;
- s.channels = 0;
+
+ DVDNavStreamInfo info;
+ nav->GetAudioStreamInfo(i, info);
+ s.name = info.name;
+ s.language = info.language;
+ s.channels = info.channels;
Update(s);
}
@@ -333,10 +337,14 @@ void COMXSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
s.source = source;
s.type = STREAM_SUBTITLE;
s.id = i;
- s.name = nav->GetSubtitleStreamLanguage(i);
s.flags = CDemuxStream::FLAG_NONE;
s.filename = filename;
s.channels = 0;
+
+ DVDNavStreamInfo info;
+ nav->GetSubtitleStreamInfo(i, info);
+ s.name = info.name;
+ s.language = info.language;
Update(s);
}
}
@@ -362,6 +370,14 @@ void COMXSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
s.type = stream->type;
s.id = stream->iId;
s.language = stream->language;
+
+ if (s.language.length() == 2)
+ {
+ CStdString lang;
+ g_LangCodeExpander.ConvertToThreeCharCode(lang, stream->language);
+ s.language = lang;
+ }
+
s.flags = stream->flags;
s.filename = demuxer->GetFileName();
stream->GetStreamName(s.name);
@@ -2693,17 +2709,11 @@ void COMXPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &inf
OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, index);
if(s.name.length() > 0)
info.name = s.name;
- else
- info.name = g_localizeStrings.Get(13205); // Unknown
if(s.type == STREAM_NONE)
info.name += "(Invalid)";
- CStdString strStreamLang;
- if (!g_LangCodeExpander.Lookup(strStreamLang, s.language))
- info.language = g_localizeStrings.Get(13205); // Unknown
- else
- info.language = strStreamLang;
+ info.language = s.language;
}
void COMXPlayer::SetSubtitle(int iStream)
@@ -3790,8 +3800,6 @@ void COMXPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
if(s.name.length() > 0)
info.name = s.name;
- else
- info.name += "Unknown";
if(s.type == STREAM_NONE)
info.name += " (Invalid)";
View
26 xbmc/interfaces/legacy/Player.cpp
@@ -29,7 +29,6 @@
#include "ApplicationMessenger.h"
#include "GUIInfoManager.h"
#include "AddonUtils.h"
-#include "utils/LangCodeExpander.h"
#include "utils/log.h"
#include "cores/IPlayer.h"
@@ -397,11 +396,11 @@ namespace XBMCAddon
{
SPlayerSubtitleStreamInfo info;
g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info);
- CStdString strName = info.name;
- if (strName == "Unknown(Invalid)")
- strName = "";
- return strName;
+ if (info.language.length() > 0)
+ return info.language;
+ else
+ return info.name;
}
return NULL;
@@ -429,10 +428,10 @@ namespace XBMCAddon
SPlayerSubtitleStreamInfo info;
g_application.m_pPlayer->GetSubtitleStreamInfo(iStream, info);
- CStdString FullLang;
- if (!g_LangCodeExpander.Lookup(FullLang, info.name))
- FullLang = info.name;
- (*ret)[iStream] = FullLang;
+ if (info.language.length() > 0)
+ (*ret)[iStream] = info.language;
+ else
+ (*ret)[iStream] = info.name;
}
return ret;
}
@@ -464,11 +463,10 @@ namespace XBMCAddon
SPlayerAudioStreamInfo info;
g_application.m_pPlayer->GetAudioStreamInfo(iStream, info);
- CStdString FullLang;
- g_LangCodeExpander.Lookup(FullLang, info.language);
- if (FullLang.IsEmpty())
- FullLang = info.name;
- (*ret)[iStream] = FullLang;
+ if (info.language.length() > 0)
+ (*ret)[iStream] = info.language;
+ else
+ (*ret)[iStream] = info.name;
}
return ret;
}
View
29 xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp
@@ -40,6 +40,7 @@
#include "pvr/PVRManager.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
#include "cores/IPlayer.h"
+#include "utils/LangCodeExpander.h"
using namespace std;
using namespace XFILE;
@@ -164,16 +165,20 @@ void CGUIDialogAudioSubtitleSettings::AddAudioStreams(unsigned int id)
for (int i = 0; i <= setting.max; ++i)
{
CStdString strItem;
- CStdString strName;
+ CStdString strLanguage;
SPlayerAudioStreamInfo info;
g_application.m_pPlayer->GetAudioStreamInfo(i, info);
- strName = info.name;
- if (strName.length() == 0)
- strName = "Unnamed";
+ if (!g_LangCodeExpander.Lookup(strLanguage, info.language))
+ strLanguage = g_localizeStrings.Get(13205); // Unknown
- strItem.Format("%s (%i/%i)", strName.c_str(), i + 1, (int)setting.max + 1);
+ if (info.name.length() == 0)
+ strItem = strLanguage;
+ else
+ strItem.Format("%s - %s", strLanguage.c_str(), info.name.c_str());
+
+ strItem.Format("%s (%i/%i)", strItem.c_str(), i + 1, (int)setting.max + 1);
setting.entry.push_back(make_pair(setting.entry.size(), strItem));
}
@@ -209,15 +214,17 @@ void CGUIDialogAudioSubtitleSettings::AddSubtitleStreams(unsigned int id)
g_application.m_pPlayer->GetSubtitleStreamInfo(i, info);
CStdString strItem;
- CStdString strName = info.name;
+ CStdString strLanguage;
- if (strName.length() == 0)
- strName = "Unnamed";
+ if (!g_LangCodeExpander.Lookup(strLanguage, info.language))
+ strLanguage = g_localizeStrings.Get(13205); // Unknown
- if (strName != info.language)
- strName.Format("%s [%s]", strName.c_str(), info.language.c_str());
+ if (info.name.length() == 0)
+ strItem = strLanguage;
+ else
+ strItem.Format("%s - %s", strLanguage.c_str(), info.name.c_str());
- strItem.Format("%s (%i/%i)", strName.c_str(), i + 1, (int)setting.max + 1);
+ strItem.Format("%s (%i/%i)", strItem.c_str(), i + 1, (int)setting.max + 1);
setting.entry.push_back(make_pair(setting.entry.size(), strItem));
}
Please sign in to comment.
Something went wrong with that request. Please try again.