Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Resume DVDs

  • Loading branch information...
commit f7fbe3c3162a635ae2ce20f3737d9317963e5cfd 1 parent 67e7b08
Voyager-xbmc authored
View
5 xbmc/Application.cpp
@@ -3666,7 +3666,10 @@ bool CApplication::PlayFile(const CFileItem& item, bool bRestart)
{
options.starttime = 0.0f;
CBookmark bookmark;
- if(dbs.GetResumeBookMark(item.m_strPath, bookmark))
+ CStdString path = item.m_strPath;
+ if (item.IsDVD())
+ path = item.GetVideoInfoTag()->m_strFileNameAndPath;
+ if(dbs.GetResumeBookMark(path, bookmark))
{
options.starttime = bookmark.timeInSeconds;
options.state = bookmark.playerState;
View
20 xbmc/Autorun.cpp
@@ -52,7 +52,7 @@ CAutorun::CAutorun()
CAutorun::~CAutorun()
{}
-void CAutorun::ExecuteAutorun( bool bypassSettings, bool ignoreplaying )
+void CAutorun::ExecuteAutorun( bool bypassSettings, bool ignoreplaying, bool restart )
{
if ((!ignoreplaying && (g_application.IsPlayingAudio() || g_application.IsPlayingVideo() || g_windowManager.HasModalDialog())) || g_windowManager.GetActiveWindow() == WINDOW_LOGIN_SCREEN)
return ;
@@ -78,7 +78,7 @@ void CAutorun::ExecuteAutorun( bool bypassSettings, bool ignoreplaying )
}
else
{
- RunMedia(bypassSettings);
+ RunMedia(bypassSettings, restart);
}
}
@@ -99,7 +99,7 @@ void CAutorun::RunCdda()
g_playlistPlayer.Play();
}
-void CAutorun::RunMedia(bool bypassSettings)
+void CAutorun::RunMedia(bool bypassSettings, bool restart)
{
if ( !bypassSettings && !g_guiSettings.GetBool("audiocds.autorun") && !g_guiSettings.GetBool("dvds.autorun"))
return ;
@@ -108,7 +108,7 @@ void CAutorun::RunMedia(bool bypassSettings)
int nAddedToPlaylist = 0;
#ifdef _WIN32
auto_ptr<IDirectory> pDir ( CFactoryDirectory::Create( g_mediaManager.TranslateDevicePath("") ));
- bool bPlaying = RunDisc(pDir.get(), g_mediaManager.TranslateDevicePath(""), nAddedToPlaylist, true, bypassSettings);
+ bool bPlaying = RunDisc(pDir.get(), g_mediaManager.TranslateDevicePath(""), nAddedToPlaylist, true, bypassSettings, restart);
#else
CCdInfo* pInfo = g_mediaManager.GetCdInfo();
@@ -140,7 +140,7 @@ void CAutorun::RunMedia(bool bypassSettings)
/**
* This method tries to determine what type of disc is located in the given drive and starts to play the content appropriately.
*/
-bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAddedToPlaylist, bool bRoot, bool bypassSettings /* = false */)
+bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAddedToPlaylist, bool bRoot, bool bypassSettings /* = false */, bool restart /* = false */)
{
bool bPlaying(false);
CFileItemList vecItems;
@@ -178,7 +178,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
if (pItem->m_strPath.Find( "VIDEO_TS" ) != -1 && bAllowVideo
&& (bypassSettings || g_guiSettings.GetBool("dvds.autorun")))
{
- CUtil::PlayDVD();
+ CUtil::PlayDVD("dvd", restart);
bPlaying = true;
return true;
}
@@ -189,7 +189,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
if (pItem->m_strPath.Find( "BDMV" ) != -1 && bAllowVideo
&& (bypassSettings || g_guiSettings.GetBool("dvds.autorun")))
{
- CUtil::PlayDVD("bd");
+ CUtil::PlayDVD("bd", restart);
bPlaying = true;
return true;
}
@@ -320,7 +320,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
{
if (pItem->m_strPath != "." && pItem->m_strPath != ".." )
{
- if (RunDisc(pDir, pItem->m_strPath, nAddedToPlaylist, false, bypassSettings))
+ if (RunDisc(pDir, pItem->m_strPath, nAddedToPlaylist, false, bypassSettings, restart))
{
bPlaying = true;
break;
@@ -365,9 +365,9 @@ bool CAutorun::IsEnabled() const
return m_bEnable;
}
-bool CAutorun::PlayDisc()
+bool CAutorun::PlayDisc(bool restart)
{
- ExecuteAutorun(true,true);
+ ExecuteAutorun(true,true, restart);
return true;
}
View
8 xbmc/Autorun.h
@@ -47,16 +47,16 @@ class CAutorun
public:
CAutorun();
virtual ~CAutorun();
- static bool PlayDisc();
+ static bool PlayDisc(bool restart = false);
bool IsEnabled() const;
void Enable();
void Disable();
void HandleAutorun();
- static void ExecuteAutorun(bool bypassSettings = false, bool ignoreplaying=false);
+ static void ExecuteAutorun(bool bypassSettings = false, bool ignoreplaying = false, bool restart = false);
protected:
static void RunCdda();
- static void RunMedia(bool bypassSettings = false);
- static bool RunDisc(XFILE::IDirectory* pDir, const CStdString& strDrive, int& nAddedToPlaylist, bool bRoot, bool bypassSettings = false);
+ static void RunMedia(bool bypassSettings, bool restart);
+ static bool RunDisc(XFILE::IDirectory* pDir, const CStdString& strDrive, int& nAddedToPlaylist, bool bRoot, bool bypassSettings, bool restart);
bool m_bEnable;
};
}
View
5 xbmc/FileItem.cpp
@@ -215,6 +215,11 @@ CFileItem::CFileItem(const CMediaSource& share)
m_iDriveType = share.m_iDriveType;
m_strThumbnailImage = share.m_strThumbnailImage;
SetLabelPreformated(true);
+ if (IsDVD())
+ {
+ GetVideoInfoTag()->m_strFileNameAndPath = "removable://";
+ GetVideoInfoTag()->m_strFileNameAndPath += share.strStatus; // share.strStatus contains disc volume label
+ }
}
CFileItem::~CFileItem(void)
View
8 xbmc/Util.cpp
@@ -91,6 +91,7 @@
#include "cores/dvdplayer/DVDSubtitles/DVDSubtitleTagSami.h"
#include "cores/dvdplayer/DVDSubtitles/DVDSubtitleStream.h"
#include "windowing/WindowingFactory.h"
+#include "video/VideoInfoTag.h"
using namespace std;
using namespace XFILE;
@@ -755,7 +756,7 @@ bool CUtil::ThumbCached(const CStdString& strFileName)
return CThumbnailCache::GetThumbnailCache()->IsCached(strFileName);
}
-void CUtil::PlayDVD(const CStdString& strProtocol)
+void CUtil::PlayDVD(const CStdString& strProtocol, bool restart)
{
#if defined(HAS_DVDPLAYER) && defined(HAS_DVD_DRIVE)
CIoSupport::Dismount("Cdrom0");
@@ -764,7 +765,10 @@ void CUtil::PlayDVD(const CStdString& strProtocol)
strPath.Format("%s://1", strProtocol.c_str());
CFileItem item(strPath, false);
item.SetLabel(g_mediaManager.GetDiskLabel());
- g_application.PlayFile(item);
+ item.GetVideoInfoTag()->m_strFileNameAndPath = "removable://"; // need to put volume label for resume point in videoInfoTag
+ item.GetVideoInfoTag()->m_strFileNameAndPath += g_mediaManager.GetDiskLabel();
+ if (!restart) item.m_lStartOffset = STARTOFFSET_RESUME;
+ g_application.PlayFile(item, restart);
#endif
}
View
2  xbmc/Util.h
@@ -98,7 +98,7 @@ class CUtil
static bool ThumbCached(const CStdString& strFileName);
static void ThumbCacheAdd(const CStdString& strFileName, bool bFileExists);
static void ThumbCacheClear();
- static void PlayDVD(const CStdString& strProtocol="dvd");
+ static void PlayDVD(const CStdString& strProtocol = "dvd", bool restart = false);
static CStdString GetNextFilename(const CStdString &fn_template, int max);
static CStdString GetNextPathname(const CStdString &path_template, int max);
static void TakeScreenshot();
View
13 xbmc/dialogs/GUIDialogContextMenu.cpp
@@ -42,6 +42,7 @@
#include "settings/Settings.h"
#include "guilib/LocalizeStrings.h"
#include "TextureCache.h"
+#include "video/windows/GUIWindowVideoBase.h"
#ifdef _WIN32
#include "WIN32Util.h"
@@ -217,8 +218,14 @@ void CGUIDialogContextMenu::GetContextButtons(const CStdString &type, const CFil
if (item->IsDVD() || item->IsCDDA())
{
// We need to check if there is a detected is inserted!
- if ( g_mediaManager.IsDiscInDrive() )
+ if ( g_mediaManager.IsDiscInDrive() )
+ {
buttons.Add(CONTEXT_BUTTON_PLAY_DISC, 341); // Play CD/DVD!
+ if (CGUIWindowVideoBase::GetResumeItemOffset(item.get()) > 0)
+ {
+ buttons.Add(CONTEXT_BUTTON_RESUME_DISC, CGUIWindowVideoBase::GetResumeString(*(item.get()))); // Resume Disc
+ }
+ }
buttons.Add(CONTEXT_BUTTON_EJECT_DISC, 13391); // Eject/Load CD/DVD!
}
else // Must be HDD
@@ -312,6 +319,9 @@ bool CGUIDialogContextMenu::OnContextButton(const CStdString &type, const CFileI
#ifdef HAS_DVD_DRIVE
case CONTEXT_BUTTON_PLAY_DISC:
+ return MEDIA_DETECT::CAutorun::PlayDisc(true); // restart
+
+ case CONTEXT_BUTTON_RESUME_DISC:
return MEDIA_DETECT::CAutorun::PlayDisc();
case CONTEXT_BUTTON_EJECT_DISC:
@@ -693,4 +703,3 @@ void CGUIDialogContextMenu::PositionAtCurrentFocus()
// no control to center at, so just center the window
CenterWindow();
}
-
View
1  xbmc/dialogs/GUIDialogContextMenu.h
@@ -35,6 +35,7 @@ enum CONTEXT_BUTTON { CONTEXT_BUTTON_CANCELLED = 0,
CONTEXT_BUTTON_SETTINGS,
CONTEXT_BUTTON_GOTO_ROOT,
CONTEXT_BUTTON_PLAY_DISC,
+ CONTEXT_BUTTON_RESUME_DISC,
CONTEXT_BUTTON_RIP_CD,
CONTEXT_BUTTON_RIP_TRACK,
CONTEXT_BUTTON_EJECT_DISC,
View
3  xbmc/utils/SaveFileStateJob.h
@@ -25,6 +25,9 @@ bool CSaveFileStateJob::DoWork()
{
CStdString progressTrackingFile = m_item.m_strPath;
+ if (m_item.IsDVD())
+ progressTrackingFile = m_item.GetVideoInfoTag()->m_strFileNameAndPath; // this variable contains removable:// suffixed by disc label
+
if (progressTrackingFile != "")
{
if (m_item.IsVideo())
View
7 xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -852,7 +852,7 @@ int CGUIWindowVideoBase::GetResumeItemOffset(const CFileItem *item)
{
CBookmark bookmark;
CStdString strPath = item->m_strPath;
- if (item->IsVideoDb() && item->HasVideoInfoTag())
+ if ((item->IsVideoDb() || item->IsDVD()) && item->HasVideoInfoTag())
strPath = item->GetVideoInfoTag()->m_strFileNameAndPath;
if (db.GetResumeBookMark(strPath, bookmark))
@@ -990,7 +990,7 @@ CStdString CGUIWindowVideoBase::GetResumeString(CFileItem item)
{
CBookmark bookmark;
CStdString itemPath(item.m_strPath);
- if (item.IsVideoDb())
+ if (item.IsVideoDb() || item.IsDVD())
itemPath = item.GetVideoInfoTag()->m_strFileNameAndPath;
if (db.GetResumeBookMark(itemPath, bookmark) )
resumeString.Format(g_localizeStrings.Get(12022).c_str(), StringUtils::SecondsToTimeString(lrint(bookmark.timeInSeconds)).c_str());
@@ -1114,7 +1114,8 @@ void CGUIWindowVideoBase::GetContextButtons(int itemNumber, CContextButtons &but
// if autoresume is enabled then add restart video button
// check to see if the Resume Video button is applicable
- if (GetResumeItemOffset(item.get()) > 0)
+ // only if the video is NOT a DVD (in that case the resume button will be added by CGUIDialogContextMenu::GetContextButtons)
+ if (!item->IsDVD() && GetResumeItemOffset(item.get()) > 0)
{
buttons.Add(CONTEXT_BUTTON_RESUME_ITEM, GetResumeString(*(item.get()))); // Resume Video
}
View
12 xbmc/video/windows/GUIWindowVideoBase.h
@@ -62,6 +62,12 @@ class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObse
static void OnAssignContent(const CStdString &path, int iFound, ADDON::ScraperPtr& scraper, VIDEO::SScanSettings& settings);
+ /*! \brief checks the database for a resume position and puts together a string
+ \param item selected item
+ \return string containing the resume position or an empty string if there is no resume position
+ */
+ static CStdString GetResumeString(CFileItem item);
+
protected:
void OnScan(const CStdString& strPath, bool scanAll = false);
virtual void UpdateButtons();
@@ -92,11 +98,7 @@ class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObse
\return true if the action is performed, false otherwise
*/
bool OnFileAction(int item, int action);
- /*! \brief checks the database for a resume position and puts together a string
- \param item selected item
- \return string containing the resume position or an empty string if there is no resume position
- */
- static CStdString GetResumeString(CFileItem item);
+
void OnRestartItem(int iItem);
bool OnResumeItem(int iItem);
void PlayItem(int iItem);
Please sign in to comment.
Something went wrong with that request. Please try again.