Merge pull request #4594 from FernetMenta/paplayer
authorjmarshallnz <jcmarsha@gmail.com>
Sat, 26 Apr 2014 20:41:57 +0000 (08:41 +1200)
committerJonathan Marshall <jmarshall@xbmc.org>
Sun, 27 Apr 2014 04:54:50 +0000 (16:54 +1200)
paplayer: proper handling of non seekable streams

xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamFile.cpp
xbmc/cores/paplayer/DVDPlayerCodec.cpp
xbmc/cores/paplayer/DVDPlayerCodec.h

index 122e922..1b0f7e8 100644 (file)
@@ -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;
 }
 
index 8e7b8f5..c60abc8 100644 (file)
@@ -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;
 }
index e098288..5919925 100644 (file)
@@ -63,6 +63,7 @@ private:
   CAEChannelInfo m_ChannelInfo;
 
   bool m_bInited;
+  bool m_bCanSeek;
 };
 
 #endif