Skip to content
This repository

Bluray directory support #872

Merged
merged 3 commits into from almost 2 years ago

3 participants

Joakim Plate da-anda Jezz
Joakim Plate
Collaborator

This adds a bluray virtual directory to more easily navigate a bluray file with it's title tracks and playlists.

Something similar aught to be done for dvd's too. This gives a directory structure like:

/titles/Title 1 [duration]
/titles/Title 2 [duration]
/titles/Title 3 [duration]
/Menus
/Title 5 [duration] ///< this is the longest duration title

It also contains a commit which during scanning avoids all title's apart from the longest titles in the root (can be multiple, set to larger than 2/3 of the longest title).

da-anda
Collaborator

haven't tested it yet, and although I really welcome a way to select the BD stream, I don't think this should be done as VFS structure, because it's none and IMO needs different treatment/presentation. We should think of alternatives here for a better user experience - something like a popup/dialog and/or a overlay menu during playback.

Joakim Plate
Collaborator

Yea.. i sort of agree. Doesn't really hinder it being added as a virtual file system. For example, when we start playback on an item, we do a getdirectory request on it, if that returns elements we pop up a dialog with the result of that.

@jmarshallnz , @cptspiff thought?

Deleted user
ghost commented April 13, 2012

The content you are editing has changed. Reload the page and try again.

as you say one does not exclude the other and having it available as vfs makes sense no matter.

Sending Request…

Attach images by dragging & dropping or selecting them. Octocat-spinner-32 Uploading your images… Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. Yowza, that's a big file. Try again with an image file smaller than 10MB. This browser doesn't support image attachments. We recommend updating to the latest Internet Explorer, Google Chrome, or Firefox. Something went really wrong, and we can't process that image. Try again.

Joakim Plate
Collaborator

Well, combining it with the resume file dialog would make a lot of sence.. Seeing as that would pop up after otherwise.

Joakim Plate
Collaborator

Ok, so comments but the define addressed. Looks much nicer now with the GuiDialogSelect instead.

The scanning hints change can now be skipped, since nothing is really using it. Not sure it was a good idea anyway.

@JezzX this is going to need some skinning work too. Seems GuiDialogSelect is very geared to addons it seem. The fileitems added to it have filesize and runtime. I'm not sure what else i might be able to extract about them yet.

Jezz
Collaborator
JezzX commented April 13, 2012

Sorry as a none coder I'm a little confused as too what this does.
does this do that when you click on a bluray directory it pops up dialog select with a list of Menued items on the blueray in plain english names that the disc gives it ?

If so I would just go for using the non addon id 3 list instead of id 6 and then I can add a label 2 too it so Label1 = title Label2 = duration any extra info is just fluff end users don't really care about the file size when trying to play something.

Joakim Plate
Collaborator

Sadly there are no english names. So it will just list:
Main Title 1
Main Title 2
Menus
All Titles (subfolder)

Then in All Titles:
All Titles/Title 1
All Titles/Title ...
All Titles/Title XX

But they do have possible metadata like duration and file size and possibly even video codec/audio codec and stuff like that.

Joakim Plate
Collaborator

So this is a alternate solution for this. (note the content type commits you can technically ignore, suppose they can be dropped). It will pop up a dialog for selection when a movie is tarted.

I'm far from happy with this thou as there is no good way to find all paths that we can start playback. With this, play from favorites, won't show dialog for example.

Don't like the idea of duplicating code for that. Any ideas on how to handle this @cptspiff , @jmarshallnz ?

Deleted user
ghost commented April 25, 2012

The content you are editing has changed. Reload the page and try again.

seems it's already somewhat based on duplication for resume in playmedia builtin. best you can do is break it out in a separate function as is done for ShowResumeMenu..

Sending Request…

Attach images by dragging & dropping or selecting them. Octocat-spinner-32 Uploading your images… Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. Yowza, that's a big file. Try again with an image file smaller than 10MB. This browser doesn't support image attachments. We recommend updating to the latest Internet Explorer, Google Chrome, or Firefox. Something went really wrong, and we can't process that image. Try again.

