aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--language/English/strings.xml5
-rw-r--r--project/VS2010Express/XBMC.vcxproj2
-rw-r--r--project/VS2010Express/XBMC.vcxproj.filters8
-rw-r--r--xbmc/FileItem.cpp2
-rw-r--r--xbmc/Util.cpp1
-rw-r--r--xbmc/cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.cpp2
-rw-r--r--xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp38
-rw-r--r--xbmc/filesystem/BlurayDirectory.cpp185
-rw-r--r--xbmc/filesystem/BlurayDirectory.h53
-rw-r--r--xbmc/filesystem/DirectoryFactory.cpp6
-rw-r--r--xbmc/filesystem/Makefile.in4
-rw-r--r--xbmc/utils/URIUtils.cpp8
-rw-r--r--xbmc/utils/URIUtils.h1
-rw-r--r--xbmc/video/windows/GUIWindowVideoBase.cpp74
-rw-r--r--xbmc/video/windows/GUIWindowVideoBase.h5
15 files changed, 378 insertions, 16 deletions
diff --git a/language/English/strings.xml b/language/English/strings.xml
index cc3d9d7117..ccb4a46963 100644
--- a/language/English/strings.xml
+++ b/language/English/strings.xml
@@ -2253,6 +2253,11 @@
<string id="24101">Would you like to download this Add-on?</string>
<string id="25000">Notifications</string>
<string id="25001">Hide foreign</string>
+ <string id="25002">Select from all titles ...</string>
+ <string id="25003">Show bluray menus</string>
+ <string id="25004">Play main title: %d</string>
+ <string id="25005">Title: %d</string>
+ <string id="25006">Select playback item</string>
<!-- strings 29800 thru 29998 reserved strings used only in the default Project Mayhem III skin and not c++ code -->
<string id="29800">Library Mode</string>
diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj
index aea09e7c76..90c06ab6fa 100644
--- a/project/VS2010Express/XBMC.vcxproj
+++ b/project/VS2010Express/XBMC.vcxproj
@@ -346,6 +346,7 @@
<ClCompile Include="..\..\xbmc\filesystem\AFPDirectory.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\AFPFile.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\ASAPFileDirectory.cpp" />
+ <ClCompile Include="..\..\xbmc\filesystem\BlurayDirectory.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\CacheStrategy.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\CDDADirectory.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\CDDAFile.cpp" />
@@ -908,6 +909,7 @@
<ClInclude Include="..\..\xbmc\filesystem\AFPDirectory.h" />
<ClInclude Include="..\..\xbmc\filesystem\AFPFile.h" />
<ClInclude Include="..\..\xbmc\filesystem\ASAPFileDirectory.h" />
+ <ClInclude Include="..\..\xbmc\filesystem\BlurayDirectory.h" />
<ClInclude Include="..\..\xbmc\filesystem\CacheStrategy.h" />
<ClInclude Include="..\..\xbmc\filesystem\CDDADirectory.h" />
<ClInclude Include="..\..\xbmc\filesystem\CDDAFile.h" />
diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters
index 396bc8fa23..d016167f97 100644
--- a/project/VS2010Express/XBMC.vcxproj.filters
+++ b/project/VS2010Express/XBMC.vcxproj.filters
@@ -2339,6 +2339,9 @@
<ClCompile Include="..\..\xbmc\filesystem\ASAPFileDirectory.cpp">
<Filter>filesystem</Filter>
</ClCompile>
+ <ClCompile Include="..\..\xbmc\filesystem\BlurayDirectory.cpp">
+ <Filter>filesystem</Filter>
+ </ClCompile>
<ClCompile Include="..\..\xbmc\filesystem\CacheStrategy.cpp">
<Filter>filesystem</Filter>
</ClCompile>
@@ -5194,6 +5197,9 @@
<ClInclude Include="..\..\xbmc\filesystem\FileCache.h">
<Filter>filesystem</Filter>
</ClInclude>
+ <ClInclude Include="..\..\xbmc\filesystem\BlurayDirectory.h">
+ <Filter>filesystem</Filter>
+ </ClInclude>
<ClInclude Include="..\..\xbmc\utils\Base64.h">
<Filter>utils</Filter>
</ClInclude>
@@ -5273,4 +5279,4 @@
<Filter>win32</Filter>
</CustomBuild>
</ItemGroup>
-</Project> \ No newline at end of file
+</Project>
diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp
index be3ef47330..a91acb1a79 100644
--- a/xbmc/FileItem.cpp
+++ b/xbmc/FileItem.cpp
@@ -2859,6 +2859,7 @@ CStdString CFileItem::GetLocalFanart() const
// no local fanart available for these
if (IsInternetStream()
|| URIUtils::IsUPnP(strFile)
+ || URIUtils::IsBluray(strFile)
|| IsLiveTV()
|| IsPlugin()
|| IsAddonsPath()
@@ -3119,6 +3120,7 @@ CStdString CFileItem::FindTrailer() const
// no local trailer available for these
if (IsInternetStream()
|| URIUtils::IsUPnP(strFile)
+ || URIUtils::IsBluray(strFile)
|| IsLiveTV()
|| IsPlugin()
|| IsDVD())
diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp
index e73ac0331d..ed673cbd1b 100644
--- a/xbmc/Util.cpp
+++ b/xbmc/Util.cpp
@@ -1258,6 +1258,7 @@ CStdString CUtil::ValidatePath(const CStdString &path, bool bFixDoubleSlashes /*
path.Left(4).Equals("zip:") ||
path.Left(4).Equals("rar:") ||
path.Left(6).Equals("stack:") ||
+ path.Left(7).Equals("bluray:") ||
path.Left(10).Equals("multipath:") ))
return result;
diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.cpp
index 1fe8ae19f3..06205f4167 100644
--- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.cpp
+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.cpp
@@ -53,7 +53,7 @@ CDVDInputStream* CDVDFactoryInputStream::CreateInputStream(IDVDPlayer* pPlayer,
return (new CDVDInputStreamNavigator(pPlayer));
}
#ifdef HAVE_LIBBLURAY
- else if (item.IsType(".bdmv") || item.IsType(".mpls") || content == "bluray/iso")
+ else if (item.IsType(".bdmv") || item.IsType(".mpls") || content == "bluray/iso" || file.substr(0, 7) == "bluray:")
return new CDVDInputStreamBluray(pPlayer);
#endif
else if(file.substr(0, 6) == "rtp://"
diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp
index ce871e41b3..60dd76c388 100644
--- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp
+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp
@@ -273,20 +273,34 @@ bool CDVDInputStreamBluray::Open(const char* strFile, const std::string& content
if(m_player == NULL)
return false;
- CStdString strPath;
- URIUtils::GetDirectory(strFile,strPath);
- URIUtils::RemoveSlashAtEnd(strPath);
+ CStdString strPath(strFile);
+ CStdString filename;
+ CStdString root;
- if(URIUtils::GetFileName(strPath) == "PLAYLIST")
+ if(strPath.Left(7).Equals("bluray:"))
{
- URIUtils::GetDirectory(strPath,strPath);
- URIUtils::RemoveSlashAtEnd(strPath);
+ CURL url(strPath);
+ root = url.GetHostName();
+ filename = URIUtils::GetFileName(url.GetFileName());
}
-
- if(URIUtils::GetFileName(strPath) == "BDMV")
+ else
{
URIUtils::GetDirectory(strPath,strPath);
URIUtils::RemoveSlashAtEnd(strPath);
+
+ if(URIUtils::GetFileName(strPath) == "PLAYLIST")
+ {
+ URIUtils::GetDirectory(strPath,strPath);
+ URIUtils::RemoveSlashAtEnd(strPath);
+ }
+
+ if(URIUtils::GetFileName(strPath) == "BDMV")
+ {
+ URIUtils::GetDirectory(strPath,strPath);
+ URIUtils::RemoveSlashAtEnd(strPath);
+ }
+ root = strPath;
+ filename = URIUtils::GetFileName(strFile);
}
if (!m_dll)
@@ -297,12 +311,12 @@ bool CDVDInputStreamBluray::Open(const char* strFile, const std::string& content
m_dll->bd_set_debug_handler(DllLibbluray::bluray_logger);
m_dll->bd_set_debug_mask(DBG_CRIT | DBG_BLURAY | DBG_NAV);
- CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - opening %s", strPath.c_str());
- m_bd = m_dll->bd_open(strPath.c_str(), NULL);
+ CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - opening %s", root.c_str());
+ m_bd = m_dll->bd_open(root.c_str(), NULL);
if(!m_bd)
{
- CLog::Log(LOGERROR, "CDVDInputStreamBluray::Open - failed to open %s", strPath.c_str());
+ CLog::Log(LOGERROR, "CDVDInputStreamBluray::Open - failed to open %s", root.c_str());
return false;
}
@@ -345,8 +359,6 @@ bool CDVDInputStreamBluray::Open(const char* strFile, const std::string& content
return false;
}
-
- CStdString filename = URIUtils::GetFileName(strFile);
if(filename.Equals("index.bdmv"))
{
m_navmode = false;
diff --git a/xbmc/filesystem/BlurayDirectory.cpp b/xbmc/filesystem/BlurayDirectory.cpp
new file mode 100644
index 0000000000..dc467107a0
--- /dev/null
+++ b/xbmc/filesystem/BlurayDirectory.cpp
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2005-2008 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "BlurayDirectory.h"
+#include "utils/log.h"
+#include "utils/URIUtils.h"
+#include "URL.h"
+#include "DllLibbluray.h"
+#include "FileItem.h"
+#include "video/VideoInfoTag.h"
+#include "guilib/LocalizeStrings.h"
+
+namespace XFILE
+{
+
+#define MAIN_TITLE_LENGTH_PERCENT 70 /** Minumum length of main titles, based on longest title */
+
+CBlurayDirectory::CBlurayDirectory()
+ : m_dll(NULL)
+ , m_bd(NULL)
+{
+}
+
+CBlurayDirectory::~CBlurayDirectory()
+{
+ Dispose();
+}
+
+void CBlurayDirectory::Dispose()
+{
+ if(m_bd)
+ {
+ m_dll->bd_close(m_bd);
+ m_bd = NULL;
+ }
+ delete m_dll;
+ m_dll = NULL;
+}
+
+CFileItemPtr CBlurayDirectory::GetTitle(const BLURAY_TITLE_INFO* title, const CStdString& label)
+{
+ CStdString buf;
+ CFileItemPtr item(new CFileItem("", false));
+ CURL path(m_url);
+ buf.Format("BDMV/PLAYLIST/%05d.mpls", title->playlist);
+ path.SetFileName(buf);
+ item->SetPath(path.Get());
+ item->GetVideoInfoTag()->m_strRuntime.Format("%d",title->duration / 90000);
+ item->GetVideoInfoTag()->m_iTrack = title->playlist;
+ buf.Format(label.c_str(), title->playlist);
+ item->m_strTitle = buf;
+ item->SetLabel(buf);
+ item->m_dwSize = 0;
+ item->SetIconImage("DefaultVideo.png");
+ for(unsigned int i = 0; i < title->clip_count; ++i)
+ item->m_dwSize += title->clips[i].pkt_count * 192;
+
+ return item;
+}
+
+void CBlurayDirectory::GetTitles(bool main, CFileItemList &items)
+{
+ unsigned titles = m_dll->bd_get_titles(m_bd, TITLES_RELEVANT, 0);
+ CStdString buf;
+
+ std::vector<BLURAY_TITLE_INFO*> buffer;
+
+ uint64_t duration = 0;
+
+ for(unsigned i=0; i < titles; i++)
+ {
+ BLURAY_TITLE_INFO *t = m_dll->bd_get_title_info(m_bd, i, 0);
+ if(!t)
+ {
+ CLog::Log(LOGDEBUG, "CBlurayDirectory - unable to get title %d", i);
+ continue;
+ }
+ if(t->duration > duration)
+ duration = t->duration;
+
+ buffer.push_back(t);
+ }
+
+ if(main)
+ duration = duration * MAIN_TITLE_LENGTH_PERCENT / 100;
+ else
+ duration = 0;
+
+ for(std::vector<BLURAY_TITLE_INFO*>::iterator it = buffer.begin(); it != buffer.end(); ++it)
+ {
+ if((*it)->duration < duration)
+ continue;
+ items.Add(GetTitle(*it, main ? g_localizeStrings.Get(25004) /* Main Title */ : g_localizeStrings.Get(25005) /* Title */));
+ }
+
+
+ for(std::vector<BLURAY_TITLE_INFO*>::iterator it = buffer.begin(); it != buffer.end(); ++it)
+ m_dll->bd_free_title_info(*it);
+}
+
+void CBlurayDirectory::GetRoot(CFileItemList &items)
+{
+ GetTitles(true, items);
+
+ CURL path(m_url);
+ CFileItemPtr item;
+
+ path.SetFileName(URIUtils::AddFileToFolder(m_url.GetFileName(), "titles"));
+ item.reset(new CFileItem());
+ item->SetPath(path.Get());
+ item->m_bIsFolder = true;
+ item->SetLabel(g_localizeStrings.Get(25002) /* All titles */);
+ item->SetIconImage("DefaultVideoPlaylists.png");
+ items.Add(item);
+
+ path.SetFileName("BDMV/MovieObject.bdmv");
+ item.reset(new CFileItem());
+ item->SetPath(path.Get());
+ item->m_bIsFolder = false;
+ item->SetLabel(g_localizeStrings.Get(25003) /* Menus */);
+ item->SetIconImage("DefaultProgram.png");
+ items.Add(item);
+}
+
+bool CBlurayDirectory::GetDirectory(const CStdString& path, CFileItemList &items)
+{
+ Dispose();
+ m_url.Parse(path);
+ CStdString root = m_url.GetHostName();
+ CStdString file = m_url.GetFileName();
+ URIUtils::RemoveSlashAtEnd(file);
+
+ m_dll = new DllLibbluray();
+ if (!m_dll->Load())
+ {
+ CLog::Log(LOGERROR, "CBlurayDirectory::GetDirectory - failed to load dll");
+ return false;
+ }
+
+ m_dll->bd_register_dir(DllLibbluray::dir_open);
+ m_dll->bd_register_file(DllLibbluray::file_open);
+ m_dll->bd_set_debug_handler(DllLibbluray::bluray_logger);
+ m_dll->bd_set_debug_mask(DBG_CRIT | DBG_BLURAY | DBG_NAV);
+
+ m_bd = m_dll->bd_open(root.c_str(), NULL);
+
+ if(!m_bd)
+ {
+ CLog::Log(LOGERROR, "CBlurayDirectory::GetDirectory - failed to open %s", root.c_str());
+ return false;
+ }
+
+ if(file == "")
+ GetRoot(items);
+ else if(file == "titles")
+ GetTitles(false, items);
+ else
+ return false;
+
+ items.AddSortMethod(SORT_METHOD_TRACKNUM , 554, LABEL_MASKS("%L", "%D", "%L", "")); // FileName, Duration | Foldername, empty
+ items.AddSortMethod(SORT_METHOD_SIZE , 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // FileName, Size | Foldername, Size
+
+ return true;
+}
+
+
+} /* namespace XFILE */
diff --git a/xbmc/filesystem/BlurayDirectory.h b/xbmc/filesystem/BlurayDirectory.h
new file mode 100644
index 0000000000..fea52e8d4e
--- /dev/null
+++ b/xbmc/filesystem/BlurayDirectory.h
@@ -0,0 +1,53 @@
+#pragma once
+
+/*
+ * Copyright (C) 2005-2008 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "Directory.h"
+#include "FileItem.h"
+#include "URL.h"
+
+class DllLibbluray;
+typedef struct bluray BLURAY;
+typedef struct bd_title_info BLURAY_TITLE_INFO;
+
+namespace XFILE
+{
+
+class CBlurayDirectory: public XFILE::IDirectory
+{
+public:
+ CBlurayDirectory();
+ virtual ~CBlurayDirectory();
+ virtual bool GetDirectory(const CStdString& path, CFileItemList &items);
+
+private:
+
+ void Dispose();
+ void GetRoot (CFileItemList &items);
+ void GetTitles(bool main, CFileItemList &items);
+ CFileItemPtr GetTitle(const BLURAY_TITLE_INFO* title, const CStdString& label);
+ CURL m_url;
+ DllLibbluray* m_dll;
+ BLURAY* m_bd;
+};
+
+}
diff --git a/xbmc/filesystem/DirectoryFactory.cpp b/xbmc/filesystem/DirectoryFactory.cpp
index e8a1bd03de..4a52cca8b4 100644
--- a/xbmc/filesystem/DirectoryFactory.cpp
+++ b/xbmc/filesystem/DirectoryFactory.cpp
@@ -100,6 +100,9 @@
#ifdef HAS_FILESYSTEM_AFP
#include "AFPDirectory.h"
#endif
+#ifdef HAVE_LIBBLURAY
+#include "BlurayDirectory.h"
+#endif
using namespace XFILE;
@@ -198,6 +201,9 @@ IDirectory* CDirectoryFactory::Create(const CStdString& strPath)
#ifdef HAS_FILESYSTEM_AFP
if (strProtocol == "afp") return new CAFPDirectory();
#endif
+#ifdef HAVE_LIBBLURAY
+ if (strProtocol == "bluray") return new CBlurayDirectory();
+#endif
}
CLog::Log(LOGWARNING, "%s - Unsupported protocol(%s) in %s", __FUNCTION__, strProtocol.c_str(), url.Get().c_str() );
diff --git a/xbmc/filesystem/Makefile.in b/xbmc/filesystem/Makefile.in
index 40097f154c..5839cc83c9 100644
--- a/xbmc/filesystem/Makefile.in
+++ b/xbmc/filesystem/Makefile.in
@@ -112,6 +112,10 @@ SRCS+=AFPFile.cpp
SRCS+=AFPDirectory.cpp
endif
+ifeq (@HAVE_LIBBLURAY@,1)
+SRCS+=BlurayDirectory.cpp
+endif
+
INCLUDES+=-I@abs_top_srcdir@/lib/libUPnP/Platinum/Source/Core \
-I@abs_top_srcdir@/lib/libUPnP/Platinum/Source/Platinum \
-I@abs_top_srcdir@/lib/libUPnP/Platinum/Source/Devices/MediaServer \
diff --git a/xbmc/utils/URIUtils.cpp b/xbmc/utils/URIUtils.cpp
index a3a4023f21..a90f138dcf 100644
--- a/xbmc/utils/URIUtils.cpp
+++ b/xbmc/utils/URIUtils.cpp
@@ -231,7 +231,8 @@ void URIUtils::GetCommonPath(CStdString& strParent, const CStdString& strPath)
bool URIUtils::ProtocolHasParentInHostname(const CStdString& prot)
{
return prot.Equals("zip")
- || prot.Equals("rar");
+ || prot.Equals("rar")
+ || prot.Equals("bluray");
}
bool URIUtils::ProtocolHasEncodedHostname(const CStdString& prot)
@@ -777,6 +778,11 @@ bool URIUtils::IsLastFM(const CStdString& strFile)
return strFile.Left(7).Equals("lastfm:");
}
+bool URIUtils::IsBluray(const CStdString& strFile)
+{
+ return strFile.Left(7).Equals("bluray:");
+}
+
bool URIUtils::IsDOSPath(const CStdString &path)
{
if (path.size() > 1 && path[1] == ':' && isalpha(path[0]))
diff --git a/xbmc/utils/URIUtils.h b/xbmc/utils/URIUtils.h
index 751f1f00f5..4eb1d93d56 100644
--- a/xbmc/utils/URIUtils.h
+++ b/xbmc/utils/URIUtils.h
@@ -88,6 +88,7 @@ public:
static bool IsVideoDb(const CStdString& strFile);
static bool IsVTP(const CStdString& strFile);
static bool IsZIP(const CStdString& strFile);
+ static bool IsBluray(const CStdString& strFile);
static void AddSlashAtEnd(CStdString& strFolder);
static bool HasSlashAtEnd(const CStdString& strFile);
diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp
index 0c1d486d6b..d00450d07c 100644
--- a/xbmc/video/windows/GUIWindowVideoBase.cpp
+++ b/xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -1048,6 +1048,77 @@ bool CGUIWindowVideoBase::ShowResumeMenu(CFileItem &item)
return true;
}
+bool CGUIWindowVideoBase::ShowPlaySelection(CFileItemPtr& item)
+{
+ /* if asked to resume somewhere, we should not show anything */
+ if (item->m_lStartOffset)
+ return true;
+
+ if (item->IsBDFile())
+ {
+ CStdString root = URIUtils::GetParentPath(item->GetPath());
+ URIUtils::RemoveSlashAtEnd(root);
+ if(URIUtils::GetFileName(root) == "BDMV")
+ {
+ CURL url("bluray://");
+ url.SetHostName(URIUtils::GetParentPath(root));
+ return ShowPlaySelection(item, url.Get());
+ }
+ }
+
+ return true;
+}
+
+bool CGUIWindowVideoBase::ShowPlaySelection(CFileItemPtr& item, const CStdString& directory)
+{
+
+ CFileItemList items;
+
+ if (!XFILE::CDirectory::GetDirectory(directory, items, XFILE::CDirectory::CHints(), true))
+ {
+ CLog::Log(LOGERROR, "CGUIWindowVideoBase::ShowPlaySelection - Failed to get play directory for %s", directory.c_str());
+ return true;
+ }
+
+ if (items.Size() == 0)
+ {
+ CLog::Log(LOGERROR, "CGUIWindowVideoBase::ShowPlaySelection - Failed to get any items %s", directory.c_str());
+ return true;
+ }
+
+ CGUIDialogSelect* dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
+ while(true)
+ {
+ dialog->Reset();
+ dialog->SetHeading(25006 /* Select playback item */);
+ dialog->SetItems(&items);
+ dialog->SetUseDetails(true);
+ dialog->DoModal();
+
+ CFileItemPtr item_new = dialog->GetSelectedItem();
+ if(!item_new || dialog->GetSelectedLabel() < 0)
+ {
+ CLog::Log(LOGDEBUG, "CGUIWindowVideoBase::ShowPlaySelection - User aborted %s", directory.c_str());
+ break;
+ }
+
+ if(item_new->m_bIsFolder == false)
+ {
+ item = item_new;
+ return true;
+ }
+
+ items.Clear();
+ if(!XFILE::CDirectory::GetDirectory(item_new->GetPath(), items, XFILE::CDirectory::CHints(), true) || items.Size() == 0)
+ {
+ CLog::Log(LOGERROR, "CGUIWindowVideoBase::ShowPlaySelection - Failed to get any items %s", item_new->GetPath().c_str());
+ break;
+ }
+ }
+
+ return false;
+}
+
bool CGUIWindowVideoBase::OnResumeItem(int iItem)
{
if (iItem < 0 || iItem >= m_vecItems->Size()) return true;
@@ -1418,6 +1489,9 @@ void CGUIWindowVideoBase::PlayMovie(const CFileItem *item)
{
CFileItemPtr movieItem(new CFileItem(*item));
+ if(!ShowPlaySelection(movieItem))
+ return;
+
g_playlistPlayer.Reset();
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
CPlayList& playlist = g_playlistPlayer.GetPlaylist(PLAYLIST_VIDEO);
diff --git a/xbmc/video/windows/GUIWindowVideoBase.h b/xbmc/video/windows/GUIWindowVideoBase.h
index 21aa210e81..465b910d92 100644
--- a/xbmc/video/windows/GUIWindowVideoBase.h
+++ b/xbmc/video/windows/GUIWindowVideoBase.h
@@ -43,6 +43,11 @@ public:
static void MarkWatched(const CFileItemPtr &pItem, bool bMark);
static void UpdateVideoTitle(const CFileItem* pItem);
+ /*! \brief Show dialog allowing selection of wanted playback item */
+ static bool ShowPlaySelection(CFileItemPtr& item);
+ static bool ShowPlaySelection(CFileItemPtr& item, const CStdString& directory);
+
+
/*! \brief Show the resume menu for this item (if it has a resume bookmark)
If a resume bookmark is found, we set the item's m_lStartOffset to STARTOFFSET_RESUME
\param item item to check for a resume bookmark