summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-07-13 23:11:54 +0200
committerwm4 <wm4@nowhere>2015-07-13 23:11:54 +0200
commit87718384082a88a660f66d2de30421a93bf67293 (patch)
tree0ccede4e64abf36e6b06b973567281f91137993d
parent57efe9089cf51587d24686b98b319812e4c9ce23 (diff)
downloadmpv-87718384082a88a660f66d2de30421a93bf67293.tar.bz2
mpv-87718384082a88a660f66d2de30421a93bf67293.tar.xz
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.
-rw-r--r--player/sub.c13
1 files changed, 3 insertions, 10 deletions
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.