Merge pull request #4624 from FernetMenta/paplayer
authorjmarshallnz <jcmarsha@gmail.com>
Thu, 1 May 2014 20:01:14 +0000 (08:01 +1200)
committerJonathan Marshall <jmarshall@xbmc.org>
Thu, 1 May 2014 20:03:03 +0000 (08:03 +1200)
paplayer: dvdplayercodec - check if seek is possible before trying to se...

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

index 1b0f7e8..122e922 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 = false;
+  m_eof = true;
   return true;
 }
 
index c60abc8..411d6bf 100644 (file)
@@ -194,17 +194,21 @@ bool DVDPlayerCodec::Init(const CStdString &strFile, unsigned int filecache)
   }
 
   // test if seeking is supported
-  if (Seek(1) != DVD_NOPTS_VALUE)
-  {
-    // rewind stream to beginning
-    Seek(0);
-    m_bCanSeek = true;
-  }
-  else
+  m_bCanSeek = false;
+  if (m_pInputStream->Seek(0, SEEK_POSSIBLE))
   {
+    // reset eof flag of stream, with eof set seek returns always success
     m_pInputStream->Seek(0, SEEK_SET);
-    m_pDemuxer->Reset();
-    m_bCanSeek = false;
+    if (Seek(1) != DVD_NOPTS_VALUE)
+    {
+      // rewind stream to beginning
+      Seek(0);
+    }
+    else
+    {
+      m_pInputStream->Seek(0, SEEK_SET);
+      m_pDemuxer->Reset();
+    }
   }
 
   if (m_Channels == 0) // no data - just guess and hope for the best