[DVDPlayer/DVDFileInfo] Add external subs' details while updating stream details...
authorace20022 <ace20022@ymail.com>
Sun, 23 Jun 2013 22:03:52 +0000 (00:03 +0200)
committerace20022 <ace20022@ymail.com>
Tue, 1 Oct 2013 21:46:29 +0000 (23:46 +0200)
xbmc/cores/dvdplayer/DVDFileInfo.cpp
xbmc/cores/dvdplayer/DVDFileInfo.h
xbmc/cores/dvdplayer/DVDPlayer.cpp
xbmc/cores/dvdplayer/DVDPlayer.h
xbmc/utils/StreamDetails.cpp
xbmc/utils/StreamDetails.h

index 331872d..c73ea36 100644 (file)
@@ -359,6 +359,19 @@ bool CDVDFileInfo::GetFileStreamDetails(CFileItem *pItem)
   }
 }
 
+bool CDVDFileInfo::DemuxerToStreamDetails(CDVDInputStream *pInputStream, CDVDDemux *pDemuxer, const std::vector<CStreamDetailSubtitle> subs, CStreamDetails &details)
+{
+  bool result = DemuxerToStreamDetails(pInputStream, pDemuxer, details);
+  for (unsigned int i = 0; i < subs.size(); i++)
+  {
+    CStreamDetailSubtitle* sub = new CStreamDetailSubtitle();
+    sub->m_strLanguage = subs[i].m_strLanguage;
+    details.AddStream(sub);
+    result = true;
+  }
+  return result;
+}
+
 /* returns true if details have been added */
 bool CDVDFileInfo::DemuxerToStreamDetails(CDVDInputStream *pInputStream, CDVDDemux *pDemux, CStreamDetails &details, const CStdString &path)
 {
index b3a6065..3cc81da 100644 (file)
@@ -25,6 +25,7 @@
 class CFileItem;
 class CDVDDemux;
 class CStreamDetails;
+class CStreamDetailSubtitle;
 class CDVDInputStream;
 class CTextureDetails;
 
@@ -38,6 +39,11 @@ public:
   static bool GetFileStreamDetails(CFileItem *pItem);
   static bool DemuxerToStreamDetails(CDVDInputStream* pInputStream, CDVDDemux *pDemux, CStreamDetails &details, const CStdString &path = "");
 
+  /** \brief Probe the file's internal and external streams and store the info in the StreamDetails parameter.
+  *   \param[out] details The file's StreamDetails consisting of internal streams and external subtitle streams.
+  */
+  static bool DemuxerToStreamDetails(CDVDInputStream *pInputStream, CDVDDemux *pDemuxer, const std::vector<CStreamDetailSubtitle> subs, CStreamDetails &details);
+
   static bool GetFileDuration(const CStdString &path, int &duration);
 
   /** \brief Probe the streams of an external subtitle file and store the info in the StreamDetails parameter.
index 3d23abe..86d8419 100644 (file)
@@ -4123,7 +4123,19 @@ bool CDVDPlayer::GetStreamDetails(CStreamDetails &details)
 {
   if (m_pDemuxer)
   {
-    bool result = CDVDFileInfo::DemuxerToStreamDetails(m_pInputStream, m_pDemuxer, details);
+    std::vector<SelectionStream> subs = m_SelectionStreams.Get(STREAM_SUBTITLE);
+    std::vector<CStreamDetailSubtitle> extSubDetails;
+    for (unsigned int i = 0; i < subs.size(); i++)
+    {
+      if (subs[i].filename == m_filename)
+        continue;
+
+      CStreamDetailSubtitle p;
+      p.m_strLanguage = subs[i].language;
+      extSubDetails.push_back(p);
+    }
+    
+    bool result = CDVDFileInfo::DemuxerToStreamDetails(m_pInputStream, m_pDemuxer, extSubDetails, details);
     if (result && details.GetStreamCount(CStreamDetail::VIDEO) > 0) // this is more correct (dvds in particular)
     {
       /* 
index 237aba4..f6eecc4 100644 (file)
@@ -39,6 +39,7 @@
 #include "Edl.h"
 #include "FileItem.h"
 #include "threads/SingleLock.h"
+#include "utils/StreamDetails.h"
 
 
 class CDVDInputStream;
index 82d99af..e862ae3 100644 (file)
@@ -160,6 +160,16 @@ bool CStreamDetailSubtitle::IsWorseThan(CStreamDetail *that)
   return false;
 }
 
+CStreamDetailSubtitle& CStreamDetailSubtitle::operator=(const CStreamDetailSubtitle &that)
+{
+  if (this != &that)
+  {
+    this->m_pParent = that.m_pParent;
+    this->m_strLanguage = that.m_strLanguage;
+  }
+  return *this;
+}
+
 CStreamDetails& CStreamDetails::operator=(const CStreamDetails &that)
 {
   if (this != &that)
index 3911205..dd93f6e 100644 (file)
@@ -78,6 +78,7 @@ class CStreamDetailSubtitle : public CStreamDetail
 {
 public:
   CStreamDetailSubtitle();
+  CStreamDetailSubtitle& operator=(const CStreamDetailSubtitle &that);
   virtual void Archive(CArchive& ar);
   virtual void Serialize(CVariant& value) const;
   virtual bool IsWorseThan(CStreamDetail *that);