summaryrefslogtreecommitdiffstats
path: root/libass/ass.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.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.h')
-rw-r--r--libass/ass.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libass/ass.h b/libass/ass.h
index 6efcc0f..b92960a 100644
--- a/libass/ass.h
+++ b/libass/ass.h
@@ -202,6 +202,17 @@ void ass_set_fonts(ass_renderer_t *priv, const char *default_font,
int ass_fonts_update(ass_renderer_t *priv);
/**
+ * \brief Set hard cache limits. Do not set, or set to zero, for reasonable
+ * defaults.
+ *
+ * \param priv renderer handle
+ * \param glyph_max maximum number of cached glyphs
+ * \param bitmap_max_size maximum bitmap cache size (in MB)
+ */
+void ass_set_cache_limits(ass_renderer_t *priv, int glyph_max,
+ int bitmap_max_size);
+
+/**
* \brief Render a frame, producing a list of ass_image_t.
* \param priv renderer handle
* \param track subtitle track