Joakim Plate
Collaborator
elupus commented May 01, 2012

Ok. I think this is pretty much ready to go as a step in the right direction at least.

Joakim Plate elupus merged commit 22e9485 into from May 02, 2012
Joakim Plate elupus closed this May 02, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
5  language/English/strings.xml
@@ -2253,6 +2253,11 @@
2253 2253
   <string id="24101">Would you like to download this Add-on?</string>
2254 2254
   <string id="25000">Notifications</string>
2255 2255
   <string id="25001">Hide foreign</string>
  2256
+  <string id="25002">Select from all titles ...</string>
  2257
+  <string id="25003">Show bluray menus</string>
  2258
+  <string id="25004">Play main title: %d</string>
  2259
+  <string id="25005">Title: %d</string>
  2260
+  <string id="25006">Select playback item</string>
2256 2261
 
2257 2262
   <!-- strings 29800 thru 29998 reserved strings used only in the default Project Mayhem III skin and not c++ code -->
2258 2263
   <string id="29800">Library Mode</string>
2  project/VS2010Express/XBMC.vcxproj
@@ -346,6 +346,7 @@
346 346
     <ClCompile Include="..\..\xbmc\filesystem\AFPDirectory.cpp" />
347 347
     <ClCompile Include="..\..\xbmc\filesystem\AFPFile.cpp" />
348 348
     <ClCompile Include="..\..\xbmc\filesystem\ASAPFileDirectory.cpp" />
  349
+    <ClCompile Include="..\..\xbmc\filesystem\BlurayDirectory.cpp" />
349 350
     <ClCompile Include="..\..\xbmc\filesystem\CacheStrategy.cpp" />
350 351
     <ClCompile Include="..\..\xbmc\filesystem\CDDADirectory.cpp" />
351 352
     <ClCompile Include="..\..\xbmc\filesystem\CDDAFile.cpp" />
@@ -907,6 +908,7 @@
907 908
     <ClInclude Include="..\..\xbmc\filesystem\AFPDirectory.h" />
908 909
     <ClInclude Include="..\..\xbmc\filesystem\AFPFile.h" />
909 910
     <ClInclude Include="..\..\xbmc\filesystem\ASAPFileDirectory.h" />
  911
+    <ClInclude Include="..\..\xbmc\filesystem\BlurayDirectory.h" />
910 912
     <ClInclude Include="..\..\xbmc\filesystem\CacheStrategy.h" />
911 913
     <ClInclude Include="..\..\xbmc\filesystem\CDDADirectory.h" />
912 914
     <ClInclude Include="..\..\xbmc\filesystem\CDDAFile.h" />
6  project/VS2010Express/XBMC.vcxproj.filters
@@ -2345,6 +2345,9 @@
2345 2345
     <ClCompile Include="..\..\xbmc\filesystem\ASAPFileDirectory.cpp">
2346 2346
       <Filter>filesystem</Filter>
2347 2347
     </ClCompile>
  2348
+    <ClCompile Include="..\..\xbmc\filesystem\BlurayDirectory.cpp">
  2349
+      <Filter>filesystem</Filter>
  2350
+    </ClCompile>
2348 2351
     <ClCompile Include="..\..\xbmc\filesystem\CacheStrategy.cpp">
2349 2352
       <Filter>filesystem</Filter>
2350 2353
     </ClCompile>
@@ -5206,6 +5209,9 @@
5206 5209
     <ClInclude Include="..\..\xbmc\filesystem\FileCache.h">
5207 5210
       <Filter>filesystem</Filter>
5208 5211
     </ClInclude>
  5212
+    <ClInclude Include="..\..\xbmc\filesystem\BlurayDirectory.h">
  5213
+      <Filter>filesystem</Filter>
  5214
+    </ClInclude>
5209 5215
     <ClInclude Include="..\..\xbmc\utils\Base64.h">
5210 5216
       <Filter>utils</Filter>
5211 5217
     </ClInclude>
2  xbmc/FileItem.cpp
@@ -2859,6 +2859,7 @@ CStdString CFileItem::GetLocalFanart() const
2859 2859
   // no local fanart available for these
