From 3fd039c16184d5864c8a3be561c8b547b52ddf83 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Sun, 19 Jul 2009 08:38:49 +0200 Subject: 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. --- libass/ass.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libass/ass.h') diff --git a/libass/ass.h b/libass/ass.h index 6efcc0f..b92960a 100644 --- a/libass/ass.h +++ b/libass/ass.h @@ -201,6 +201,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 -- cgit v1.2.3