summaryrefslogtreecommitdiffstats
path: root/sub/dec_sub.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-26 18:35:36 +0100
committerwm4 <wm4@nowhere>2015-12-26 18:35:36 +0100
commit190dea149aea07bc4be41c684a50db4231ccb0da (patch)
treeb4c164a1c741dd6c2283b3559d3b807b2ca8c226 /sub/dec_sub.c
parent8d4a179c144cb3e36762b2c3cef55d1d3bb9f951 (diff)
downloadmpv-190dea149aea07bc4be41c684a50db4231ccb0da.tar.bz2
mpv-190dea149aea07bc4be41c684a50db4231ccb0da.tar.xz
sub: destroy/recreate ASS_Renderer when disabling/enablings subs
Keeping ASS_Renderers around for a potentially large number of subtitle tracks could lead to excessive memory usage, especially since the libass cache is broken (caches even unneeded data), and might consume up to ~500MB of memory for no reason.
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r--sub/dec_sub.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index 0449fe8d05..a1f72d432b 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -301,6 +301,14 @@ void sub_reset(struct dec_sub *sub)
pthread_mutex_unlock(&sub->lock);
}
+void sub_select(struct dec_sub *sub, bool selected)
+{
+ pthread_mutex_lock(&sub->lock);
+ if (sub->sd && sub->sd->driver->select)
+ sub->sd->driver->select(sub->sd, selected);
+ pthread_mutex_unlock(&sub->lock);
+}
+
int sub_control(struct dec_sub *sub, enum sd_ctrl cmd, void *arg)
{
int r = CONTROL_UNKNOWN;