From 87718384082a88a660f66d2de30421a93bf67293 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 13 Jul 2015 23:11:54 +0200 Subject: sub: call ass_set_fonts() only once ass_set_fonts() is called by mp_ass_configure_fonts(), which was called every time a subtitle renderer was initialized. I'm not sure why this was done - I can't find a good reason, and most likely there's none. However, it did cause problems with an experimental libass branch. It crashed some time after switching to a second subtitle track. The branch will hopefully be merged soon, and it seems unlikely that libass wants to fix its problems with its ridiculous API (rather it should normalize its API so that the issue doesn't happen in the first place), so just apply this change. It makes our code simpler too. --- player/sub.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'player/sub.c') diff --git a/player/sub.c b/player/sub.c index 548e7b22d9..384339c9e2 100644 --- a/player/sub.c +++ b/player/sub.c @@ -109,6 +109,9 @@ static void init_sub_renderer(struct MPContext *mpctx) ass_set_style_overrides(mpctx->ass_library, opts->ass_force_style_list); mpctx->ass_renderer = ass_renderer_init(mpctx->ass_library); + + mp_ass_configure_fonts(mpctx->ass_renderer, opts->sub_text_style, + mpctx->global, mpctx->ass_log); } void uninit_sub_renderer(struct MPContext *mpctx) @@ -126,9 +129,6 @@ void uninit_sub_renderer(struct MPContext *mpctx) static void init_sub_renderer(struct MPContext *mpctx) {} void uninit_sub_renderer(struct MPContext *mpctx) {} -static void mp_ass_configure_fonts(struct ass_renderer *a, struct osd_style_opts *b, - struct mpv_global *c, struct mp_log *d) {} - #endif static void reset_subtitles(struct MPContext *mpctx, int order) @@ -310,13 +310,6 @@ static void reinit_subdec(struct MPContext *mpctx, struct track *track, &mpctx->ass_lock); sub_init_from_sh(dec_sub, track->stream); - if (mpctx->ass_renderer) { - pthread_mutex_lock(&mpctx->ass_lock); - mp_ass_configure_fonts(mpctx->ass_renderer, opts->sub_text_style, - mpctx->global, mpctx->ass_log); - pthread_mutex_unlock(&mpctx->ass_lock); - } - // Don't do this if the file has video/audio streams. Don't do it even // if it has only sub streams, because reading packets will change the // demuxer position. -- cgit v1.2.3