diff options
author | elupus <elupus@xbmc.org> | 2011-03-25 18:57:10 +0100 |
---|---|---|
committer | elupus <elupus@xbmc.org> | 2011-03-25 20:04:35 +0100 |
commit | 35a65cdfc92a8f6b592ccbb5343b9c5abefe3b08 (patch) | |
tree | 00afc9cda02f63585f5ae0e63687110e66dea997 | |
parent | 0353b967402add5f4e1da8c17c827db3a0e4c011 (diff) |
changed: no other seeks are supported for the cache strategies than absolute, so drop the parameter
-rw-r--r-- | xbmc/filesystem/CacheCircular.cpp | 5 | ||||
-rw-r--r-- | xbmc/filesystem/CacheCircular.h | 2 | ||||
-rw-r--r-- | xbmc/filesystem/CacheMemBuffer.cpp | 9 | ||||
-rw-r--r-- | xbmc/filesystem/CacheMemBuffer.h | 2 | ||||
-rw-r--r-- | xbmc/filesystem/CacheStrategy.cpp | 11 | ||||
-rw-r--r-- | xbmc/filesystem/CacheStrategy.h | 4 | ||||
-rw-r--r-- | xbmc/filesystem/FileCache.cpp | 2 |
7 files changed, 9 insertions, 26 deletions
diff --git a/xbmc/filesystem/CacheCircular.cpp b/xbmc/filesystem/CacheCircular.cpp index 16b143d58c..cdecd61679 100644 --- a/xbmc/filesystem/CacheCircular.cpp +++ b/xbmc/filesystem/CacheCircular.cpp @@ -190,11 +190,8 @@ int64_t CCacheCircular::WaitForData(unsigned int minumum, unsigned int millis) return avail; } -int64_t CCacheCircular::Seek(int64_t pos, int iWhence) +int64_t CCacheCircular::Seek(int64_t pos) { - if (iWhence != SEEK_SET) - return CACHE_RC_ERROR; - CSingleLock lock(m_sync); // if seek is a bit over what we have, try to wait a few seconds for the data to be available. diff --git a/xbmc/filesystem/CacheCircular.h b/xbmc/filesystem/CacheCircular.h index 237bb9a746..9606a9e883 100644 --- a/xbmc/filesystem/CacheCircular.h +++ b/xbmc/filesystem/CacheCircular.h @@ -41,7 +41,7 @@ public: virtual int ReadFromCache(char *buf, size_t len) ; virtual int64_t WaitForData(unsigned int minimum, unsigned int iMillis) ; - virtual int64_t Seek(int64_t pos, int iWhence) ; + virtual int64_t Seek(int64_t pos) ; virtual void Reset(int64_t pos) ; protected: diff --git a/xbmc/filesystem/CacheMemBuffer.cpp b/xbmc/filesystem/CacheMemBuffer.cpp index e0ed84e27d..f7c8b94aa3 100644 --- a/xbmc/filesystem/CacheMemBuffer.cpp +++ b/xbmc/filesystem/CacheMemBuffer.cpp @@ -144,15 +144,8 @@ int64_t CacheMemBuffer::WaitForData(unsigned int iMinAvail, unsigned int millis) return m_buffer.getMaxReadSize(); } -int64_t CacheMemBuffer::Seek(int64_t iFilePosition, int iWhence) +int64_t CacheMemBuffer::Seek(int64_t iFilePosition) { - if (iWhence != SEEK_SET) - { - // sanity. we should always get here with SEEK_SET - CLog::Log(LOGERROR, "%s, only SEEK_SET supported.", __FUNCTION__); - return CACHE_RC_ERROR; - } - CSingleLock lock(m_sync); // if seek is a bit over what we have, try to wait a few seconds for the data to be available. diff --git a/xbmc/filesystem/CacheMemBuffer.h b/xbmc/filesystem/CacheMemBuffer.h index 51c9b5d283..6ae480154d 100644 --- a/xbmc/filesystem/CacheMemBuffer.h +++ b/xbmc/filesystem/CacheMemBuffer.h @@ -45,7 +45,7 @@ public: virtual int ReadFromCache(char *pBuffer, size_t iMaxSize) ; virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) ; - virtual int64_t Seek(int64_t iFilePosition, int iWhence) ; + virtual int64_t Seek(int64_t iFilePosition) ; virtual void Reset(int64_t iSourcePosition) ; protected: diff --git a/xbmc/filesystem/CacheStrategy.cpp b/xbmc/filesystem/CacheStrategy.cpp index a23c5f3f9c..5bea4f527f 100644 --- a/xbmc/filesystem/CacheStrategy.cpp +++ b/xbmc/filesystem/CacheStrategy.cpp @@ -205,19 +205,12 @@ int64_t CSimpleFileCache::WaitForData(unsigned int iMinAvail, unsigned int iMill return CACHE_RC_TIMEOUT; } -int64_t CSimpleFileCache::Seek(int64_t iFilePosition, int iWhence) +int64_t CSimpleFileCache::Seek(int64_t iFilePosition) { CLog::Log(LOGDEBUG,"CSimpleFileCache::Seek, seeking to %"PRId64, iFilePosition); int64_t iTarget = iFilePosition - m_nStartPosition; - if (SEEK_END == iWhence) - { - CLog::Log(LOGERROR,"%s, cant seek relative to end", __FUNCTION__); - return CACHE_RC_ERROR; - } - else if (SEEK_CUR == iWhence) - iTarget = iFilePosition + m_nReadPosition; if (iTarget < 0) { @@ -227,7 +220,7 @@ int64_t CSimpleFileCache::Seek(int64_t iFilePosition, int iWhence) int64_t nDiff = iTarget - m_nWritePosition; if ( nDiff > 500000 || (nDiff > 0 && WaitForData((unsigned int)nDiff, 5000) == CACHE_RC_TIMEOUT) ) { - CLog::Log(LOGWARNING,"%s - attempt to seek pass read data (seek to %"PRId64". max: %"PRId64". reset read pointer. (%"PRId64":%d)", __FUNCTION__, iTarget, m_nWritePosition, iFilePosition, iWhence); + CLog::Log(LOGWARNING,"%s - attempt to seek pass read data (seek to %"PRId64". max: %"PRId64". reset read pointer. (%"PRId64")", __FUNCTION__, iTarget, m_nWritePosition, iFilePosition); return CACHE_RC_ERROR; } diff --git a/xbmc/filesystem/CacheStrategy.h b/xbmc/filesystem/CacheStrategy.h index 26971cfc98..1958990fe9 100644 --- a/xbmc/filesystem/CacheStrategy.h +++ b/xbmc/filesystem/CacheStrategy.h @@ -62,7 +62,7 @@ public: virtual int ReadFromCache(char *pBuffer, size_t iMaxSize) = 0; virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) = 0; - virtual int64_t Seek(int64_t iFilePosition, int iWhence) = 0; + virtual int64_t Seek(int64_t iFilePosition) = 0; virtual void Reset(int64_t iSourcePosition) = 0; virtual void EndOfInput(); // mark the end of the input stream so that Read will know when to return EOF @@ -90,7 +90,7 @@ public: virtual int ReadFromCache(char *pBuffer, size_t iMaxSize) ; virtual int64_t WaitForData(unsigned int iMinAvail, unsigned int iMillis) ; - virtual int64_t Seek(int64_t iFilePosition, int iWhence); + virtual int64_t Seek(int64_t iFilePosition); virtual void Reset(int64_t iSourcePosition); virtual void EndOfInput(); virtual ICacheInterface* GetInterface() { return (ICacheInterface*)this; } diff --git a/xbmc/filesystem/FileCache.cpp b/xbmc/filesystem/FileCache.cpp index e5844a75bc..d19d58ce9b 100644 --- a/xbmc/filesystem/FileCache.cpp +++ b/xbmc/filesystem/FileCache.cpp @@ -292,7 +292,7 @@ int64_t CFileCache::Seek(int64_t iFilePosition, int iWhence) if (iTarget == m_readPos) return m_readPos; - if ((m_nSeekResult = m_pCache->Seek(iTarget, SEEK_SET)) != iTarget) + if ((m_nSeekResult = m_pCache->Seek(iTarget)) != iTarget) { if(m_seekPossible == 0) return m_nSeekResult; |