2860 2860
   if (IsInternetStream()
2861 2861
    || URIUtils::IsUPnP(strFile)
  2862
+   || URIUtils::IsBluray(strFile)
2862 2863
    || IsLiveTV()
2863 2864
    || IsPlugin()
2864 2865
    || IsAddonsPath()
@@ -3119,6 +3120,7 @@ CStdString CFileItem::FindTrailer() const
3119 3120
   // no local trailer available for these
3120 3121
   if (IsInternetStream()
3121 3122
    || URIUtils::IsUPnP(strFile)
  3123
+   || URIUtils::IsBluray(strFile)
3122 3124
    || IsLiveTV()
3123 3125
    || IsPlugin()
3124 3126
    || IsDVD())
1  xbmc/Util.cpp
@@ -1258,6 +1258,7 @@ CStdString CUtil::ValidatePath(const CStdString &path, bool bFixDoubleSlashes /*
1258 1258
       path.Left(4).Equals("zip:") ||
1259 1259
       path.Left(4).Equals("rar:") ||
1260 1260
       path.Left(6).Equals("stack:") ||
  1261
+      path.Left(7).Equals("bluray:") ||
1261 1262
       path.Left(10).Equals("multipath:") ))
1262 1263
     return result;
1263 1264
 
2  xbmc/cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.cpp
@@ -53,7 +53,7 @@ CDVDInputStream* CDVDFactoryInputStream::CreateInputStream(IDVDPlayer* pPlayer,
53 53
     return (new CDVDInputStreamNavigator(pPlayer));
54 54
   }
55 55
 #ifdef HAVE_LIBBLURAY
56  
-  else if (item.IsType(".bdmv") || item.IsType(".mpls") || content == "bluray/iso")
  56
+  else if (item.IsType(".bdmv") || item.IsType(".mpls") || content == "bluray/iso" || file.substr(0, 7) == "bluray:")
57 57
     return new CDVDInputStreamBluray(pPlayer);
58 58
 #endif
59 59
   else if(file.substr(0, 6) == "rtp://"
38  xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp
@@ -273,20 +273,34 @@ bool CDVDInputStreamBluray::Open(const char* strFile, const std::string& content
273 273
   if(m_player == NULL)
274 274
     return false;
275 275
 
276  
-  CStdString strPath;
277  
-  URIUtils::GetDirectory(strFile,strPath);
278  
-  URIUtils::RemoveSlashAtEnd(strPath);
  276
+  CStdString strPath(strFile);
  277
+  CStdString filename;
  278
+  CStdString root;
279 279
 
280  
-  if(URIUtils::GetFileName(strPath) == "PLAYLIST")
  280
+  if(strPath.Left(7).Equals("bluray:"))
281 281
   {
282  
-    URIUtils::GetDirectory(strPath,strPath);
283  
-    URIUtils::RemoveSlashAtEnd(strPath);
  282
+    CURL url(strPath);
  283
+    root     = url.GetHostName();
  284
+    filename = URIUtils::GetFileName(url.GetFileName());
284 285
   }
285  
-
286  
-  if(URIUtils::GetFileName(strPath) == "BDMV")
  286
+  else
287 287
   {
288 288
     URIUtils::GetDirectory(strPath,strPath);
289 289
     URIUtils::RemoveSlashAtEnd(strPath);
  290
+
  291
+    if(URIUtils::GetFileName(strPath) == "PLAYLIST")
  292
+    {
  293
+      URIUtils::GetDirectory(strPath,strPath);
  294
+      URIUtils::RemoveSlashAtEnd(strPath);
  295
+    }
  296
+
  297
+    if(URIUtils::GetFileName(strPath) == "BDMV")
  298
+    {
  299
+      URIUtils::GetDirectory(strPath,strPath);
  300
+      URIUtils::RemoveSlashAtEnd(strPath);
  301
+    }
  302
+    root     = strPath;
  303
+    filename = URIUtils::GetFileName(strFile);
290 304
   }
291 305
 
292 306
   if (!m_dll)
@@ -297,12 +311,12 @@ bool CDVDInputStreamBluray::Open(const char* strFile, const std::string& content
297 311
   m_dll->bd_set_debug_handler(DllLibbluray::bluray_logger);
298 312
   m_dll->bd_set_debug_mask(DBG_CRIT | DBG_BLURAY | DBG_NAV);
299 313
 
300  
-  CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - opening %s", strPath.c_str());
301  
-  m_bd = m_dll->bd_open(strPath.c_str(), NULL);
  314
+  CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - opening %s", root.c_str());
  315
+  m_bd = m_dll->bd_open(root.c_str(), NULL);
302 316
 
303 317
   if(!m_bd)
304 318
   {
305  
-    CLog::Log(LOGERROR, "CDVDInputStreamBluray::Open - failed to open %s", strPath.c_str());
  319
+    CLog::Log(LOGERROR, "CDVDInputStreamBluray::Open - failed to open %s", root.c_str());
306 320
     return false;
307 321
   }
308 322
 
@@ -345,8 +359,6 @@ bool CDVDInputStreamBluray::Open(const char* strFile, const std::string& content
345 359
     return false;
346 360
   }
347 361
 
348  
-
349  
-  CStdString filename = URIUtils::GetFileName(strFile);
350 362
   if(filename.Equals("index.bdmv"))
351 363
   {
352 364
     m_navmode = false;
185  xbmc/filesystem/BlurayDirectory.cpp
... ...
@@ -0,0 +1,185 @@
  1
+/*
  2
+ *      Copyright (C) 2005-2008 Team XBMC
  3
+ *      http://www.xbmc.org
  4
+ *
  5
+ *  This Program is free software; you can redistribute it and/or modify
  6
+ *  it under the terms of the GNU General Public License as published by
  7
+ *  the Free Software Foundation; either version 2, or (at your option)
  8
+ *  any later version.
  9
+ *
  10
+ *  This Program is distributed in the hope that it will be useful,
  11
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13
+ *  GNU General Public License for more details.
  14
+ *
  15
+ *  You should have received a copy of the GNU General Public License
  16
+ *  along with XBMC; see the file COPYING.  If not, write to
  17
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  18
+ *  http://www.gnu.org/copyleft/gpl.html
  19
+ *
  20
+ */
  21
+
  22
+#include "BlurayDirectory.h"
  23
+#include "utils/log.h"
  24
+#include "utils/URIUtils.h"
  25
+#include "URL.h"
  26
+#include "DllLibbluray.h"
  27
+#include "FileItem.h"
  28
+#include "video/VideoInfoTag.h"
  29
+#include "guilib/LocalizeStrings.h"
  30
+
  31
+namespace XFILE
  32
+{
  33
+
  34
+#define MAIN_TITLE_LENGTH_PERCENT 70 /** Minumum length of main titles, based on longest title */
  35
+
  36
+CBlurayDirectory::CBlurayDirectory()
  37
+  : m_dll(NULL)
  38
+  , m_bd(NULL)
  39
+{
  40
+}
  41
+
  42
+CBlurayDirectory::~CBlurayDirectory()
  43
+{
  44
+  Dispose();
  45
+}
  46
+
  47
+void CBlurayDirectory::Dispose()
  48
+{
  49
+  if(m_bd)
  50
+  {
  51
+    m_dll->bd_close(m_bd);
  52
+    m_bd = NULL;
  53
+  }
  54
+  delete m_dll;
  55
+  m_dll = NULL;
  56
+}
  57
+
  58
+CFileItemPtr CBlurayDirectory::GetTitle(const BLURAY_TITLE_INFO* title, const CStdString& label)
  59
+{
  60
+  CStdString buf;
  61
+  CFileItemPtr item(new CFileItem("", false));
  62
+  CURL path(m_url);
  63
+  buf.Format("BDMV/PLAYLIST/%05d.mpls", title->playlist);
  64
+  path.SetFileName(buf);
  65
+  item->SetPath(path.Get());
  66
+  item->GetVideoInfoTag()->m_strRuntime.Format("%d",title->duration / 90000);
  67
+  item->GetVideoInfoTag()->m_iTrack = title->playlist;
  68
+  buf.Format(label.c_str(), title->playlist);
  69
+  item->m_strTitle = buf;
  70
+  item->SetLabel(buf);
  71
+  item->m_dwSize = 0;
  72
+  item->SetIconImage("DefaultVideo.png");
  73
+  for(unsigned int i = 0; i < title->clip_count; ++i)
  74
+    item->m_dwSize += title->clips[i].pkt_count * 192;
  75
+
  76
+  return item;
  77
+}
  78
+
  79
+void CBlurayDirectory::GetTitles(bool main, CFileItemList &items)
  80
+{
  81
+  unsigned titles = m_dll->bd_get_titles(m_bd, TITLES_RELEVANT, 0);
  82
+  CStdString buf;
  83
+
  84
+  std::vector<BLURAY_TITLE_INFO*> buffer;
  85
+
  86
+  uint64_t duration = 0;
  87
+
  88
+  for(unsigned i=0; i < titles; i++)
  89
+  {
  90
+    BLURAY_TITLE_INFO *t = m_dll->bd_get_title_info(m_bd, i, 0);
  91
+    if(!t)
  92
+    {
  93
+      CLog::Log(LOGDEBUG, "CBlurayDirectory - unable to get title %d", i);
  94
+      continue;
  95
+    }
  96
+    if(t->duration > duration)
  97
+      duration = t->duration;
  98
+
  99
+    buffer.push_back(t);
  100
+  }
  101
+
  102
+  if(main)
  103
+    duration = duration * MAIN_TITLE_LENGTH_PERCENT / 100;
  104
+  else
  105
+    duration = 0;
  106
+
  107
+  for(std::vector<BLURAY_TITLE_INFO*>::iterator it = buffer.begin(); it != buffer.end(); ++it)
  108
+  {
  109
+    if((*it)->duration < duration)
  110
+      continue;
  111
+    items.Add(GetTitle(*it, main ? g_localizeStrings.Get(25004) /* Main Title */ : g_localizeStrings.Get(25005) /* Title */));
  112
+  }
  113
+
  114
+
  115
+  for(std::vector<BLURAY_TITLE_INFO*>::iterator it = buffer.begin(); it != buffer.end(); ++it)
  116
+    m_dll->bd_free_title_info(*it);
  117
+}
  118
+
  119
+void CBlurayDirectory::GetRoot(CFileItemList &items)
  120
+{
  121
+    GetTitles(true, items);
  122
+
  123
+    CURL path(m_url);
  124
+    CFileItemPtr item;
  125
+
  126
+    path.SetFileName(URIUtils::AddFileToFolder(m_url.GetFileName(), "titles"));
  127
+    item.reset(new CFileItem());
  128
+    item->SetPath(path.Get());
  129
+    item->m_bIsFolder = true;
  130
+    item->SetLabel(g_localizeStrings.Get(25002) /* All titles */);
  131
+    item->SetIconImage("DefaultVideoPlaylists.png");
  132
+    items.Add(item);
  133
+
  134
+    path.SetFileName("BDMV/MovieObject.bdmv");
  135
+    item.reset(new CFileItem());
  136
+    item->SetPath(path.Get());
  137
+    item->m_bIsFolder = false;
  138
+    item->SetLabel(g_localizeStrings.Get(25003) /* Menus */);
  139
+    item->SetIconImage("DefaultProgram.png");
  140
+    items.Add(item);
  141
+}
  142
+
  143
+bool CBlurayDirectory::GetDirectory(const CStdString& path, CFileItemList &items)
  144
+{
  145
+  Dispose();
  146
+  m_url.Parse(path);
  147
+  CStdString root = m_url.GetHostName();
  148
+  CStdString file = m_url.GetFileName();
  149
+  URIUtils::RemoveSlashAtEnd(file);
  150
+
  151
+  m_dll = new DllLibbluray();
  152
+  if (!m_dll->Load())
  153
+  {
  154
+    CLog::Log(LOGERROR, "CBlurayDirectory::GetDirectory - failed to load dll");
  155
+    return false;
  156
+  }
  157
+
  158
+  m_dll->bd_register_dir(DllLibbluray::dir_open);
  159
+  m_dll->bd_register_file(DllLibbluray::file_open);
  160
+  m_dll->bd_set_debug_handler(DllLibbluray::bluray_logger);
  161
+  m_dll->bd_set_debug_mask(DBG_CRIT | DBG_BLURAY | DBG_NAV);
  162
+
  163
+  m_bd = m_dll->bd_open(root.c_str(), NULL);
  164
+
  165
+  if(!m_bd)
  166
+  {
  167
+    CLog::Log(LOGERROR, "CBlurayDirectory::GetDirectory - failed to open %s", root.c_str());
  168
+    return false;
  169
+  }
  170
+
  171
+  if(file == "")
  172
+    GetRoot(items);
  173
+  else if(file == "titles")
  174
+    GetTitles(false, items);
  175
+  else
  176
+    return false;
  177
+
  178
+  items.AddSortMethod(SORT_METHOD_TRACKNUM , 554, LABEL_MASKS("%L", "%D", "%L", ""));    // FileName, Duration | Foldername, empty
  179
+  items.AddSortMethod(SORT_METHOD_SIZE     , 553, LABEL_MASKS("%L", "%I", "%L", "%I"));  // FileName, Size | Foldername, Size
  180
+
  181
+  return true;
  182
+}
  183
+
  184
+
  185
+} /* namespace XFILE */
53  xbmc/filesystem/BlurayDirectory.h
... ...
@@ -0,0 +1,53 @@
  1
+#pragma once
  2
+
  3
+/*
  4
+ *      Copyright (C) 2005-2008 Team XBMC
  5
+ *      http://www.xbmc.org
  6
+ *
  7
+ *  This Program is free software; you can redistribute it and/or modify
  8
+ *  it under the terms of the GNU General Public License as published by
  9
+ *  the Free Software Foundation; either version 2, or (at your option)
  10
+ *  any later version.
  11
+ *
  12
+ *  This Program is distributed in the hope that it will be useful,
  13
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15
+ *  GNU General Public License for more details.
  16
+ *
  17
+ *  You should have received a copy of the GNU General Public License
  18
+ *  along with XBMC; see the file COPYING.  If not, write to
  19
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20
+ *  http://www.gnu.org/copyleft/gpl.html
  21
+ *
  22
+ */
  23
+
  24
+#include "Directory.h"
  25
+#include "FileItem.h"
  26
+#include "URL.h"
  27
+
  28
+class  DllLibbluray;
  29
+typedef struct bluray BLURAY;
  30
+typedef struct bd_title_info BLURAY_TITLE_INFO;
  31
+
  32
+namespace XFILE
  33
+{
  34
+
  35
+class CBlurayDirectory: public XFILE::IDirectory
  36
+{
  37
+public:
  38
+  CBlurayDirectory();
  39
+  virtual ~CBlurayDirectory();
  40
+  virtual bool GetDirectory(const CStdString& path, CFileItemList &items);
  41
+
  42
+private:
  43
+
  44
+  void         Dispose();
  45
+  void         GetRoot  (CFileItemList &items);
  46
+  void         GetTitles(bool main, CFileItemList &items);
  47
+  CFileItemPtr GetTitle(const BLURAY_TITLE_INFO* title, const CStdString& label);
  48
+  CURL          m_url;
  49
+  DllLibbluray* m_dll;
  50
+  BLURAY*       m_bd;
  51
+};
  52
+
  53
+}
6  xbmc/filesystem/DirectoryFactory.cpp
@@ -100,6 +100,9 @@
100 100
 #ifdef HAS_FILESYSTEM_AFP
101 101
 #include "AFPDirectory.h"
102 102
 #endif
  103
+#ifdef HAVE_LIBBLURAY
  104
+#include "BlurayDirectory.h"
  105
+#endif
103 106
 
104 107
 using namespace XFILE;
105 108
 
@@ -198,6 +201,9 @@ IDirectory* CDirectoryFactory::Create(const CStdString& strPath)
198 201
 #ifdef HAS_FILESYSTEM_AFP
199 202
       if (strProtocol == "afp") return new CAFPDirectory();
200 203
 #endif
  204
+#ifdef HAVE_LIBBLURAY
  205
+      if (strProtocol == "bluray") return new CBlurayDirectory();
  206
+#endif
201 207
   }
202 208
 
203 209
   CLog::Log(LOGWARNING, "%s - Unsupported protocol(%s) in %s", __FUNCTION__, strProtocol.c_str(), url.Get().c_str() );
4  xbmc/filesystem/Makefile.in
@@ -112,6 +112,10 @@ SRCS+=AFPFile.cpp
112 112
 SRCS+=AFPDirectory.cpp
113 113
 endif
114 114
 
  115
+ifeq (@HAVE_LIBBLURAY@,1)
  116
+SRCS+=BlurayDirectory.cpp
  117
+endif
  118
+
115 119
 INCLUDES+=-I@abs_top_srcdir@/lib/libUPnP/Platinum/Source/Core \
116 120
           -I@abs_top_srcdir@/lib/libUPnP/Platinum/Source/Platinum \
117 121
           -I@abs_top_srcdir@/lib/libUPnP/Platinum/Source/Devices/MediaServer \
8  xbmc/utils/URIUtils.cpp
@@ -231,7 +231,8 @@ void URIUtils::GetCommonPath(CStdString& strParent, const CStdString& strPath)
231 231
 bool URIUtils::ProtocolHasParentInHostname(const CStdString& prot)
232 232
 {
233 233
   return prot.Equals("zip")
234  
-      || prot.Equals("rar");
  234
+      || prot.Equals("rar")
  235
+      || prot.Equals("bluray");
235 236
 }
236 237
 
237 238
 bool URIUtils::ProtocolHasEncodedHostname(const CStdString& prot)
@@ -777,6 +778,11 @@ bool URIUtils::IsLastFM(const CStdString& strFile)
777 778
   return strFile.Left(7).Equals("lastfm:");
778 779
 }
