mirror of https://github.com/mpv-player/mpv
subs: libass: apply option changes to all track types
Libass rendering uses two renderer objects to support both VSFilter aspect ratio (mis)behavior emulation and correct rendering. When option values were changed during playback the changes were applied to the renderer used for the currently active track only, and old values could be used if the user then switched to a track using the other renderer object. Fix to update both renderers.
This commit is contained in:
parent
f5d493d017
commit
8d1e5354e4
|
@ -362,7 +362,11 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
|
|||
vf->priv->renderer_vsfilter : vf->priv->renderer_realaspect;
|
||||
if (sub_visibility && renderer && osd->ass_track
|
||||
&& (pts != MP_NOPTS_VALUE)) {
|
||||
mp_ass_reload_options(renderer, vf->opts, &osd->ass_force_reload);
|
||||
if (osd->ass_force_reload) {
|
||||
mp_ass_reload_options(vf->priv->renderer_realaspect, vf->opts);
|
||||
mp_ass_reload_options(vf->priv->renderer_vsfilter, vf->opts);
|
||||
}
|
||||
osd->ass_force_reload = false;
|
||||
images = ass_render_frame(renderer, osd->ass_track,
|
||||
(pts + sub_delay) * 1000 + .5, NULL);
|
||||
}
|
||||
|
|
|
@ -175,12 +175,16 @@ static int control(struct vf_instance *vf, int request, void* data)
|
|||
ass_set_aspect_ratio(renderer, scale, 1);
|
||||
}
|
||||
|
||||
mp_ass_reload_options(renderer, vf->opts, &osd->ass_force_reload);
|
||||
if (osd->ass_force_reload) {
|
||||
mp_ass_reload_options(vf->priv->renderer_realaspect, vf->opts);
|
||||
mp_ass_reload_options(vf->priv->renderer_vsfilter, vf->opts);
|
||||
}
|
||||
images.imgs = ass_render_frame(renderer, osd->ass_track,
|
||||
(pts+sub_delay) * 1000 + .5,
|
||||
&images.changed);
|
||||
if (!vf->priv->prev_visibility)
|
||||
if (!vf->priv->prev_visibility || osd->ass_force_reload)
|
||||
images.changed = 2;
|
||||
osd->ass_force_reload = false;
|
||||
vf->priv->prev_visibility = true;
|
||||
} else
|
||||
vf->priv->prev_visibility = false;
|
||||
|
|
|
@ -316,16 +316,12 @@ ASS_Library *mp_ass_init(void)
|
|||
return priv;
|
||||
}
|
||||
|
||||
void mp_ass_reload_options(ASS_Renderer *priv, struct MPOpts *opts,
|
||||
bool *need_reload)
|
||||
void mp_ass_reload_options(ASS_Renderer *priv, struct MPOpts *opts)
|
||||
{
|
||||
if (!*need_reload)
|
||||
return;
|
||||
/* This could be needed for vf_ass case if the margins were actually
|
||||
* runtime configurable, but would be wrong with EOSD:
|
||||
* ass_set_margins(priv, ass_top_margin, ass_bottom_margin, 0, 0);
|
||||
*/
|
||||
ass_set_use_margins(priv, ass_use_margins);
|
||||
ass_set_font_scale(priv, ass_font_scale);
|
||||
*need_reload = false;
|
||||
}
|
||||
|
|
|
@ -52,8 +52,7 @@ void mp_ass_configure(ASS_Renderer *priv, int w, int h, bool unscaled);
|
|||
void mp_ass_configure_fonts(ASS_Renderer *priv);
|
||||
ASS_Library *mp_ass_init(void);
|
||||
|
||||
void mp_ass_reload_options(ASS_Renderer *priv, struct MPOpts *opts,
|
||||
bool *need_reload);
|
||||
void mp_ass_reload_options(ASS_Renderer *priv, struct MPOpts *opts);
|
||||
|
||||
#else /* CONFIG_ASS */
|
||||
|
||||
|
|
Loading…
Reference in New Issue