2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "CacheStrategy.h"
14 #include "threads/CriticalSection.h"
15 #include "threads/Thread.h"
23 class CFileCache
: public IFile
, public CThread
26 explicit CFileCache(const unsigned int flags
);
27 ~CFileCache() override
;
30 void Process() override
;
31 void OnExit() override
;
32 void StopThread(bool bWait
= true) override
;
35 bool Open(const CURL
& url
) override
;
36 void Close() override
;
37 bool Exists(const CURL
& url
) override
;
38 int Stat(const CURL
& url
, struct __stat64
* buffer
) override
;
40 ssize_t
Read(void* lpBuf
, size_t uiBufSize
) override
;
42 int64_t Seek(int64_t iFilePosition
, int iWhence
) override
;
43 int64_t GetPosition() override
;
44 int64_t GetLength() override
;
46 int IoControl(EIoControl request
, void* param
) override
;
50 const std::string
GetProperty(XFILE::FileProperty type
, const std::string
&name
= "") const override
;
52 const std::vector
<std::string
> GetPropertyValues(XFILE::FileProperty type
, const std::string
& name
= "") const override
54 return std::vector
<std::string
>();
58 std::unique_ptr
<CCacheStrategy
> m_pCache
;
61 std::string m_sourcePath
;
64 int64_t m_nSeekResult
;
70 uint32_t m_writeRateActual
;
71 uint32_t m_writeRateLowSpeed
;
72 int64_t m_forwardCacheSize
;
74 std::atomic
<int64_t> m_fileSize
;
76 CCriticalSection m_sync
;