779 780
 
  781
+bool URIUtils::IsBluray(const CStdString& strFile)
  782
+{
  783
+  return strFile.Left(7).Equals("bluray:");
  784
+}
  785
+
780 786
 bool URIUtils::IsDOSPath(const CStdString &path)
781 787
 {
782 788
   if (path.size() > 1 && path[1] == ':' && isalpha(path[0]))
1  xbmc/utils/URIUtils.h
@@ -88,6 +88,7 @@ class URIUtils
88 88
   static bool IsVideoDb(const CStdString& strFile);
89 89
   static bool IsVTP(const CStdString& strFile);
90 90
   static bool IsZIP(const CStdString& strFile);
  91
+  static bool IsBluray(const CStdString& strFile);
91 92
 
92 93
   static void AddSlashAtEnd(CStdString& strFolder);
93 94
   static bool HasSlashAtEnd(const CStdString& strFile);
74  xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -1048,6 +1048,77 @@ bool CGUIWindowVideoBase::ShowResumeMenu(CFileItem &item)
1048 1048
   return true;
1049 1049
 }
1050 1050
 
  1051
+bool CGUIWindowVideoBase::ShowPlaySelection(CFileItemPtr& item)
  1052
+{
  1053
+  /* if asked to resume somewhere, we should not show anything */
  1054
+  if (item->m_lStartOffset)
  1055
+    return true;
  1056
+
  1057
+  if (item->IsBDFile())
  1058
+  {
  1059
+    CStdString root = URIUtils::GetParentPath(item->GetPath());
  1060
+    URIUtils::RemoveSlashAtEnd(root);
  1061
+    if(URIUtils::GetFileName(root) == "BDMV")
  1062
+    {
  1063
+      CURL url("bluray://");
  1064
+      url.SetHostName(URIUtils::GetParentPath(root));
  1065
+      return ShowPlaySelection(item, url.Get());
  1066
+    }
  1067
+  }
  1068
+
  1069
+  return true;
  1070
+}
  1071
