Skip to content

Commit

Permalink
Merge pull request xbmc#13073 from FernetMenta/del
Browse files Browse the repository at this point in the history
SlideShow: fix playing multiple videos in a row
  • Loading branch information
FernetMenta committed Nov 20, 2017
2 parents 30b5b59 + 025a510 commit 28cd2ec
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
5 changes: 4 additions & 1 deletion xbmc/cores/VideoPlayer/VideoPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,10 @@ bool CVideoPlayer::CloseFile(bool reopen)
// wait for the main thread to finish up
// since this main thread cleans up all other resources and threads
// we are done after the StopThread call
StopThread();
{
CSingleExit exitlock(g_graphicsContext);
StopThread();
}

m_Edl.Clear();

Expand Down
15 changes: 11 additions & 4 deletions xbmc/pictures/GUIWindowSlideShow.cpp
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 28cd2ec

Please sign in to comment.