Skip to content

Commit

Permalink
Fix support for jumping back when a comskip is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
bqq100 committed Jul 17, 2018
1 parent a9a7a20 commit 708cf61
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions xbmc/cores/VideoPlayer/Edl.cpp
Expand Up @@ -47,6 +47,7 @@ void CEdl::Clear()
m_vecSceneMarkers.clear();
m_iTotalCutTime = 0;
m_lastQueryTime = 0;
m_lastCutTime = 0;
}

bool CEdl::ReadEditDecisionLists(const std::string& strMovie, const float fFrameRate, const int iHeight)
Expand Down Expand Up @@ -848,6 +849,16 @@ int CEdl::GetLastQueryTime() const
return m_lastQueryTime;
}

int CEdl::GetLastCutTime() const
{
return m_lastCutTime;
}

void CEdl::SetLastCutTime(const int iCutTime)
{
m_lastCutTime = iCutTime;
}

bool CEdl::GetNearestCut(bool bPlus, const int iSeek, Cut *pCut) const
{
if (bPlus)
Expand Down
4 changes: 4 additions & 0 deletions xbmc/cores/VideoPlayer/Edl.h
Expand Up @@ -52,6 +52,9 @@ class CEdl
int GetTotalCutTime() const;
int RemoveCutTime(int iSeek) const;
int RestoreCutTime(int iClock) const;

int GetLastCutTime() const;
void SetLastCutTime(const int iCutTime);

bool InCut(int iSeek, Cut *pCut = NULL);
bool GetNearestCut(bool bPlus, const int iSeek, Cut *pCut) const;
Expand All @@ -66,6 +69,7 @@ class CEdl
std::vector<Cut> m_vecCuts;
std::vector<int> m_vecSceneMarkers;
int m_lastQueryTime;
int m_lastCutTime;

bool ReadEdl(const std::string& strMovie, const float fFramesPerSecond);
bool ReadComskip(const std::string& strMovie, const float fFramesPerSecond);
Expand Down
4 changes: 3 additions & 1 deletion xbmc/cores/VideoPlayer/VideoPlayer.cpp
Expand Up @@ -2367,11 +2367,13 @@ void CVideoPlayer::CheckAutoSceneSkip()
else if (cut.action == CEdl::COMM_BREAK)
{
// marker for commbrak may be inaccurate. allow user to skip into break from the back
if (GetPlaySpeed() >= 0 && lastPos <= cut.start && clock < cut.end - 1000)
if (GetPlaySpeed() >= 0 && m_Edl.GetLastCutTime() != cut.start && clock < cut.end - 1000)
{
std::string strTimeString = StringUtils::SecondsToTimeString((cut.end - cut.start) / 1000, TIME_FORMAT_MM_SS);
CGUIDialogKaiToast::QueueNotification(g_localizeStrings.Get(25011), strTimeString);

m_Edl.SetLastCutTime(cut.start);

if (m_SkipCommercials)
{
CLog::Log(LOGDEBUG, "%s - Clock in commercial break [%s - %s]: %s. Automatically skipping to end of commercial break",
Expand Down

0 comments on commit 708cf61

Please sign in to comment.