+
  1072
+bool CGUIWindowVideoBase::ShowPlaySelection(CFileItemPtr& item, const CStdString& directory)
  1073
+{
  1074
+
  1075
+  CFileItemList items;
  1076
+
  1077
+  if (!XFILE::CDirectory::GetDirectory(directory, items, XFILE::CDirectory::CHints(), true))
  1078
+  {
  1079
+    CLog::Log(LOGERROR, "CGUIWindowVideoBase::ShowPlaySelection - Failed to get play directory for %s", directory.c_str());
  1080
+    return true;
  1081
+  }
  1082
+
  1083
+  if (items.Size() == 0)
  1084
+  {
  1085
+    CLog::Log(LOGERROR, "CGUIWindowVideoBase::ShowPlaySelection - Failed to get any items %s", directory.c_str());
  1086
+    return true;
  1087
+  }
  1088
+
  1089
+  CGUIDialogSelect* dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
  1090
+  while(true)
  1091
+  {
  1092
+    dialog->Reset();
  1093
+    dialog->SetHeading(25006 /* Select playback item */);
  1094
+    dialog->SetItems(&items);
  1095
+    dialog->SetUseDetails(true);
  1096
+    dialog->DoModal();
  1097
+
  1098
+    CFileItemPtr item_new = dialog->GetSelectedItem();
  1099
+    if(!item_new || dialog->GetSelectedLabel() < 0)
  1100
+    {
  1101
+      CLog::Log(LOGDEBUG, "CGUIWindowVideoBase::ShowPlaySelection - User aborted %s", directory.c_str());
  1102
+      break;
  1103
+    }
  1104
+
  1105
+    if(item_new->m_bIsFolder == false)
  1106
+    {
  1107
+      item = item_new;
  1108
+      return true;
  1109
+    }
  1110
+
  1111
+    items.Clear();
  1112
+    if(!XFILE::CDirectory::GetDirectory(item_new->GetPath(), items, XFILE::CDirectory::CHints(), true) || items.Size() == 0)
  1113
+    {
  1114
+      CLog::Log(LOGERROR, "CGUIWindowVideoBase::ShowPlaySelection - Failed to get any items %s", item_new->GetPath().c_str());
  1115
+      break;
  1116
+    }
  1117
+  }
  1118
+
  1119
+  return false;
  1120
+}
  1121
