Permalink
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...
Arne Morten Kvarving
Arne Morten Kvarving committed Apr 2, 2013
2 parents ccdba4e + 2e171e6 commit c3c7fd3eff5e2b099c61468dae31aa024b42a573
@@ -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 ""
@@ -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;
}
@@ -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 */
@@ -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 *
*********************************************************************/
@@ -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 */
@@ -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;
+ }
@@ -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 *
+ *********************************************************************/
@@ -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;
@@ -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()
Oops, something went wrong.

0 comments on commit c3c7fd3

Please sign in to comment.