Skip to content

Commit

Permalink
dvdplayer: make sure we can also abort the open of a ffmpeg input stream
Browse files Browse the repository at this point in the history
  • Loading branch information
elupus committed Apr 7, 2013
1 parent 32ff8bd commit 21af8ba
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
Expand Up @@ -35,6 +35,7 @@
#include "DVDInputStreams/DVDInputStreamBluray.h"
#endif
#include "DVDInputStreams/DVDInputStreamPVRManager.h"
#include "DVDInputStreams/DVDInputStreamFFmpeg.h"
#include "DVDDemuxUtils.h"
#include "DVDClock.h" // for DVD_TIME_BASE
#include "commons/Exception.h"
Expand Down Expand Up @@ -225,6 +226,10 @@ bool CDVDDemuxFFmpeg::Aborted()
if(m_timeout.IsTimePast())
return true;

CDVDInputStreamFFmpeg * input = dynamic_cast<CDVDInputStreamFFmpeg*>(m_pInput);
if(input && input->Aborted())
return true;

return false;
}

Expand Down
Expand Up @@ -26,6 +26,7 @@ CDVDInputStreamFFmpeg::CDVDInputStreamFFmpeg()
: CDVDInputStream(DVDSTREAM_TYPE_FFMPEG)
, m_can_pause(false)
, m_can_seek(false)
, m_aborted(false)
{

}
Expand All @@ -37,7 +38,10 @@ CDVDInputStreamFFmpeg::~CDVDInputStreamFFmpeg()

bool CDVDInputStreamFFmpeg::IsEOF()
{
return false;
if(m_aborted)
return true;
else
return false;
}

bool CDVDInputStreamFFmpeg::Open(const char* strFile, const std::string& content)
Expand All @@ -47,6 +51,7 @@ bool CDVDInputStreamFFmpeg::Open(const char* strFile, const std::string& content

m_can_pause = true;
m_can_seek = true;
m_aborted = false;

if(strnicmp(strFile, "udp://", 6) == 0
|| strnicmp(strFile, "rtp://", 6) == 0)
Expand Down
4 changes: 4 additions & 0 deletions xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFFmpeg.h
Expand Up @@ -37,10 +37,14 @@ class CDVDInputStreamFFmpeg
virtual bool IsEOF();
virtual int64_t GetLength();

virtual void Abort() { m_aborted = true; }
bool Aborted() { return m_aborted; }

bool CanSeek() { return m_can_seek; }
bool CanPause() { return m_can_pause; }

protected:
bool m_can_pause;
bool m_can_seek;
bool m_aborted;
};
3 changes: 3 additions & 0 deletions xbmc/cores/dvdplayer/DVDPlayer.cpp
Expand Up @@ -521,6 +521,9 @@ bool CDVDPlayer::CloseFile()
if(m_pSubtitleDemuxer)
m_pSubtitleDemuxer->Abort();

if(m_pInputStream)
m_pInputStream->Abort();

CLog::Log(LOGNOTICE, "DVDPlayer: waiting for threads to exit");

// wait for the main thread to finish up
Expand Down

0 comments on commit 21af8ba

Please sign in to comment.