mirror of
https://github.com/mpv-player/mpv
synced 2025-02-28 11:20:56 +00:00
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.
This commit is contained in:
parent
57efe9089c
commit
8771838408
13
player/sub.c
13
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.
|
||||
|
Loading…
Reference in New Issue
Block a user