diff options
author | Christian <zerov83@gmail.com> | 2016-03-28 20:41:54 +0200 |
---|---|---|
committer | Christian <zerov83@gmail.com> | 2016-03-28 20:41:54 +0200 |
commit | bd3d480a94558344f0a55707bc59b181fc7ea943 (patch) | |
tree | d54aaa531c747df28950e0db542f9d9cb26874e0 /pictureCache.h | |
parent | 495f828b507611fafa49997adf7f2bda815cdcb8 (diff) | |
download | vdr-plugin-plex-bd3d480a94558344f0a55707bc59b181fc7ea943.tar.gz vdr-plugin-plex-bd3d480a94558344f0a55707bc59b181fc7ea943.tar.bz2 |
paralleling cPictureCache.
Multiple server connections now possible
Diffstat (limited to 'pictureCache.h')
-rw-r--r-- | pictureCache.h | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/pictureCache.h b/pictureCache.h index 51398e8..e259c6f 100644 --- a/pictureCache.h +++ b/pictureCache.h @@ -6,6 +6,7 @@ #include <fstream> #include <deque> #include <string> +#include <future> #include <vdr/thread.h> #include <vdr/plugin.h> @@ -19,7 +20,7 @@ enum ImageResolution { HD1080 }; -class cPictureCache : public cThread +class cPictureCache { private: struct CacheInfo { @@ -35,33 +36,28 @@ private: int height; std::function<void(cGridElement*)> onCached; cGridElement* calle; + bool downloaded; }; cPictureCache(); - std::deque<CacheInfo> m_qImagesToLoad; + std::map<std::string, bool> m_mCached; + std::vector<std::future<void>> m_vFutures; volatile bool m_bAllInvalidated; std::string FileName(std::string uri, int width); std::string TranscodeUri(std::string uri, int width, int height); - bool DownloadFileAndSave(std::string uri, std::string localFile); + static bool DownloadFileAndSave(std::string uri, std::string localFile); + bool Cached(std::string uri, int width); std::string m_cacheDir; -protected: - virtual void Action(); - public: static cPictureCache& GetInstance() { static cPictureCache instance; return instance; } - void Stop(); - bool Cached(std::string uri, int width); std::string GetPath(std::string uri, int width, int height, bool& cached, std::function<void(cGridElement*)> OnCached = NULL, cGridElement* calle = NULL); - void Remove(cGridElement* element); - void Remove(std::string uri); - void RemoveAll(); }; #endif // CPICTURECACHE_H |