summaryrefslogtreecommitdiffstats
path: root/libass/ass_cache.h
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@blackbox>2009-07-19 08:38:49 +0200
committerGrigori Goronzy <greg@blackbox>2009-07-19 15:56:23 +0200
commit3fd039c16184d5864c8a3be561c8b547b52ddf83 (patch)
tree4b7bc7aade51fece064d32276188278d9c6aae68 /libass/ass_cache.h
parent7690af4af50fda163ed724e8d0f3ce5d9a9ec552 (diff)
downloadlibass-3fd039c16184d5864c8a3be561c8b547b52ddf83.tar.bz2
libass-3fd039c16184d5864c8a3be561c8b547b52ddf83.tar.xz
Introduce simple cache memory management
libass' cache was basically unmanaged; it would grow without any limits, depending on how complex the subtitles are. Introduce a simple limiting that resets the cache if certain limits are exceeded. The bitmap cache is limited to approx. 50 MB size by default, while the glyph cache allows storing up to 1000 glyphs by default. A few tests with rather heavily softsubbed fansubs show that these limits are fine. The API was extended with the function ass_set_cache_limits which allows modification of these limits.
Diffstat (limited to 'libass/ass_cache.h')
-rw-r--r--libass/ass_cache.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/libass/ass_cache.h b/libass/ass_cache.h
index 83c9943..e31d8cf 100644
--- a/libass/ass_cache.h
+++ b/libass/ass_cache.h
@@ -45,6 +45,7 @@ typedef struct hashmap_s {
hashmap_item_dtor_t item_dtor; // a destructor for hashmap key/value pairs
hashmap_key_compare_t key_compare;
hashmap_hash_t hash;
+ size_t cache_size;
// stats
int hit_count;
int miss_count;