[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / filesystem / FileCache.h
blobdf7c8396c9c9e9df9f2a801a7e95cee37e004239
1 /*
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.
7 */
9 #pragma once
11 #include "CacheStrategy.h"
12 #include "File.h"
13 #include "IFile.h"
14 #include "threads/CriticalSection.h"
15 #include "threads/Thread.h"
17 #include <atomic>
18 #include <memory>
20 namespace XFILE
23 class CFileCache : public IFile, public CThread
25 public:
26 explicit CFileCache(const unsigned int flags);
27 ~CFileCache() override;
29 // CThread methods
30 void Process() override;
31 void OnExit() override;
32 void StopThread(bool bWait = true) override;
34 // IFIle methods
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;
48 IFile *GetFileImp();
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>();
57 private:
58 std::unique_ptr<CCacheStrategy> m_pCache;
59 int m_seekPossible;
60 CFile m_source;
61 std::string m_sourcePath;
62 CEvent m_seekEvent;
63 CEvent m_seekEnded;
64 int64_t m_nSeekResult;
65 int64_t m_seekPos;
66 int64_t m_readPos;
67 int64_t m_writePos;
68 unsigned m_chunkSize;
69 uint32_t m_writeRate;
70 uint32_t m_writeRateActual;
71 uint32_t m_writeRateLowSpeed;
72 int64_t m_forwardCacheSize;
73 bool m_bFilling;
74 std::atomic<int64_t> m_fileSize;
75 unsigned int m_flags;
76 CCriticalSection m_sync;