Permalink
Browse files

dvdplayer: make sure we can also abort the open of a ffmpeg input stream

  • Loading branch information...
elupus committed Apr 7, 2013
1 parent 32ff8bd commit 21af8ba69a6b7301ea2d64ee37c7836fa077c722
@@ -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"
@@ -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;
}
@@ -26,6 +26,7 @@ CDVDInputStreamFFmpeg::CDVDInputStreamFFmpeg()
: CDVDInputStream(DVDSTREAM_TYPE_FFMPEG)
, m_can_pause(false)
, m_can_seek(false)
+ , m_aborted(false)
{
}
@@ -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)
@@ -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)
@@ -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;
};
@@ -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

0 comments on commit 21af8ba

Please sign in to comment.