#include <osdimagecache.h>
Definition at line 41 of file osdimagecache.h.
Public Member Functions | |
| OSDImageCache () | |
| Constructor, initializes the internal cache structures. | |
| virtual | ~OSDImageCache () |
| Destructor, frees all cached OSD images. | |
| bool | InFileCache (const QString &key) const |
| bool | Contains (const QString &key, bool useFile) const |
| Returns true if cached OSD image was found in the cache. | |
| OSDImageCacheValue * | Get (const QString &key, bool useFile) |
| Returns OSD image data from cache. | |
| void | Insert (OSDImageCacheValue *value) |
| Inserts OSD image data to memory cache. | |
| void | SaveToDisk (const OSDImageCacheValue *value) |
| Saves OSD image data to disk cache. | |
| void | Reset (void) |
Static Public Member Functions | |
| static QString | CreateKey (const QString &filename, float wmult, float hmult, int scalew, int scaleh) |
| Generates a cache key from the given OSD image parameters. | |
| static QString | ExtractOriginal (const QString &key) |
Private Attributes | |
| QMutex | m_cacheLock |
| img_cache_t | m_imageCache |
| int | m_memHits |
| int | m_diskHits |
| int | m_misses |
Static Private Attributes | |
| static uint | kMaximumMemoryCacheSize = 5 * 1024 * 1024 |
| Limit on the maximum total size of OSD images cached in *memory*. | |
| OSDImageCache::OSDImageCache | ( | ) |
Constructor, initializes the internal cache structures.
Definition at line 65 of file osdimagecache.cpp.
| OSDImageCache::~OSDImageCache | ( | ) | [virtual] |
| bool OSDImageCache::InFileCache | ( | const QString & | key | ) | const |
Definition at line 117 of file osdimagecache.cpp.
Referenced by Contains(), Get(), and SaveToDisk().
Returns true if cached OSD image was found in the cache.
| key | The key for this image. | |
| useFile | If true, also look from the disk cache. |
Definition at line 104 of file osdimagecache.cpp.
| OSDImageCacheValue * OSDImageCache::Get | ( | const QString & | key, | |
| bool | useFile | |||
| ) |
Returns OSD image data from cache.
This also removes the image from the cache so it won't be deleted while in use. The deletion of the taken item becomes responsibility of the client. Returns NULL if item with the given key is not found.
| key | The key for this image. | |
| useFile | If true, also check the disk cache. |
Definition at line 157 of file osdimagecache.cpp.
Referenced by OSDTypeImage::Load().
| void OSDImageCache::Insert | ( | OSDImageCacheValue * | value | ) |
Inserts OSD image data to memory cache.
The item becomes property of the OSDImageCache and may be deleted any time by it.
| value | The cache item. |
Definition at line 218 of file osdimagecache.cpp.
Referenced by OSDTypeImage::Load().
| void OSDImageCache::SaveToDisk | ( | const OSDImageCacheValue * | value | ) |
Saves OSD image data to disk cache.
Item is not written to the memory cache, i.e., it stays as property of the client.
| value | The cached OSD image to save. |
Definition at line 240 of file osdimagecache.cpp.
Referenced by OSDTypeImage::Load().
| void OSDImageCache::Reset | ( | void | ) |
| QString OSDImageCache::CreateKey | ( | const QString & | filename, | |
| float | wmult, | |||
| float | hmult, | |||
| int | scalew, | |||
| int | scaleh | |||
| ) | [static] |
Generates a cache key from the given OSD image parameters.
The returned key is a string that can be safely used as a file name.
Definition at line 275 of file osdimagecache.cpp.
Referenced by OSDTypeImage::Load().
| QString OSDImageCache::ExtractOriginal | ( | const QString & | key | ) | [static] |
QMutex OSDImageCache::m_cacheLock [mutable, private] |
Definition at line 66 of file osdimagecache.h.
Referenced by Contains(), Get(), Insert(), and Reset().
img_cache_t OSDImageCache::m_imageCache [private] |
Definition at line 67 of file osdimagecache.h.
Referenced by Contains(), Get(), Insert(), OSDImageCache(), Reset(), and ~OSDImageCache().
int OSDImageCache::m_memHits [private] |
int OSDImageCache::m_diskHits [private] |
int OSDImageCache::m_misses [private] |
uint OSDImageCache::kMaximumMemoryCacheSize = 5 * 1024 * 1024 [static, private] |
Limit on the maximum total size of OSD images cached in *memory*.
Definition at line 73 of file osdimagecache.h.
1.5.5