aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Zelend <ace20022@xbmc.org>2016-04-06 13:10:11 +0200
committerAndreas Zelend <ace20022@xbmc.org>2016-04-06 13:10:11 +0200
commit2e7dc772d4a78e8f94cf7b481ce7db23a6225587 (patch)
tree35bb338212f414342a1022baa8d404c276a71ba9
parent6df83c477d68fd37f174457d761c27ee7f77496e (diff)
parent6d6759e8a16f849d1152a463d82ddefc53f8d13e (diff)
Merge pull request #9559 from taxigps/sup
add support for external PGS/.sup subtitles
-rw-r--r--xbmc/Util.cpp23
-rw-r--r--xbmc/Util.h1
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp1
-rw-r--r--xbmc/utils/Mime.cpp1
4 files changed, 26 insertions, 0 deletions
diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp
index 845df864fa..79bf03da29 100644
--- a/xbmc/Util.cpp
+++ b/xbmc/Util.cpp
@@ -2145,6 +2145,29 @@ std::string CUtil::GetVobSubIdxFromSub(const std::string& vobSub)
return std::string();
}
+void CUtil::ScanForExternalDemuxSub(const std::string& videoPath, std::vector<std::string>& vecSubtitles)
+{
+ CFileItem item(videoPath, false);
+ if (item.IsInternetStream()
+ || item.IsPlayList()
+ || item.IsLiveTV()
+ || item.IsPVR()
+ || !item.IsVideo())
+ return;
+
+ std::string strBasePath;
+ std::string strSubtitle;
+
+ GetVideoBasePathAndFileName(videoPath, strBasePath, strSubtitle);
+
+ CFileItemList items;
+ const std::vector<std::string> common_sub_dirs = { "subs", "subtitles", "vobsubs", "sub", "vobsub", "subtitle" };
+ const std::string DemuxSubExtensions = ".sup";
+ GetItemsToScan(strBasePath, DemuxSubExtensions, common_sub_dirs, items);
+
+ std::vector<std::string> exts = StringUtils::Split(g_advancedSettings.GetMusicExtensions(), "|");
+ ScanPathsForAssociatedItems(strSubtitle, items, exts, vecSubtitles);
+}
void CUtil::ScanForExternalAudio(const std::string& videoPath, std::vector<std::string>& vecAudio)
{
diff --git a/xbmc/Util.h b/xbmc/Util.h
index d6c3fb3441..fca9e13b9a 100644
--- a/xbmc/Util.h
+++ b/xbmc/Util.h
@@ -94,6 +94,7 @@ public:
* \param[out] vecAudio A vector containing the full paths of all found external audio files.
*/
static void ScanForExternalAudio(const std::string& videoPath, std::vector<std::string>& vecAudio);
+ static void ScanForExternalDemuxSub(const std::string& videoPath, std::vector<std::string>& vecSubtitles);
static int64_t ToInt64(uint32_t high, uint32_t low);
static std::string GetNextFilename(const std::string &fn_template, int max);
static std::string GetNextPathname(const std::string &path_template, int max);
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
index ab6d4cf63b..0f08b8710e 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
@@ -54,6 +54,7 @@ CDVDInputStream* CDVDFactoryInputStream::CreateInputStream(IVideoPlayer* pPlayer
std::vector<std::string> filenames;
filenames.push_back(file);
CUtil::ScanForExternalAudio(file, filenames);
+ CUtil::ScanForExternalDemuxSub(file, filenames);
if (filenames.size() >= 2)
{
return CreateInputStream(pPlayer, fileitem, filenames);
diff --git a/xbmc/utils/Mime.cpp b/xbmc/utils/Mime.cpp
index e5dc65d30c..8845b5340e 100644
--- a/xbmc/utils/Mime.cpp
+++ b/xbmc/utils/Mime.cpp
@@ -391,6 +391,7 @@ std::map<std::string, std::string> fillMimeTypes()
mimeTypes.insert(std::pair<std::string, std::string>("step", "application/step"));
mimeTypes.insert(std::pair<std::string, std::string>("stl", "application/sla"));
mimeTypes.insert(std::pair<std::string, std::string>("stp", "application/step"));
+ mimeTypes.insert(std::pair<std::string, std::string>("sup", "application/x-pgs"));
mimeTypes.insert(std::pair<std::string, std::string>("sv4cpio", "application/x-sv4cpio"));
mimeTypes.insert(std::pair<std::string, std::string>("sv4crc", "application/x-sv4crc"));
mimeTypes.insert(std::pair<std::string, std::string>("svf", "image/vnd.dwg"));