Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[DVDInputStreamNavigator/Players] Use a struct and dvdnav_get_stitle_…

…info(...) to query all required subtitle stream info at once.

[Fixes]
- Set the stream language of dvd subtitles properly/consistent with other streams, i.e. set it to a three char code.

- Set the stream name of dvd subtitle tracks properly/consistent with other streams; in particular don't use the language as the name.
  • Loading branch information...
commit d8b2ca86306e8d44b496f216d4f91824b4925330 1 parent 63bb4a6
@ace20022 authored
View
79 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
@@ -823,52 +823,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 += "(CC)";
+ break;
+ case DVD_SUBPICTURE_LANG_EXT_Forced:
+ info.name += "(Forced)";
+ break;
+ case DVD_SUBPICTURE_LANG_EXT_NormalDirectorsComments:
+ case DVD_SUBPICTURE_LANG_EXT_BigDirectorsComments:
+ case DVD_SUBPICTURE_LANG_EXT_ChildrensDirectorsComments:
+ info.name += "(Directors Comments)";
+ break;
+ default:
+ break;
}
}
-
- return strLanguage;
}
int CDVDInputStreamNavigator::GetSubTitleStreamCount()
View
3  xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h
@@ -105,8 +105,8 @@ 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);
@@ -155,6 +155,7 @@ class CDVDInputStreamNavigator
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;
View
6 xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -336,10 +336,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);
}
}
View
6 xbmc/cores/omxplayer/OMXPlayer.cpp
@@ -336,10 +336,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);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.