diff options
author | chriszero <zerov83@gmail.com> | 2015-04-04 15:10:52 +0200 |
---|---|---|
committer | chriszero <zerov83@gmail.com> | 2015-04-04 15:10:52 +0200 |
commit | 21ee9e67ff7029c099c9fd772d3dc3e23c955199 (patch) | |
tree | 254ecef54be3682aea55ff747f3d2912e5732faf /pictureCache.h | |
parent | b3a59b06a977129bd773ff46f4fd66e0057fb9cd (diff) | |
download | vdr-plugin-plex-21ee9e67ff7029c099c9fd772d3dc3e23c955199.tar.gz vdr-plugin-plex-21ee9e67ff7029c099c9fd772d3dc3e23c955199.tar.bz2 |
more skindesigner support
Diffstat (limited to 'pictureCache.h')
-rw-r--r-- | pictureCache.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/pictureCache.h b/pictureCache.h new file mode 100644 index 0000000..e63d44b --- /dev/null +++ b/pictureCache.h @@ -0,0 +1,67 @@ +#ifndef CPICTURECACHE_H +#define CPICTURECACHE_H + +#include <memory> +#include <iostream> +#include <fstream> +#include <deque> +#include <string> + +#include <vdr/thread.h> +#include <vdr/plugin.h> + +#include "viewGridNavigator.h" + +enum ImageResolution { + SD384, + SD480, + HD720, + HD1080 +}; + +class cPictureCache : public cThread +{ +private: + struct CacheInfo { + CacheInfo(std::string Uri, int Width, int Height, std::function<void(cGridElement*)> OnCached, cGridElement* Calle) { + uri = Uri; + width = Width; + height = Height; + onCached = OnCached; + calle = Calle; + }; + std::string uri; + int width; + int height; + std::function<void(cGridElement*)> onCached; + cGridElement* calle; + }; + cPictureCache(); + std::deque<CacheInfo> m_qImagesToLoad; + + + std::string FileName(std::string uri, int width); + + std::shared_ptr<std::istream> DownloadFile(std::string uri); + void SaveFileToDisk(std::shared_ptr<std::istream> file, std::string fileName); + std::string TranscodeUri(std::string uri, int width, int height); + + 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); +}; + +#endif // CPICTURECACHE_H |