Skip to content

Commit

Permalink
SlideShow: fix playing multiple videos in a row
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta committed Nov 20, 2017
1 parent 2959217 commit 025a510
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
15 changes: 11 additions & 4 deletions xbmc/pictures/GUIWindowSlideShow.cpp
Expand Up @@ -383,7 +383,8 @@ void CGUIWindowSlideShow::Process(unsigned int currentTime, CDirtyRegionList &re
if (m_bSlideShow && !m_bPause && !g_application.IsInScreenSaver())
g_application.ResetScreenSaver();
int iSlides = m_slides.size();
if (!iSlides) return ;
if (!iSlides)
return;

// if we haven't processed yet, we should mark the whole screen
if (!HasProcessed())
Expand All @@ -404,11 +405,11 @@ void CGUIWindowSlideShow::Process(unsigned int currentTime, CDirtyRegionList &re
bool bSlideShow = m_bSlideShow && !m_bPause && !m_bPlayingVideo;
if (bSlideShow && m_slides.at(m_iCurrentSlide)->HasProperty("unplayable"))
{
m_iNextSlide = GetNextSlide();
m_iNextSlide = GetNextSlide();
if (m_iCurrentSlide == m_iNextSlide)
return;
m_iCurrentSlide = m_iNextSlide;
m_iNextSlide = GetNextSlide();
m_iNextSlide = GetNextSlide();
}

if (m_bErrorMessage)
Expand Down Expand Up @@ -518,7 +519,8 @@ void CGUIWindowSlideShow::Process(unsigned int currentTime, CDirtyRegionList &re
}
}

if (m_slides.at(m_iCurrentSlide)->IsVideo() && bSlideShow)
if (m_slides.at(m_iCurrentSlide)->IsVideo() &&
m_iVideoSlide != m_iCurrentSlide)
{
if (!PlayVideo())
return;
Expand Down Expand Up @@ -556,6 +558,7 @@ void CGUIWindowSlideShow::Process(unsigned int currentTime, CDirtyRegionList &re
if (g_application.m_pPlayer->IsPlayingVideo())
g_application.m_pPlayer->CloseFile();
m_bPlayingVideo = false;
m_iVideoSlide = -1;

// first time render the next image, make sure using current display effect.
if (!m_Image[1 - m_iCurrentPic].IsStarted())
Expand Down Expand Up @@ -986,6 +989,7 @@ bool CGUIWindowSlideShow::OnMessage(CGUIMessage& message)
if (m_bPlayingVideo)
{
m_bPlayingVideo = false;
m_iVideoSlide = -1;
if (m_bSlideShow)
m_bPause = true;
}
Expand All @@ -997,6 +1001,7 @@ bool CGUIWindowSlideShow::OnMessage(CGUIMessage& message)
if (m_bPlayingVideo)
{
m_bPlayingVideo = false;
m_iVideoSlide = -1;
if (m_bSlideShow)
{
m_bPause = false;
Expand Down Expand Up @@ -1093,6 +1098,7 @@ bool CGUIWindowSlideShow::PlayVideo()
return false;
CLog::Log(LOGDEBUG, "Playing current video slide %s", item->GetPath().c_str());
m_bPlayingVideo = true;
m_iVideoSlide = m_iCurrentSlide;
PlayBackRet ret = g_application.PlayFile(*item, "");
if (ret == PLAYBACK_OK)
return true;
Expand All @@ -1104,6 +1110,7 @@ bool CGUIWindowSlideShow::PlayVideo()
else if (ret == PLAYBACK_CANCELED)
m_bPause = true;
m_bPlayingVideo = false;
m_iVideoSlide = -1;
return false;
}

Expand Down
1 change: 1 addition & 0 deletions xbmc/pictures/GUIWindowSlideShow.h
Expand Up @@ -145,6 +145,7 @@ class CGUIWindowSlideShow : public CGUIDialog
bool m_bSlideShow;
bool m_bPause;
bool m_bPlayingVideo;
int m_iVideoSlide = -1;
bool m_bErrorMessage;

std::vector<CFileItemPtr> m_slides;
Expand Down

0 comments on commit 025a510

Please sign in to comment.