Skip to content

Commit

Permalink
Re-factored FileItem to support IsResumePointSet() and GetCurrentResu…
Browse files Browse the repository at this point in the history
…meTime()
  • Loading branch information
Fred Hoogduin committed May 17, 2014
1 parent 692cfba commit 75d3cbd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xbmc/Application.cpp
Expand Up @@ -4004,8 +4004,8 @@ PlayBackRet CApplication::PlayFile(const CFileItem& item, bool bRestart)
should the playerState be required, it is fetched from the database.
See the note in CGUIWindowVideoBase::ShowResumeMenu.
*/
if (item.HasVideoInfoTag() && item.GetVideoInfoTag()->m_resumePoint.IsSet())
options.starttime = item.GetVideoInfoTag()->m_resumePoint.timeInSeconds;
if (item.IsResumePointSet())
options.starttime = item.GetCurrentResumeTime();
}
else if (item.HasVideoInfoTag())
{
Expand Down
15 changes: 15 additions & 0 deletions xbmc/FileItem.cpp
Expand Up @@ -3320,3 +3320,18 @@ int CFileItem::GetVideoContentType() const
return type;
}


bool CFileItem::IsResumePointSet() const
{
return (HasVideoInfoTag() && GetVideoInfoTag()->m_resumePoint.IsSet());
}

double CFileItem::GetCurrentResumeTime() const
{
if (HasVideoInfoTag() && GetVideoInfoTag()->m_resumePoint.IsSet())
{
return GetVideoInfoTag()->m_resumePoint.timeInSeconds;
}
// Resume from start when resume point is invalid
return 0;
}
12 changes: 12 additions & 0 deletions xbmc/FileItem.h
Expand Up @@ -295,6 +295,18 @@ class CFileItem :
return m_pvrTimerInfoTag;
}

/*!
\brief Test if this item has a valid resume point set.
\return True if this item has a resume point and it is set, false otherwise.
*/
bool IsResumePointSet() const;

/*!
\brief Return the current resume time.
\return The time in seconds from the start to resume playing from.
*/
double GetCurrentResumeTime() const;

inline bool HasPictureInfoTag() const
{
return m_pictureInfoTag != NULL;
Expand Down

0 comments on commit 75d3cbd

Please sign in to comment.