+
1051 1122
 bool CGUIWindowVideoBase::OnResumeItem(int iItem)
1052 1123
 {
1053 1124
   if (iItem < 0 || iItem >= m_vecItems->Size()) return true;
@@ -1418,6 +1489,9 @@ void CGUIWindowVideoBase::PlayMovie(const CFileItem *item)
1418 1489
 {
1419 1490
   CFileItemPtr movieItem(new CFileItem(*item));
1420 1491
 
  1492
+  if(!ShowPlaySelection(movieItem))
  1493
+    return;
  1494
+
1421 1495
   g_playlistPlayer.Reset();
1422 1496
   g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
1423 1497
   CPlayList& playlist = g_playlistPlayer.GetPlaylist(PLAYLIST_VIDEO);
5  xbmc/video/windows/GUIWindowVideoBase.h
@@ -43,6 +43,11 @@ class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObse
43 43
   static void MarkWatched(const CFileItemPtr &pItem, bool bMark);
44 44
   static void UpdateVideoTitle(const CFileItem* pItem);
45 45
 
  46
+  /*! \brief Show dialog allowing selection of wanted playback item */
  47
+  static bool ShowPlaySelection(CFileItemPtr& item);
  48
+  static bool ShowPlaySelection(CFileItemPtr& item, const CStdString& directory);
  49
+
  50
+
46 51
   /*! \brief Show the resume menu for this item (if it has a resume bookmark)
47 52
    If a resume bookmark is found, we set the item's m_lStartOffset to STARTOFFSET_RESUME
48 53
    \param item item to check for a resume bookmark
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.