diff options
author | jmarshallnz <jcmarsha@gmail.com> | 2014-04-27 08:41:57 +1200 |
---|---|---|
committer | Jonathan Marshall <jmarshall@xbmc.org> | 2014-04-27 16:54:50 +1200 |
commit | 246d78614ead21795ae1abe3cc1151f004e5105f (patch) | |
tree | 91940053cb817a42ec8c44a347966ee715dbc8db | |
parent | ebb87374c1a25af448e3dcc44a15567a16f39fc6 (diff) |
Merge pull request #4594 from FernetMenta/paplayer
paplayer: proper handling of non seekable streams
-rw-r--r-- | xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFile.cpp | 2 | ||||
-rw-r--r-- | xbmc/cores/paplayer/DVDPlayerCodec.cpp | 22 | ||||
-rw-r--r-- | xbmc/cores/paplayer/DVDPlayerCodec.h | 1 |
3 files changed, 20 insertions, 5 deletions
diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFile.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFile.cpp index 122e92297c..1b0f7e8460 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFile.cpp +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFile.cpp @@ -91,7 +91,7 @@ bool CDVDInputStreamFile::Open(const char* strFile, const std::string& content) if (m_pFile->GetImplemenation() && (content.empty() || content == "application/octet-stream")) m_content = m_pFile->GetImplemenation()->GetContent(); - m_eof = true; + m_eof = false; return true; } diff --git a/xbmc/cores/paplayer/DVDPlayerCodec.cpp b/xbmc/cores/paplayer/DVDPlayerCodec.cpp index 8e7b8f5dea..c60abc860c 100644 --- a/xbmc/cores/paplayer/DVDPlayerCodec.cpp +++ b/xbmc/cores/paplayer/DVDPlayerCodec.cpp @@ -193,8 +193,19 @@ bool DVDPlayerCodec::Init(const CStdString &strFile, unsigned int filecache) return false; } - // rewind stream to beginning - Seek(0); + // test if seeking is supported + if (Seek(1) != DVD_NOPTS_VALUE) + { + // rewind stream to beginning + Seek(0); + m_bCanSeek = true; + } + else + { + m_pInputStream->Seek(0, SEEK_SET); + m_pDemuxer->Reset(); + m_bCanSeek = false; + } if (m_Channels == 0) // no data - just guess and hope for the best m_Channels = 2; @@ -263,12 +274,15 @@ int64_t DVDPlayerCodec::Seek(int64_t iSeekTime) CDVDDemuxUtils::FreeDemuxPacket(m_pPacket); m_pPacket = NULL; - m_pDemuxer->SeekTime((int)iSeekTime, false); + bool ret = m_pDemuxer->SeekTime((int)iSeekTime, false); m_pAudioCodec->Reset(); m_decoded = NULL; m_nDecodedLen = 0; + if (!ret) + return DVD_NOPTS_VALUE; + return iSeekTime; } @@ -350,5 +364,5 @@ bool DVDPlayerCodec::CanInit() bool DVDPlayerCodec::CanSeek() { - return true; + return m_bCanSeek; } diff --git a/xbmc/cores/paplayer/DVDPlayerCodec.h b/xbmc/cores/paplayer/DVDPlayerCodec.h index e098288117..5919925482 100644 --- a/xbmc/cores/paplayer/DVDPlayerCodec.h +++ b/xbmc/cores/paplayer/DVDPlayerCodec.h @@ -63,6 +63,7 @@ private: CAEChannelInfo m_ChannelInfo; bool m_bInited; + bool m_bCanSeek; }; #endif |