From 8d1e5354e43d25e839c953bd0319163cf6c95d82 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 8 Aug 2011 06:52:39 +0300 Subject: [PATCH] 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. --- libmpcodecs/vf_ass.c | 6 +++++- libmpcodecs/vf_vo.c | 8 ++++++-- sub/ass_mp.c | 6 +----- sub/ass_mp.h | 3 +-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/libmpcodecs/vf_ass.c b/libmpcodecs/vf_ass.c index a3a47f6b9e..76a08807e7 100644 --- a/libmpcodecs/vf_ass.c +++ b/libmpcodecs/vf_ass.c @@ -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); } diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c index 8f2f541fb4..62ec64ef3f 100644 --- a/libmpcodecs/vf_vo.c +++ b/libmpcodecs/vf_vo.c @@ -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; diff --git a/sub/ass_mp.c b/sub/ass_mp.c index 312a35a4a6..6fd50342c3 100644 --- a/sub/ass_mp.c +++ b/sub/ass_mp.c @@ -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; } diff --git a/sub/ass_mp.h b/sub/ass_mp.h index 02c55c8a12..5658f4f8c1 100644 --- a/sub/ass_mp.h +++ b/sub/ass_mp.h @@ -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 */